Merge branch 'master' into jgrpp
Replace build and refit, and group collapse implementations Fix template creation build and refit # Conflicts: # Makefile.bundle.in # config.lib # src/animated_tile.cpp # src/blitter/32bpp_anim.hpp # src/blitter/32bpp_base.hpp # src/blitter/8bpp_base.hpp # src/blitter/null.hpp # src/build_vehicle_gui.cpp # src/command.cpp # src/command_func.h # src/console_gui.cpp # src/core/smallstack_type.hpp # src/date.cpp # src/debug.cpp # src/genworld_gui.cpp # src/ground_vehicle.hpp # src/group_gui.cpp # src/lang/korean.txt # src/linkgraph/linkgraph_gui.h # src/main_gui.cpp # src/misc_gui.cpp # src/network/core/game.h # src/network/core/packet.cpp # src/network/core/udp.cpp # src/network/core/udp.h # src/network/network_content.cpp # src/network/network_type.h # src/network/network_udp.cpp # src/newgrf_house.h # src/openttd.cpp # src/order_cmd.cpp # src/order_gui.cpp # src/os/unix/crashlog_unix.cpp # src/os/windows/crashlog_win.cpp # src/osk_gui.cpp # src/pathfinder/opf/opf_ship.cpp # src/rail_cmd.cpp # src/rail_gui.cpp # src/saveload/saveload.cpp # src/settings.cpp # src/settings_gui.cpp # src/smallmap_gui.h # src/station_base.h # src/station_cmd.cpp # src/table/gameopt_settings.ini # src/table/newgrf_debug_data.h # src/table/settings.ini # src/timetable_gui.cpp # src/toolbar_gui.cpp # src/train_gui.cpp # src/vehicle.cpp # src/vehicle_gui.cpp # src/vehiclelist.cpp # src/viewport.cpp # src/widgets/dropdown.cpp # src/window_gui.h
This commit is contained in:
@@ -202,7 +202,6 @@ static void ShowHelp()
|
||||
" -e = Start Editor\n"
|
||||
" -g [savegame] = Start new/save game immediately\n"
|
||||
" -G seed = Set random seed\n"
|
||||
#if defined(ENABLE_NETWORK)
|
||||
" -n [ip:port#company]= Join network game\n"
|
||||
" -p password = Password to join server\n"
|
||||
" -P password = Password to join company\n"
|
||||
@@ -211,7 +210,6 @@ static void ShowHelp()
|
||||
#if !defined(_WIN32)
|
||||
" -f = Fork into the background (dedicated only)\n"
|
||||
#endif
|
||||
#endif /* ENABLE_NETWORK */
|
||||
" -I graphics_set = Force the graphics set (see below)\n"
|
||||
" -S sounds_set = Force the sounds set (see below)\n"
|
||||
" -M music_set = Force the music set (see below)\n"
|
||||
@@ -351,9 +349,7 @@ static void ShutdownGame()
|
||||
/* Uninitialize variables that are allocated dynamically */
|
||||
GamelogReset();
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
free(_config_file);
|
||||
#endif
|
||||
|
||||
LinkGraphSchedule::Clear();
|
||||
ClearTraceRestrictMapping();
|
||||
@@ -498,7 +494,6 @@ struct AfterNewGRFScan : NewGRFScanCallback {
|
||||
|
||||
Game::Uninitialize(true);
|
||||
AI::Uninitialize(true);
|
||||
CheckConfig();
|
||||
LoadFromHighScore();
|
||||
LoadHotkeysFromConfig();
|
||||
WindowDesc::LoadFromConfig();
|
||||
@@ -512,13 +507,11 @@ struct AfterNewGRFScan : NewGRFScanCallback {
|
||||
if (startyear != INVALID_YEAR) _settings_newgame.game_creation.starting_year = startyear;
|
||||
if (generation_seed != GENERATE_NEW_SEED) _settings_newgame.game_creation.generation_seed = generation_seed;
|
||||
|
||||
#if defined(ENABLE_NETWORK)
|
||||
if (dedicated_host != NULL) {
|
||||
_network_bind_list.Clear();
|
||||
*_network_bind_list.Append() = stredup(dedicated_host);
|
||||
_network_bind_list.push_back(stredup(dedicated_host));
|
||||
}
|
||||
if (dedicated_port != 0) _settings_client.network.server_port = dedicated_port;
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
/* initialize the ingame console */
|
||||
IConsoleInit();
|
||||
@@ -528,7 +521,6 @@ struct AfterNewGRFScan : NewGRFScanCallback {
|
||||
/* Make sure _settings is filled with _settings_newgame if we switch to a game directly */
|
||||
if (_switch_mode != SM_NONE) MakeNewgameSettingsLive();
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
if (_network_available && network_conn != NULL) {
|
||||
const char *port = NULL;
|
||||
const char *company = NULL;
|
||||
@@ -554,7 +546,6 @@ struct AfterNewGRFScan : NewGRFScanCallback {
|
||||
_switch_mode = SM_NONE;
|
||||
NetworkClientConnectGame(NetworkAddress(network_conn, rport), join_as, join_server_password, join_company_password);
|
||||
}
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
/* After the scan we're not used anymore. */
|
||||
delete this;
|
||||
@@ -574,7 +565,6 @@ static const OptionData _options[] = {
|
||||
GETOPT_SHORT_VALUE('s'),
|
||||
GETOPT_SHORT_VALUE('v'),
|
||||
GETOPT_SHORT_VALUE('b'),
|
||||
#if defined(ENABLE_NETWORK)
|
||||
GETOPT_SHORT_OPTVAL('D'),
|
||||
GETOPT_SHORT_OPTVAL('n'),
|
||||
GETOPT_SHORT_VALUE('l'),
|
||||
@@ -583,7 +573,6 @@ static const OptionData _options[] = {
|
||||
#if !defined(_WIN32)
|
||||
GETOPT_SHORT_NOVAL('f'),
|
||||
#endif
|
||||
#endif /* ENABLE_NETWORK */
|
||||
GETOPT_SHORT_VALUE('r'),
|
||||
GETOPT_SHORT_VALUE('t'),
|
||||
GETOPT_SHORT_OPTVAL('d'),
|
||||
@@ -618,13 +607,11 @@ int openttd_main(int argc, char *argv[])
|
||||
/* AfterNewGRFScan sets save_config to true after scanning completed. */
|
||||
bool save_config = false;
|
||||
AfterNewGRFScan *scanner = new AfterNewGRFScan(&save_config);
|
||||
#if defined(ENABLE_NETWORK)
|
||||
bool dedicated = false;
|
||||
char *debuglog_conn = NULL;
|
||||
|
||||
extern bool _dedicated_forks;
|
||||
_dedicated_forks = false;
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
_game_mode = GM_MENU;
|
||||
_switch_mode = SM_MENU;
|
||||
@@ -643,7 +630,6 @@ int openttd_main(int argc, char *argv[])
|
||||
case 's': free(sounddriver); sounddriver = stredup(mgo.opt); break;
|
||||
case 'v': free(videodriver); videodriver = stredup(mgo.opt); break;
|
||||
case 'b': free(blitter); blitter = stredup(mgo.opt); break;
|
||||
#if defined(ENABLE_NETWORK)
|
||||
case 'D':
|
||||
free(musicdriver);
|
||||
free(sounddriver);
|
||||
@@ -678,7 +664,6 @@ int openttd_main(int argc, char *argv[])
|
||||
case 'P':
|
||||
scanner->join_company_password = mgo.opt;
|
||||
break;
|
||||
#endif /* ENABLE_NETWORK */
|
||||
case 'r': ParseResolution(&resolution, mgo.opt); break;
|
||||
case 't': scanner->startyear = atoi(mgo.opt); break;
|
||||
case 'd': {
|
||||
@@ -770,14 +755,12 @@ int openttd_main(int argc, char *argv[])
|
||||
DeterminePaths(argv[0]);
|
||||
TarScanner::DoScan(TarScanner::BASESET);
|
||||
|
||||
#if defined(ENABLE_NETWORK)
|
||||
if (dedicated) DEBUG(net, 0, "Starting dedicated version %s", _openttd_revision);
|
||||
if (_dedicated_forks && !dedicated) _dedicated_forks = false;
|
||||
|
||||
#if defined(UNIX)
|
||||
/* We must fork here, or we'll end up without some resources we need (like sockets) */
|
||||
if (_dedicated_forks) DedicatedFork();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
LoadFromConfig(true);
|
||||
@@ -855,7 +838,6 @@ int openttd_main(int argc, char *argv[])
|
||||
|
||||
NetworkStartUp(); // initialize network-core
|
||||
|
||||
#if defined(ENABLE_NETWORK)
|
||||
if (debuglog_conn != NULL && _network_available) {
|
||||
const char *not_used = NULL;
|
||||
const char *port = NULL;
|
||||
@@ -868,7 +850,6 @@ int openttd_main(int argc, char *argv[])
|
||||
|
||||
NetworkStartDebugLog(NetworkAddress(debuglog_conn, rport));
|
||||
}
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
if (!HandleBootstrap()) {
|
||||
ShutdownGame();
|
||||
@@ -973,12 +954,10 @@ exit_normal:
|
||||
|
||||
delete scanner;
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
extern FILE *_log_fd;
|
||||
if (_log_fd != NULL) {
|
||||
fclose(_log_fd);
|
||||
}
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -1030,13 +1009,11 @@ static void MakeNewGameDone()
|
||||
|
||||
InitializeRailGUI();
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
/* We are the server, we start a new company (not dedicated),
|
||||
* so set the default password *if* needed. */
|
||||
if (_network_server && !StrEmpty(_settings_client.network.default_company_pass)) {
|
||||
NetworkChangeCompanyPassword(_local_company, _settings_client.network.default_company_pass);
|
||||
}
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
if (_settings_client.gui.pause_on_newgame) DoCommandP(0, PM_PAUSED_NORMAL, 1, CMD_PAUSE);
|
||||
|
||||
@@ -1115,7 +1092,6 @@ bool SafeLoad(const char *filename, SaveLoadOperation fop, DetailedFileType dft,
|
||||
case SL_OK: return true;
|
||||
|
||||
case SL_REINIT:
|
||||
#ifdef ENABLE_NETWORK
|
||||
if (_network_dedicated) {
|
||||
/*
|
||||
* We need to reinit a network map...
|
||||
@@ -1131,7 +1107,6 @@ bool SafeLoad(const char *filename, SaveLoadOperation fop, DetailedFileType dft,
|
||||
/* We can't load the intro game as server, so disconnect first. */
|
||||
NetworkDisconnect();
|
||||
}
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
switch (ogm) {
|
||||
default:
|
||||
@@ -1148,7 +1123,6 @@ bool SafeLoad(const char *filename, SaveLoadOperation fop, DetailedFileType dft,
|
||||
|
||||
void SwitchToMode(SwitchMode new_mode)
|
||||
{
|
||||
#ifdef ENABLE_NETWORK
|
||||
/* If we are saving something, the network stays in his current state */
|
||||
if (new_mode != SM_SAVE_GAME) {
|
||||
/* If the network is active, make it not-active */
|
||||
@@ -1177,7 +1151,7 @@ void SwitchToMode(SwitchMode new_mode)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
/* Make sure all AI controllers are gone at quitting game */
|
||||
if (new_mode != SM_SAVE_GAME) AI::KillAll();
|
||||
|
||||
@@ -1188,11 +1162,9 @@ void SwitchToMode(SwitchMode new_mode)
|
||||
|
||||
case SM_RESTARTGAME: // Restart --> 'Random game' with current settings
|
||||
case SM_NEWGAME: // New Game --> 'Random game'
|
||||
#ifdef ENABLE_NETWORK
|
||||
if (_network_server) {
|
||||
seprintf(_network_game_info.map_name, lastof(_network_game_info.map_name), "Random Map");
|
||||
}
|
||||
#endif /* ENABLE_NETWORK */
|
||||
MakeNewGame(false, new_mode == SM_NEWGAME);
|
||||
break;
|
||||
|
||||
@@ -1218,21 +1190,17 @@ void SwitchToMode(SwitchMode new_mode)
|
||||
IConsoleCmdExec("exec scripts/game_start.scr 0");
|
||||
/* Decrease pause counter (was increased from opening load dialog) */
|
||||
DoCommandP(0, PM_PAUSED_SAVELOAD, 0, CMD_PAUSE);
|
||||
#ifdef ENABLE_NETWORK
|
||||
if (_network_server) {
|
||||
seprintf(_network_game_info.map_name, lastof(_network_game_info.map_name), "%s (Loaded game)", _file_to_saveload.title);
|
||||
}
|
||||
#endif /* ENABLE_NETWORK */
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case SM_START_HEIGHTMAP: // Load a heightmap and start a new game from it
|
||||
#ifdef ENABLE_NETWORK
|
||||
if (_network_server) {
|
||||
seprintf(_network_game_info.map_name, lastof(_network_game_info.map_name), "%s (Heightmap)", _file_to_saveload.title);
|
||||
}
|
||||
#endif /* ENABLE_NETWORK */
|
||||
MakeNewGame(true, true);
|
||||
break;
|
||||
|
||||
@@ -1312,10 +1280,10 @@ void CheckCaches(bool force_check)
|
||||
}
|
||||
|
||||
/* Check the town caches. */
|
||||
SmallVector<TownCache, 4> old_town_caches;
|
||||
std::vector<TownCache> old_town_caches;
|
||||
Town *t;
|
||||
FOR_ALL_TOWNS(t) {
|
||||
MemCpyT(old_town_caches.Append(), &t->cache);
|
||||
old_town_caches.push_back(t->cache);
|
||||
}
|
||||
|
||||
extern void RebuildTownCaches();
|
||||
@@ -1324,26 +1292,26 @@ void CheckCaches(bool force_check)
|
||||
|
||||
uint i = 0;
|
||||
FOR_ALL_TOWNS(t) {
|
||||
if (MemCmpT(old_town_caches.Get(i), &t->cache) != 0) {
|
||||
if (MemCmpT(old_town_caches.data() + i, &t->cache) != 0) {
|
||||
DEBUG(desync, 0, "town cache mismatch: town %i", (int)t->index);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
/* Check company infrastructure cache. */
|
||||
SmallVector<CompanyInfrastructure, 4> old_infrastructure;
|
||||
std::vector<CompanyInfrastructure> old_infrastructure;
|
||||
Company *c;
|
||||
FOR_ALL_COMPANIES(c) MemCpyT(old_infrastructure.Append(), &c->infrastructure);
|
||||
FOR_ALL_COMPANIES(c) old_infrastructure.push_back(c->infrastructure);
|
||||
|
||||
extern void AfterLoadCompanyStats();
|
||||
AfterLoadCompanyStats();
|
||||
|
||||
i = 0;
|
||||
FOR_ALL_COMPANIES(c) {
|
||||
if (MemCmpT(old_infrastructure.Get(i), &c->infrastructure) != 0) {
|
||||
if (MemCmpT(old_infrastructure.data() + i, &c->infrastructure) != 0) {
|
||||
DEBUG(desync, 0, "infrastructure cache mismatch: company %i", (int)c->index);
|
||||
char buffer[4096];
|
||||
old_infrastructure.Get(i)->Dump(buffer, lastof(buffer));
|
||||
old_infrastructure[i].Dump(buffer, lastof(buffer));
|
||||
DEBUG(desync, 0, "Previous:\n%s", buffer);
|
||||
c->infrastructure.Dump(buffer, lastof(buffer));
|
||||
DEBUG(desync, 0, "Recalculated:\n%s", buffer);
|
||||
@@ -1649,10 +1617,8 @@ static void DoAutosave()
|
||||
void GameLoop()
|
||||
{
|
||||
if (_game_mode == GM_BOOTSTRAP) {
|
||||
#ifdef ENABLE_NETWORK
|
||||
/* Check for UDP stuff */
|
||||
if (_network_available) NetworkBackgroundLoop();
|
||||
#endif
|
||||
InputLoop();
|
||||
return;
|
||||
}
|
||||
@@ -1675,7 +1641,6 @@ void GameLoop()
|
||||
IncreaseSpriteLRU();
|
||||
InteractiveRandom();
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
/* Check for UDP stuff */
|
||||
if (_network_available) NetworkBackgroundLoop();
|
||||
|
||||
@@ -1691,9 +1656,6 @@ void GameLoop()
|
||||
/* Singleplayer */
|
||||
StateGameLoop();
|
||||
}
|
||||
#else
|
||||
StateGameLoop();
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
if (!_pause_mode && HasBit(_display_opt, DO_FULL_ANIMATION)) DoPaletteAnimations();
|
||||
|
||||
|
Reference in New Issue
Block a user