mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 22:28:56 +00:00
(svn r9390) -Documentation : correct Doxygen of comments and @file inclusion. This time, brought to you by the letter O
This commit is contained in:
parent
d7f56f1550
commit
57557ba599
@ -1,5 +1,7 @@
|
||||
/* $Id$ */
|
||||
|
||||
/** @file oldloader.cpp */
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "openttd.h"
|
||||
#include "station_map.h"
|
||||
@ -415,11 +417,11 @@ static const OldChunks town_chunk[] = {
|
||||
OCL_SVAR( OC_UINT16, Town, townnametype ),
|
||||
OCL_SVAR( OC_UINT32, Town, townnameparts ),
|
||||
OCL_SVAR( OC_UINT8, Town, grow_counter ),
|
||||
OCL_NULL( 1 ), // sort_index, no longer in use
|
||||
OCL_NULL( 4 ), // sign-coordinates, no longer in use
|
||||
OCL_NULL( 2 ), // namewidth, no longer in use
|
||||
OCL_NULL( 1 ), ///< sort_index, no longer in use
|
||||
OCL_NULL( 4 ), ///< sign-coordinates, no longer in use
|
||||
OCL_NULL( 2 ), ///< namewidth, no longer in use
|
||||
OCL_SVAR( OC_UINT16, Town, flags12 ),
|
||||
OCL_NULL( 10 ), // radius, no longer in use
|
||||
OCL_NULL( 10 ), ///< radius, no longer in use
|
||||
|
||||
OCL_SVAR( OC_UINT16, Town, ratings[0] ),
|
||||
OCL_SVAR( OC_UINT16, Town, ratings[1] ),
|
||||
@ -458,7 +460,7 @@ static const OldChunks town_chunk[] = {
|
||||
OCL_SVAR( OC_UINT8, Town, road_build_months ),
|
||||
OCL_SVAR( OC_UINT8, Town, fund_buildings_months ),
|
||||
|
||||
OCL_NULL( 8 ), // some junk at the end of the record
|
||||
OCL_NULL( 8 ), ///< some junk at the end of the record
|
||||
|
||||
OCL_END()
|
||||
};
|
||||
@ -538,7 +540,7 @@ static const OldChunks cargo_payment_rate_chunk[] = {
|
||||
OCL_VAR ( OC_INT32, 1, &_old_price ),
|
||||
OCL_VAR ( OC_UINT16, 1, &_old_price_frac ),
|
||||
|
||||
OCL_NULL( 2 ), // Junk
|
||||
OCL_NULL( 2 ), ///< Junk
|
||||
OCL_END()
|
||||
};
|
||||
|
||||
@ -577,19 +579,19 @@ static const OldChunks station_chunk[] = {
|
||||
OCL_SVAR( OC_TILE, Station, xy ),
|
||||
OCL_VAR ( OC_UINT32, 1, &_old_town_index ),
|
||||
|
||||
OCL_NULL( 4 ), // bus/lorry tile
|
||||
OCL_NULL( 4 ), ///< bus/lorry tile
|
||||
OCL_SVAR( OC_TILE, Station, train_tile ),
|
||||
OCL_SVAR( OC_TILE, Station, airport_tile ),
|
||||
OCL_SVAR( OC_TILE, Station, dock_tile ),
|
||||
|
||||
OCL_VAR ( OC_UINT8, 1, &_old_platforms ),
|
||||
|
||||
OCL_NULL( 1 ), // sort-index, no longer in use
|
||||
OCL_NULL( 2 ), // sign-width, no longer in use
|
||||
OCL_NULL( 1 ), ///< sort-index, no longer in use
|
||||
OCL_NULL( 2 ), ///< sign-width, no longer in use
|
||||
|
||||
OCL_VAR ( OC_UINT16, 1, &_old_string_id ),
|
||||
|
||||
OCL_NULL( 4 ), // sign left/top, no longer in use
|
||||
OCL_NULL( 4 ), ///< sign left/top, no longer in use
|
||||
|
||||
OCL_SVAR( OC_UINT16, Station, had_vehicle_of_type ),
|
||||
|
||||
@ -607,9 +609,9 @@ static const OldChunks station_chunk[] = {
|
||||
*/
|
||||
OCL_NULL( 4 ),
|
||||
OCL_SVAR( OC_FILE_U16 | OC_VAR_U32, Station, airport_flags ),
|
||||
OCL_NULL( 2 ), // last_vehicle. now last_vehicle_type
|
||||
OCL_NULL( 2 ), ///< last_vehicle. now last_vehicle_type
|
||||
|
||||
OCL_NULL( 4 ), // Junk at end of chunk
|
||||
OCL_NULL( 4 ), ///< Junk at end of chunk
|
||||
|
||||
OCL_END()
|
||||
};
|
||||
@ -682,7 +684,7 @@ static const OldChunks industry_chunk[] = {
|
||||
OCL_SVAR( OC_UINT16, Industry, counter ),
|
||||
OCL_SVAR( OC_UINT8, Industry, was_cargo_delivered ),
|
||||
|
||||
OCL_NULL( 9 ), // Random junk at the end of this chunk
|
||||
OCL_NULL( 9 ), ///< Random junk at the end of this chunk
|
||||
|
||||
OCL_END()
|
||||
};
|
||||
@ -769,7 +771,7 @@ static const OldChunks player_ai_build_rec_chunk[] = {
|
||||
OCL_SVAR( OC_UINT8, AiBuildRec, direction ),
|
||||
OCL_SVAR( OC_UINT8, AiBuildRec, cargo ),
|
||||
|
||||
OCL_NULL( 8 ), // Junk...
|
||||
OCL_NULL( 8 ), ///< Junk...
|
||||
|
||||
OCL_END()
|
||||
};
|
||||
@ -789,14 +791,14 @@ static bool OldLoadAIBuildRec(LoadgameState *ls, int num)
|
||||
}
|
||||
static const OldChunks player_ai_chunk[] = {
|
||||
OCL_SVAR( OC_UINT8, PlayerAI, state ),
|
||||
OCL_NULL( 1 ), // Junk
|
||||
OCL_NULL( 1 ), ///< Junk
|
||||
OCL_SVAR( OC_UINT8, PlayerAI, state_mode ),
|
||||
OCL_SVAR( OC_UINT16, PlayerAI, state_counter ),
|
||||
OCL_SVAR( OC_UINT16, PlayerAI, timeout_counter ),
|
||||
|
||||
OCL_CHUNK( 4, OldLoadAIBuildRec ),
|
||||
|
||||
OCL_NULL( 20 ), // More junk
|
||||
OCL_NULL( 20 ), ///< More junk
|
||||
|
||||
OCL_SVAR( OC_UINT8, PlayerAI, cargo_type ),
|
||||
OCL_SVAR( OC_UINT8, PlayerAI, num_wagons ),
|
||||
@ -805,9 +807,9 @@ static const OldChunks player_ai_chunk[] = {
|
||||
OCL_SVAR( OC_UINT8, PlayerAI, num_loco_to_build ),
|
||||
OCL_SVAR( OC_UINT8, PlayerAI, num_want_fullload ),
|
||||
|
||||
OCL_NULL( 14 ), // Oh no more junk :|
|
||||
OCL_NULL( 14 ), ///< Oh no more junk :|
|
||||
|
||||
OCL_NULL( 2 ), // Loco-id, not used
|
||||
OCL_NULL( 2 ), ///< Loco-id, not used
|
||||
|
||||
OCL_SVAR( OC_UINT16, PlayerAI, wagon_list[0] ),
|
||||
OCL_SVAR( OC_UINT16, PlayerAI, wagon_list[1] ),
|
||||
@ -934,7 +936,7 @@ static const OldChunks player_chunk[] = {
|
||||
OCL_SVAR( OC_UINT8, Player, share_owners[2] ),
|
||||
OCL_SVAR( OC_UINT8, Player, share_owners[3] ),
|
||||
|
||||
OCL_NULL( 8 ), // junk at end of chunk
|
||||
OCL_NULL( 8 ), ///< junk at end of chunk
|
||||
|
||||
OCL_END()
|
||||
};
|
||||
@ -996,7 +998,7 @@ static const OldChunks vehicle_train_chunk[] = {
|
||||
OCL_SVAR( OC_UINT16, VehicleRail, crash_anim_pos ),
|
||||
OCL_SVAR( OC_UINT8, VehicleRail, railtype ),
|
||||
|
||||
OCL_NULL( 5 ), // Junk
|
||||
OCL_NULL( 5 ), ///< Junk
|
||||
|
||||
OCL_END()
|
||||
};
|
||||
@ -1010,7 +1012,7 @@ static const OldChunks vehicle_road_chunk[] = {
|
||||
OCL_SVAR( OC_UINT16, VehicleRoad, crashed_ctr ),
|
||||
OCL_SVAR( OC_UINT8, VehicleRoad, reverse_ctr ),
|
||||
|
||||
OCL_NULL( 1 ), // Junk
|
||||
OCL_NULL( 1 ), ///< Junk
|
||||
|
||||
OCL_END()
|
||||
};
|
||||
@ -1018,7 +1020,7 @@ static const OldChunks vehicle_road_chunk[] = {
|
||||
static const OldChunks vehicle_ship_chunk[] = {
|
||||
OCL_SVAR( OC_UINT8, VehicleShip, state ),
|
||||
|
||||
OCL_NULL( 9 ), // Junk
|
||||
OCL_NULL( 9 ), ///< Junk
|
||||
|
||||
OCL_END()
|
||||
};
|
||||
@ -1029,7 +1031,7 @@ static const OldChunks vehicle_air_chunk[] = {
|
||||
OCL_SVAR( OC_UINT16, VehicleAir, crashed_counter ),
|
||||
OCL_SVAR( OC_UINT8, VehicleAir, state ),
|
||||
|
||||
OCL_NULL( 5 ), // Junk
|
||||
OCL_NULL( 5 ), ///< Junk
|
||||
|
||||
OCL_END()
|
||||
};
|
||||
@ -1047,13 +1049,13 @@ static const OldChunks vehicle_disaster_chunk[] = {
|
||||
OCL_SVAR( OC_UINT16, VehicleDisaster, image_override ),
|
||||
OCL_SVAR( OC_UINT16, VehicleDisaster, unk2 ),
|
||||
|
||||
OCL_NULL( 6 ), // Junk
|
||||
OCL_NULL( 6 ), ///< Junk
|
||||
|
||||
OCL_END()
|
||||
};
|
||||
|
||||
static const OldChunks vehicle_empty_chunk[] = {
|
||||
OCL_NULL( 10 ), // Junk
|
||||
OCL_NULL( 10 ), ///< Junk
|
||||
|
||||
OCL_END()
|
||||
};
|
||||
@ -1090,8 +1092,8 @@ static const OldChunks vehicle_chunk[] = {
|
||||
OCL_SVAR( OC_UINT8, Vehicle, type ),
|
||||
OCL_SVAR( OC_UINT8, Vehicle, subtype ),
|
||||
|
||||
OCL_NULL( 2 ), // Hash, calculated automatically
|
||||
OCL_NULL( 2 ), // Index, calculated automatically
|
||||
OCL_NULL( 2 ), ///< Hash, calculated automatically
|
||||
OCL_NULL( 2 ), ///< Index, calculated automatically
|
||||
|
||||
OCL_VAR ( OC_UINT32, 1, &_old_order_ptr ),
|
||||
OCL_VAR ( OC_UINT16, 1, &_old_order ),
|
||||
@ -1120,7 +1122,7 @@ static const OldChunks vehicle_chunk[] = {
|
||||
OCL_SVAR( OC_TILE, Vehicle, tile ),
|
||||
OCL_SVAR( OC_UINT16, Vehicle, cur_image ),
|
||||
|
||||
OCL_NULL( 8 ), // Vehicle sprite box, calculated automatically
|
||||
OCL_NULL( 8 ), ///< Vehicle sprite box, calculated automatically
|
||||
|
||||
OCL_SVAR( OC_FILE_U16 | OC_VAR_U8, Vehicle, vehstatus ),
|
||||
OCL_SVAR( OC_UINT16, Vehicle, cur_speed ),
|
||||
@ -1163,7 +1165,7 @@ static const OldChunks vehicle_chunk[] = {
|
||||
|
||||
OCL_CHUNK( 1, LoadOldVehicleUnion ),
|
||||
|
||||
OCL_NULL( 20 ), // Junk at end of struct (TTDPatch has some data in it)
|
||||
OCL_NULL( 20 ), ///< Junk at end of struct (TTDPatch has some data in it)
|
||||
|
||||
OCL_END()
|
||||
};
|
||||
@ -1221,7 +1223,7 @@ static const OldChunks sign_chunk[] = {
|
||||
OCL_SVAR( OC_FILE_U16 | OC_VAR_I32,Sign, y ),
|
||||
OCL_SVAR( OC_FILE_U16 | OC_VAR_I8, Sign, z ),
|
||||
|
||||
OCL_NULL( 6 ), // Width of sign, no longer in use
|
||||
OCL_NULL( 6 ), ///< Width of sign, no longer in use
|
||||
|
||||
OCL_END()
|
||||
};
|
||||
@ -1252,7 +1254,7 @@ static const OldChunks engine_chunk[] = {
|
||||
OCL_SVAR( OC_UINT8, Engine, preview_player ),
|
||||
OCL_SVAR( OC_UINT8, Engine, preview_wait ),
|
||||
|
||||
OCL_NULL( 2 ), // Junk
|
||||
OCL_NULL( 2 ), ///< Junk
|
||||
|
||||
OCL_END()
|
||||
};
|
||||
@ -1385,7 +1387,8 @@ static bool LoadTTDPatchExtraChunks(LoadgameState *ls, int num)
|
||||
AppendStaticGRFConfigs(&_grfconfig);
|
||||
} break;
|
||||
|
||||
case 0x3: { /* TTDPatch version and configuration */
|
||||
/* TTDPatch version and configuration */
|
||||
case 0x3: {
|
||||
uint32 ttdpv = ReadUint32(ls);
|
||||
DEBUG(oldloader, 3, "Game saved with TTDPatch version %d.%d.%d r%d", GB(ttdpv, 24, 8), GB(ttdpv, 20, 4), GB(ttdpv, 16, 4), GB(ttdpv, 0, 16));
|
||||
len -= 4;
|
||||
@ -1407,7 +1410,7 @@ static const OldChunks main_chunk[] = {
|
||||
OCL_ASSERT( 0 ),
|
||||
OCL_VAR ( OC_FILE_U16 | OC_VAR_U32, 1, &_date ),
|
||||
OCL_VAR ( OC_UINT16, 1, &_date_fract ),
|
||||
OCL_NULL( 600 ), // TextEffects
|
||||
OCL_NULL( 600 ), ///< TextEffects
|
||||
OCL_VAR ( OC_UINT32, 2, &_random_seeds[0] ),
|
||||
|
||||
OCL_ASSERT( 0x264 ),
|
||||
@ -1417,14 +1420,14 @@ static const OldChunks main_chunk[] = {
|
||||
OCL_ASSERT( 0x4328 ),
|
||||
|
||||
OCL_VAR ( OC_TILE, 256, &_animated_tile_list[0] ),
|
||||
OCL_NULL( 4 ), // old end-of-order-list-pointer, no longer in use
|
||||
OCL_NULL( 4 ), ///< old end-of-order-list-pointer, no longer in use
|
||||
|
||||
OCL_CHUNK( 255, LoadOldDepot ),
|
||||
OCL_ASSERT( 0x4B26 ),
|
||||
|
||||
OCL_VAR ( OC_UINT32, 1, &_old_cur_town_ctr ),
|
||||
OCL_NULL( 2 ), // timer_counter, no longer in use
|
||||
OCL_NULL( 2 ), // land_code, no longer in use
|
||||
OCL_NULL( 2 ), ///< timer_counter, no longer in use
|
||||
OCL_NULL( 2 ), ///< land_code, no longer in use
|
||||
|
||||
OCL_VAR ( OC_FILE_U16 | OC_VAR_U8, 1, &_age_cargo_skip_counter ),
|
||||
OCL_VAR ( OC_UINT16, 1, &_tick_counter ),
|
||||
@ -1451,7 +1454,7 @@ static const OldChunks main_chunk[] = {
|
||||
|
||||
OCL_VAR ( OC_UINT8, 32 * 500, &_name_array[0] ),
|
||||
|
||||
OCL_NULL( 0x2000 ), // Old hash-table, no longer in use
|
||||
OCL_NULL( 0x2000 ), ///< Old hash-table, no longer in use
|
||||
|
||||
OCL_CHUNK( 40, LoadOldSign ),
|
||||
OCL_CHUNK(256, LoadOldEngine ),
|
||||
@ -1471,12 +1474,12 @@ static const OldChunks main_chunk[] = {
|
||||
|
||||
OCL_VAR ( OC_UINT16, 1, &_disaster_delay ),
|
||||
|
||||
OCL_NULL( 144 ), // cargo-stuff, calculated in InitializeLandscapeVariables
|
||||
OCL_NULL( 144 ), ///< cargo-stuff, calculated in InitializeLandscapeVariables
|
||||
|
||||
OCL_VAR ( OC_UINT16, 256, &_engine_name_strings[0] ),
|
||||
|
||||
OCL_NULL( 144 ), // AI cargo-stuff, calculated in InitializeLandscapeVariables
|
||||
OCL_NULL( 2 ), // Company indexes of players, no longer in use
|
||||
OCL_NULL( 144 ), ///< AI cargo-stuff, calculated in InitializeLandscapeVariables
|
||||
OCL_NULL( 2 ), ///< Company indexes of players, no longer in use
|
||||
|
||||
OCL_VAR ( OC_FILE_U8 | OC_VAR_U16, 1, &_station_tick_ctr ),
|
||||
|
||||
@ -1484,8 +1487,8 @@ static const OldChunks main_chunk[] = {
|
||||
OCL_VAR ( OC_UINT8, 1, &_opt.units ),
|
||||
OCL_VAR ( OC_FILE_U8 | OC_VAR_U32, 1, &_cur_player_tick_index ),
|
||||
|
||||
OCL_NULL( 2 ), // Date stuff, calculated automatically
|
||||
OCL_NULL( 8 ), // Player colors, calculated automatically
|
||||
OCL_NULL( 2 ), ///< Date stuff, calculated automatically
|
||||
OCL_NULL( 8 ), ///< Player colors, calculated automatically
|
||||
|
||||
OCL_VAR ( OC_UINT8, 1, &_economy.infl_amount ),
|
||||
OCL_VAR ( OC_UINT8, 1, &_economy.infl_amount_pr ),
|
||||
@ -1502,11 +1505,11 @@ static const OldChunks main_chunk[] = {
|
||||
OCL_VAR ( OC_UINT8, 1, &_opt.landscape ),
|
||||
OCL_VAR ( OC_UINT8, 1, &_trees_tick_ctr ),
|
||||
|
||||
OCL_NULL( 1 ), // Custom vehicle types yes/no, no longer used
|
||||
OCL_NULL( 1 ), ///< Custom vehicle types yes/no, no longer used
|
||||
OCL_VAR ( OC_UINT8, 1, &_opt.snow_line ),
|
||||
|
||||
OCL_NULL( 32 ), // new_industry_randtable, no longer used (because of new design)
|
||||
OCL_NULL( 36 ), // cargo-stuff, calculated in InitializeLandscapeVariables
|
||||
OCL_NULL( 32 ), ///< new_industry_randtable, no longer used (because of new design)
|
||||
OCL_NULL( 36 ), ///< cargo-stuff, calculated in InitializeLandscapeVariables
|
||||
|
||||
OCL_ASSERT( 0x77179 ),
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* $Id$ */
|
||||
|
||||
/** @file oldpool.cpp */
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "openttd.h"
|
||||
#include "debug.h"
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* $Id$ */
|
||||
|
||||
/** @file oldpool.h */
|
||||
|
||||
#ifndef OLDPOOL_H
|
||||
#define OLDPOOL_H
|
||||
|
||||
|
198
src/openttd.cpp
198
src/openttd.cpp
@ -1,5 +1,7 @@
|
||||
/* $Id$ */
|
||||
|
||||
/** @file openttd.cpp */
|
||||
|
||||
#include "stdafx.h"
|
||||
#define VARDEF
|
||||
#include "string.h"
|
||||
@ -220,17 +222,17 @@ static int MyGetOpt(MyGetOptData *md)
|
||||
md_continue_here:;
|
||||
s++;
|
||||
if (*s != 0) {
|
||||
// Found argument, try to locate it in options.
|
||||
/* Found argument, try to locate it in options. */
|
||||
if (*s == ':' || (r = strchr(md->options, *s)) == NULL) {
|
||||
// ERROR!
|
||||
/* ERROR! */
|
||||
return -2;
|
||||
}
|
||||
if (r[1] == ':') {
|
||||
// Item wants an argument. Check if the argument follows, or if it comes as a separate arg.
|
||||
/* Item wants an argument. Check if the argument follows, or if it comes as a separate arg. */
|
||||
if (!*(t = s + 1)) {
|
||||
// It comes as a separate arg. Check if out of args?
|
||||
/* It comes as a separate arg. Check if out of args? */
|
||||
if (--md->numleft < 0 || *(t = *md->argv) == '-') {
|
||||
// Check if item is optional?
|
||||
/* Check if item is optional? */
|
||||
if (r[2] != ':')
|
||||
return -2;
|
||||
md->numleft++;
|
||||
@ -248,7 +250,7 @@ md_continue_here:;
|
||||
return *s;
|
||||
}
|
||||
} else {
|
||||
// This is currently not supported.
|
||||
/* This is currently not supported. */
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
@ -305,11 +307,11 @@ static void LoadIntroGame()
|
||||
_opt_ptr = &_opt_newgame;
|
||||
ResetGRFConfig(false);
|
||||
|
||||
// Setup main window
|
||||
/* Setup main window */
|
||||
ResetWindowSystem();
|
||||
SetupColorsAndInitialWindow();
|
||||
|
||||
// Generate a world.
|
||||
/* Generate a world. */
|
||||
snprintf(filename, lengthof(filename), "%sopntitle.dat", _paths.data_dir);
|
||||
#if defined SECOND_DATA_DIR
|
||||
if (SaveOrLoad(filename, SL_LOAD) != SL_OK) {
|
||||
@ -328,7 +330,7 @@ static void LoadIntroGame()
|
||||
_cursor.fix_at = false;
|
||||
MarkWholeScreenDirty();
|
||||
|
||||
// Play main theme
|
||||
/* Play main theme */
|
||||
if (_music_driver->is_song_playing()) ResetMusic();
|
||||
}
|
||||
|
||||
@ -362,10 +364,10 @@ int ttd_main(int argc, char *argv[])
|
||||
_dedicated_forks = false;
|
||||
_config_file = NULL;
|
||||
|
||||
// The last param of the following function means this:
|
||||
// a letter means: it accepts that param (e.g.: -h)
|
||||
// a ':' behind it means: it need a param (e.g.: -m<driver>)
|
||||
// a '::' behind it means: it can optional have a param (e.g.: -d<debug>)
|
||||
/* The last param of the following function means this:
|
||||
* a letter means: it accepts that param (e.g.: -h)
|
||||
* a ':' behind it means: it need a param (e.g.: -m<driver>)
|
||||
* a '::' behind it means: it can optional have a param (e.g.: -d<debug>) */
|
||||
optformat = "m:s:v:hD::n::eit:d::r:g::G:c:xl:"
|
||||
#if !defined(__MORPHOS__) && !defined(__AMIGA__) && !defined(WIN32)
|
||||
"f"
|
||||
@ -438,7 +440,7 @@ int ttd_main(int argc, char *argv[])
|
||||
CheckExternalFiles();
|
||||
|
||||
#if defined(UNIX) && !defined(__MORPHOS__)
|
||||
// We must fork here, or we'll end up without some resources we need (like sockets)
|
||||
/* We must fork here, or we'll end up without some resources we need (like sockets) */
|
||||
if (_dedicated_forks)
|
||||
DedicatedFork();
|
||||
#endif
|
||||
@ -447,7 +449,7 @@ int ttd_main(int argc, char *argv[])
|
||||
CheckConfig();
|
||||
LoadFromHighScore();
|
||||
|
||||
// override config?
|
||||
/* override config? */
|
||||
if (!StrEmpty(musicdriver)) ttd_strlcpy(_ini_musicdriver, musicdriver, sizeof(_ini_musicdriver));
|
||||
if (!StrEmpty(sounddriver)) ttd_strlcpy(_ini_sounddriver, sounddriver, sizeof(_ini_sounddriver));
|
||||
if (!StrEmpty(videodriver)) ttd_strlcpy(_ini_videodriver, videodriver, sizeof(_ini_videodriver));
|
||||
@ -461,13 +463,13 @@ int ttd_main(int argc, char *argv[])
|
||||
if (_dedicated_forks && !dedicated) _dedicated_forks = false;
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
// enumerate language files
|
||||
/* enumerate language files */
|
||||
InitializeLanguagePacks();
|
||||
|
||||
// initialize screenshot formats
|
||||
/* initialize screenshot formats */
|
||||
InitializeScreenshotFormats();
|
||||
|
||||
// initialize airport state machines
|
||||
/* initialize airport state machines */
|
||||
InitializeAirports();
|
||||
|
||||
/* initialize all variables that are allocated dynamically */
|
||||
@ -476,7 +478,7 @@ int ttd_main(int argc, char *argv[])
|
||||
/* start the AI */
|
||||
AI_Initialize();
|
||||
|
||||
// Sample catalogue
|
||||
/* Sample catalogue */
|
||||
DEBUG(misc, 1, "Loading sound effects...");
|
||||
MxInitialize(11025);
|
||||
SoundInitialize("sample.cat");
|
||||
@ -484,7 +486,7 @@ int ttd_main(int argc, char *argv[])
|
||||
/* Initialize FreeType */
|
||||
InitFreeType();
|
||||
|
||||
// This must be done early, since functions use the InvalidateWindow* calls
|
||||
/* This must be done early, since functions use the InvalidateWindow* calls */
|
||||
InitWindowSystem();
|
||||
|
||||
/* Initialize game palette */
|
||||
@ -496,7 +498,7 @@ int ttd_main(int argc, char *argv[])
|
||||
LoadDriver(VIDEO_DRIVER, _ini_videodriver); // load video last, to prevent an empty window while sound and music loads
|
||||
_savegame_sort_order = SORT_BY_DATE | SORT_DESCENDING;
|
||||
|
||||
// restore saved music volume
|
||||
/* restore saved music volume */
|
||||
_music_driver->set_volume(msf.music_vol);
|
||||
|
||||
NetworkStartUp(); // initialize network-core
|
||||
@ -530,7 +532,7 @@ int ttd_main(int argc, char *argv[])
|
||||
UpdatePatches();
|
||||
}
|
||||
|
||||
// initialize the ingame console
|
||||
/* initialize the ingame console */
|
||||
IConsoleInit();
|
||||
_cursor.in_window = true;
|
||||
InitializeGUI();
|
||||
@ -714,7 +716,7 @@ static void StartScenario()
|
||||
{
|
||||
_game_mode = GM_NORMAL;
|
||||
|
||||
// invalid type
|
||||
/* invalid type */
|
||||
if (_file_to_saveload.mode == SL_INVALID) {
|
||||
DEBUG(sl, 0, "Savegame is obsolete or invalid format: '%s'", _file_to_saveload.name);
|
||||
ShowErrorMessage(INVALID_STRING_ID, STR_4009_GAME_LOAD_FAILED, 0, 0);
|
||||
@ -722,14 +724,14 @@ static void StartScenario()
|
||||
return;
|
||||
}
|
||||
|
||||
// Reinitialize windows
|
||||
/* Reinitialize windows */
|
||||
ResetWindowSystem();
|
||||
|
||||
SetupColorsAndInitialWindow();
|
||||
|
||||
ResetGRFConfig(true);
|
||||
|
||||
// Load game
|
||||
/* Load game */
|
||||
if (SaveOrLoad(_file_to_saveload.name, _file_to_saveload.mode) != SL_OK) {
|
||||
LoadIntroGame();
|
||||
ShowErrorMessage(INVALID_STRING_ID, STR_4009_GAME_LOAD_FAILED, 0, 0);
|
||||
@ -739,7 +741,7 @@ static void StartScenario()
|
||||
_opt_ptr->diff = _opt_newgame.diff;
|
||||
_opt.diff_level = _opt_newgame.diff_level;
|
||||
|
||||
// Inititalize data
|
||||
/* Inititalize data */
|
||||
StartupEconomy();
|
||||
StartupPlayers();
|
||||
StartupEngines();
|
||||
@ -777,9 +779,9 @@ bool SafeSaveOrLoad(const char *filename, int mode, int newgm)
|
||||
void SwitchMode(int new_mode)
|
||||
{
|
||||
#ifdef ENABLE_NETWORK
|
||||
// If we are saving something, the network stays in his current state
|
||||
/* If we are saving something, the network stays in his current state */
|
||||
if (new_mode != SM_SAVE) {
|
||||
// If the network is active, make it not-active
|
||||
/* If the network is active, make it not-active */
|
||||
if (_networking) {
|
||||
if (_network_server && (new_mode == SM_LOAD || new_mode == SM_NEWGAME)) {
|
||||
NetworkReboot();
|
||||
@ -790,13 +792,13 @@ void SwitchMode(int new_mode)
|
||||
}
|
||||
}
|
||||
|
||||
// If we are a server, we restart the server
|
||||
/* If we are a server, we restart the server */
|
||||
if (_is_network_server) {
|
||||
// But not if we are going to the menu
|
||||
/* But not if we are going to the menu */
|
||||
if (new_mode != SM_MENU) {
|
||||
NetworkServerStart();
|
||||
} else {
|
||||
// This client no longer wants to be a network-server
|
||||
/* This client no longer wants to be a network-server */
|
||||
_is_network_server = false;
|
||||
}
|
||||
}
|
||||
@ -890,7 +892,7 @@ void SwitchMode(int new_mode)
|
||||
case SM_GENRANDLAND: /* Generate random land within scenario editor */
|
||||
SetLocalPlayer(OWNER_NONE);
|
||||
GenerateWorld(GW_RANDOM, 1 << _patches.map_x, 1 << _patches.map_y);
|
||||
// XXX: set date
|
||||
/* XXX: set date */
|
||||
MarkWholeScreenDirty();
|
||||
break;
|
||||
}
|
||||
@ -901,13 +903,13 @@ void SwitchMode(int new_mode)
|
||||
}
|
||||
|
||||
|
||||
// State controlling game loop.
|
||||
// The state must not be changed from anywhere
|
||||
// but here.
|
||||
// That check is enforced in DoCommand.
|
||||
/* State controlling game loop.
|
||||
* The state must not be changed from anywhere
|
||||
* but here.
|
||||
* That check is enforced in DoCommand. */
|
||||
void StateGameLoop()
|
||||
{
|
||||
// dont execute the state loop during pause
|
||||
/* dont execute the state loop during pause */
|
||||
if (_pause_game) return;
|
||||
if (IsGeneratingWorld()) return;
|
||||
|
||||
@ -918,8 +920,8 @@ void StateGameLoop()
|
||||
CallWindowTickEvent();
|
||||
NewsLoop();
|
||||
} else {
|
||||
// All these actions has to be done from OWNER_NONE
|
||||
// for multiplayer compatibility
|
||||
/* All these actions has to be done from OWNER_NONE
|
||||
* for multiplayer compatibility */
|
||||
PlayerID p = _current_player;
|
||||
_current_player = OWNER_NONE;
|
||||
|
||||
@ -958,12 +960,12 @@ static void DoAutosave()
|
||||
SetDParam(2, _date);
|
||||
s = GetString(s, STR_4004, lastof(buf));
|
||||
strecpy(s, ".sav", lastof(buf));
|
||||
} else { /* generate a savegame name and number according to _patches.max_num_autosaves */
|
||||
} else { // generate a savegame name and number according to _patches.max_num_autosaves
|
||||
snprintf(buf, lengthof(buf), "%s%sautosave%d.sav", _paths.autosave_dir, PATHSEP, _autosave_ctr);
|
||||
|
||||
_autosave_ctr++;
|
||||
if (_autosave_ctr >= _patches.max_num_autosaves) {
|
||||
// we reached the limit for numbers of autosaves. We will start over
|
||||
/* we reached the limit for numbers of autosaves. We will start over */
|
||||
_autosave_ctr = 0;
|
||||
}
|
||||
}
|
||||
@ -986,21 +988,21 @@ static void ScrollMainViewport(int x, int y)
|
||||
|
||||
static const int8 scrollamt[16][2] = {
|
||||
{ 0, 0},
|
||||
{-2, 0}, // 1 : left
|
||||
{ 0, -2}, // 2 : up
|
||||
{-2, -1}, // 3 : left + up
|
||||
{ 2, 0}, // 4 : right
|
||||
{ 0, 0}, // 5 : left + right
|
||||
{ 2, -1}, // 6 : right + up
|
||||
{ 0, -2}, // 7 : left + right + up = up
|
||||
{ 0 ,2}, // 8 : down
|
||||
{-2 ,1}, // 9 : down+left
|
||||
{ 0, 0}, // 10 : impossible
|
||||
{-2, 0}, // 11 : left + up + down = left
|
||||
{ 2, 1}, // 12 : down+right
|
||||
{ 0, 2}, // 13 : left + right + down = down
|
||||
{ 0, -2}, // 14 : left + right + up = up
|
||||
{ 0, 0}, // 15 : impossible
|
||||
{-2, 0}, ///< 1 : left
|
||||
{ 0, -2}, ///< 2 : up
|
||||
{-2, -1}, ///< 3 : left + up
|
||||
{ 2, 0}, ///< 4 : right
|
||||
{ 0, 0}, ///< 5 : left + right
|
||||
{ 2, -1}, ///< 6 : right + up
|
||||
{ 0, -2}, ///< 7 : left + right + up = up
|
||||
{ 0 ,2}, ///< 8 : down
|
||||
{-2 ,1}, ///< 9 : down+left
|
||||
{ 0, 0}, ///< 10 : impossible
|
||||
{-2, 0}, ///< 11 : left + up + down = left
|
||||
{ 2, 1}, ///< 12 : down+right
|
||||
{ 0, 2}, ///< 13 : left + right + down = down
|
||||
{ 0, -2}, ///< 14 : left + right + up = up
|
||||
{ 0, 0}, ///< 15 : impossible
|
||||
};
|
||||
|
||||
static void HandleKeyScrolling()
|
||||
@ -1017,20 +1019,20 @@ void GameLoop()
|
||||
|
||||
if ((message = OTTD_PollThreadEvent()) != 0) ProcessSentMessage(message);
|
||||
|
||||
// autosave game?
|
||||
/* autosave game? */
|
||||
if (_do_autosave) {
|
||||
_do_autosave = false;
|
||||
DoAutosave();
|
||||
RedrawAutosave();
|
||||
}
|
||||
|
||||
// handle scrolling of the main window
|
||||
/* handle scrolling of the main window */
|
||||
HandleKeyScrolling();
|
||||
|
||||
// make a screenshot?
|
||||
/* make a screenshot? */
|
||||
if (IsScreenshotRequested()) ShowScreenshotResult(MakeScreenshot());
|
||||
|
||||
// switch game mode?
|
||||
/* switch game mode? */
|
||||
if (_switch_mode != SM_NONE) {
|
||||
SwitchMode(_switch_mode);
|
||||
_switch_mode = SM_NONE;
|
||||
@ -1050,19 +1052,19 @@ void GameLoop()
|
||||
CursorTick();
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
// Check for UDP stuff
|
||||
/* Check for UDP stuff */
|
||||
if (_network_available) NetworkUDPGameLoop();
|
||||
|
||||
if (_networking && !IsGeneratingWorld()) {
|
||||
// Multiplayer
|
||||
/* Multiplayer */
|
||||
NetworkGameLoop();
|
||||
} else {
|
||||
if (_network_reconnect > 0 && --_network_reconnect == 0) {
|
||||
// This means that we want to reconnect to the last host
|
||||
// We do this here, because it means that the network is really closed
|
||||
/* This means that we want to reconnect to the last host
|
||||
* We do this here, because it means that the network is really closed */
|
||||
NetworkClientConnectGame(_network_last_host, _network_last_port);
|
||||
}
|
||||
// Singleplayer
|
||||
/* Singleplayer */
|
||||
StateGameLoop();
|
||||
}
|
||||
#else
|
||||
@ -1110,7 +1112,7 @@ static void ConvertTownOwner()
|
||||
}
|
||||
}
|
||||
|
||||
// before savegame version 4, the name of the company determined if it existed
|
||||
/* before savegame version 4, the name of the company determined if it existed */
|
||||
static void CheckIsPlayerActive()
|
||||
{
|
||||
Player *p;
|
||||
@ -1120,7 +1122,7 @@ static void CheckIsPlayerActive()
|
||||
}
|
||||
}
|
||||
|
||||
// since savegame version 4.1, exclusive transport rights are stored at towns
|
||||
/* since savegame version 4.1, exclusive transport rights are stored at towns */
|
||||
static void UpdateExclusiveRights()
|
||||
{
|
||||
Town *t;
|
||||
@ -1146,7 +1148,7 @@ static const byte convert_currency[] = {
|
||||
16, 22, 21, 7, 15,
|
||||
18, 2, 20, };
|
||||
|
||||
// since savegame version 4.2 the currencies are arranged differently
|
||||
/* since savegame version 4.2 the currencies are arranged differently */
|
||||
static void UpdateCurrencies()
|
||||
{
|
||||
_opt.currency = convert_currency[_opt.currency];
|
||||
@ -1163,7 +1165,7 @@ static void UpdateVoidTiles()
|
||||
for (i = 0; i < MapSizeX(); ++i) MakeVoid(MapSizeX() * MapMaxY() + i);
|
||||
}
|
||||
|
||||
// since savegame version 6.0 each sign has an "owner", signs without owner (from old games are set to 255)
|
||||
/* since savegame version 6.0 each sign has an "owner", signs without owner (from old games are set to 255) */
|
||||
static void UpdateSignOwner()
|
||||
{
|
||||
Sign *si;
|
||||
@ -1186,16 +1188,16 @@ bool AfterLoadGame()
|
||||
ViewPort *vp;
|
||||
Player *p;
|
||||
|
||||
// in version 2.1 of the savegame, town owner was unified.
|
||||
/* in version 2.1 of the savegame, town owner was unified. */
|
||||
if (CheckSavegameVersionOldStyle(2, 1)) ConvertTownOwner();
|
||||
|
||||
// from version 4.1 of the savegame, exclusive rights are stored at towns
|
||||
/* from version 4.1 of the savegame, exclusive rights are stored at towns */
|
||||
if (CheckSavegameVersionOldStyle(4, 1)) UpdateExclusiveRights();
|
||||
|
||||
// from version 4.2 of the savegame, currencies are in a different order
|
||||
/* from version 4.2 of the savegame, currencies are in a different order */
|
||||
if (CheckSavegameVersionOldStyle(4, 2)) UpdateCurrencies();
|
||||
|
||||
// from version 6.1 of the savegame, signs have an "owner"
|
||||
/* from version 6.1 of the savegame, signs have an "owner" */
|
||||
if (CheckSavegameVersionOldStyle(6, 1)) UpdateSignOwner();
|
||||
|
||||
/* In old version there seems to be a problem that water is owned by
|
||||
@ -1210,7 +1212,7 @@ bool AfterLoadGame()
|
||||
}
|
||||
}
|
||||
|
||||
// convert road side to my format.
|
||||
/* convert road side to my format. */
|
||||
if (_opt.road_side) _opt.road_side = 1;
|
||||
|
||||
/* Check if all NewGRFs are present, we are very strict in MP mode */
|
||||
@ -1227,7 +1229,7 @@ bool AfterLoadGame()
|
||||
* must be done before loading sprites as some newgrfs check it */
|
||||
SetDate(_date);
|
||||
|
||||
// Load the sprites
|
||||
/* Load the sprites */
|
||||
GfxLoadSprites();
|
||||
LoadStringWidthTable();
|
||||
|
||||
@ -1238,33 +1240,33 @@ bool AfterLoadGame()
|
||||
/* Connect front and rear engines of multiheaded trains */
|
||||
ConnectMultiheadedTrains();
|
||||
|
||||
// reinit the landscape variables (landscape might have changed)
|
||||
/* reinit the landscape variables (landscape might have changed) */
|
||||
InitializeLandscapeVariables(true);
|
||||
|
||||
// Update all vehicles
|
||||
/* Update all vehicles */
|
||||
AfterLoadVehicles();
|
||||
|
||||
// Update all waypoints
|
||||
/* Update all waypoints */
|
||||
if (CheckSavegameVersion(12)) FixOldWaypoints();
|
||||
|
||||
UpdateAllWaypointSigns();
|
||||
|
||||
// in version 2.2 of the savegame, we have new airports
|
||||
/* in version 2.2 of the savegame, we have new airports */
|
||||
if (CheckSavegameVersionOldStyle(2, 2)) UpdateOldAircraft();
|
||||
|
||||
UpdateAllStationVirtCoord();
|
||||
|
||||
// Setup town coords
|
||||
/* Setup town coords */
|
||||
AfterLoadTown();
|
||||
UpdateAllSignVirtCoords();
|
||||
|
||||
// make sure there is a town in the game
|
||||
/* make sure there is a town in the game */
|
||||
if (_game_mode == GM_NORMAL && !ClosestTownFromTile(0, (uint)-1)) {
|
||||
_error_message = STR_NO_TOWN_IN_SCENARIO;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Initialize windows
|
||||
/* Initialize windows */
|
||||
ResetWindowSystem();
|
||||
SetupColorsAndInitialWindow();
|
||||
|
||||
@ -1278,17 +1280,17 @@ bool AfterLoadGame()
|
||||
vp->virtual_width = vp->width << vp->zoom;
|
||||
vp->virtual_height = vp->height << vp->zoom;
|
||||
|
||||
// in version 4.1 of the savegame, is_active was introduced to determine
|
||||
// if a player does exist, rather then checking name_1
|
||||
/* in version 4.1 of the savegame, is_active was introduced to determine
|
||||
* if a player does exist, rather then checking name_1 */
|
||||
if (CheckSavegameVersionOldStyle(4, 1)) CheckIsPlayerActive();
|
||||
|
||||
// the void tiles on the southern border used to belong to a wrong class (pre 4.3).
|
||||
/* the void tiles on the southern border used to belong to a wrong class (pre 4.3). */
|
||||
if (CheckSavegameVersionOldStyle(4, 3)) UpdateVoidTiles();
|
||||
|
||||
// If Load Scenario / New (Scenario) Game is used,
|
||||
// a player does not exist yet. So create one here.
|
||||
// 1 exeption: network-games. Those can have 0 players
|
||||
// But this exeption is not true for network_servers!
|
||||
/* If Load Scenario / New (Scenario) Game is used,
|
||||
* a player does not exist yet. So create one here.
|
||||
* 1 exeption: network-games. Those can have 0 players
|
||||
* But this exeption is not true for network_servers! */
|
||||
if (!_players[0].is_active && (!_networking || (_networking && _network_server)))
|
||||
DoStartupNewPlayer(false);
|
||||
|
||||
@ -1584,15 +1586,15 @@ bool AfterLoadGame()
|
||||
wp->grfid = statspec->grfid;
|
||||
wp->localidx = statspec->localidx;
|
||||
} else {
|
||||
// No custom graphics set, so set to default.
|
||||
/* No custom graphics set, so set to default. */
|
||||
wp->stat_id = 0;
|
||||
wp->grfid = 0;
|
||||
wp->localidx = 0;
|
||||
}
|
||||
|
||||
// Move ground type bits from m2 to m4.
|
||||
/* Move ground type bits from m2 to m4. */
|
||||
_m[wp->xy].m4 = GB(_m[wp->xy].m2, 0, 4);
|
||||
// Store waypoint index in the tile.
|
||||
/* Store waypoint index in the tile. */
|
||||
_m[wp->xy].m2 = wp->index;
|
||||
}
|
||||
}
|
||||
@ -1609,15 +1611,15 @@ bool AfterLoadGame()
|
||||
switch (GetTileType(t)) {
|
||||
case MP_RAILWAY:
|
||||
if (HasSignals(t)) {
|
||||
// convert PBS signals to combo-signals
|
||||
/* convert PBS signals to combo-signals */
|
||||
if (HASBIT(_m[t].m2, 2)) SetSignalType(t, SIGTYPE_COMBO);
|
||||
|
||||
// move the signal variant back
|
||||
/* move the signal variant back */
|
||||
SetSignalVariant(t, HASBIT(_m[t].m2, 3) ? SIG_SEMAPHORE : SIG_ELECTRIC);
|
||||
CLRBIT(_m[t].m2, 3);
|
||||
}
|
||||
|
||||
// Clear PBS reservation on track
|
||||
/* Clear PBS reservation on track */
|
||||
if (!IsTileDepotType(t, TRANSPORT_RAIL)) {
|
||||
SB(_m[t].m4, 4, 4, 0);
|
||||
} else {
|
||||
@ -1625,13 +1627,11 @@ bool AfterLoadGame()
|
||||
}
|
||||
break;
|
||||
|
||||
case MP_STREET:
|
||||
// Clear PBS reservation on crossing
|
||||
case MP_STREET: /* Clear PBS reservation on crossing */
|
||||
if (IsLevelCrossing(t)) CLRBIT(_m[t].m5, 0);
|
||||
break;
|
||||
|
||||
case MP_STATION:
|
||||
// Clear PBS reservation on station
|
||||
case MP_STATION: /* Clear PBS reservation on station */
|
||||
CLRBIT(_m[t].m3, 6);
|
||||
break;
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* $Id$ */
|
||||
|
||||
/** @file order_cmd.cpp */
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "openttd.h"
|
||||
#include "order.h"
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* $Id$ */
|
||||
|
||||
/** @file order_gui.cpp */
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "openttd.h"
|
||||
#include "road_map.h"
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* $Id$ */
|
||||
|
||||
/** @file os2.cpp */
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "openttd.h"
|
||||
#include "variables.h"
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* $Id$ */
|
||||
|
||||
/** @file os_timer.cpp */
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#undef RDTSC_AVAILABLE
|
||||
|
Loading…
Reference in New Issue
Block a user