(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)
This commit is contained in:
bjarni
2005-08-06 16:07:22 +00:00
parent ddb58492f3
commit ed8e2bac04
14 changed files with 234 additions and 75 deletions

View File

@@ -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);
}