summaryrefslogtreecommitdiff
path: root/openttd.c
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2005-08-06 16:07:22 +0000
committerbjarni <bjarni@openttd.org>2005-08-06 16:07:22 +0000
commit9952ff0b597c3e9da0c9105cc6d2ab32e1ac7b8b (patch)
tree4628a0df8999b185f9edb643da5024f1ae22e3bc /openttd.c
parenta1a91eb7f7b9bc356e4a97f76fec2d58a5bf914a (diff)
downloadopenttd-9952ff0b597c3e9da0c9105cc6d2ab32e1ac7b8b.tar.xz
(svn r2817) -Codechange: [autoreplace]: moved autoreplace and autorenew to serverside
-This means that one company can only have one setting for renew and replacing more clients will not fight due to different settings anymore -This is a needed step in the line to fix autoreplacing dualheaded locomotives NOTE: savegame revision bump (peter1138 + me in coop)
Diffstat (limited to 'openttd.c')
-rw-r--r--openttd.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/openttd.c b/openttd.c
index 4388866be..69849c7e6 100644
--- a/openttd.c
+++ b/openttd.c
@@ -579,6 +579,8 @@ static void MakeNewGame(void)
DoStartupNewPlayer(false);
_local_player = 0;
+ _current_player = _local_player;
+ DoCommandP(0, (_patches.autorenew << 15 ) | (_patches.autorenew_months << 16) | 4, _patches.autorenew_money, NULL, CMD_REPLACE_VEHICLE);
}
MarkWholeScreenDirty();
@@ -651,6 +653,8 @@ static void StartScenario(void)
StartupDisasters();
_local_player = 0;
+ _current_player = _local_player;
+ DoCommandP(0, (_patches.autorenew << 15 ) | (_patches.autorenew_months << 16) | 4, _patches.autorenew_money, NULL, CMD_REPLACE_VEHICLE);
MarkWholeScreenDirty();
}
@@ -1242,6 +1246,23 @@ bool AfterLoadGame(uint version)
} END_TILE_LOOP(tile, MapSizeX(), MapSizeY(), 0);
}
+ if (version < 0x1000) {
+ int i;
+ FOR_ALL_PLAYERS(p) {
+ for (i = 0; i < 256; i++) {
+ p->engine_replacement[i] = INVALID_ENGINE;
+ }
+ p->engine_renew = false;
+ p->engine_renew_months = -6;
+ p->engine_renew_money = 100000;
+ }
+ // Set the human controlled player to the patch settings
+ p = GetPlayer(_local_player);
+ p->engine_renew = _patches.autorenew;
+ p->engine_renew_months = _patches.autorenew_months;
+ p->engine_renew_money = _patches.autorenew_money;
+ }
+
FOR_ALL_PLAYERS(p) {
p->avail_railtypes = GetPlayerRailtypes(p->index);
}