(svn r12906) -Fix: vehicle groups, engine replacement rules and player/company names were not properly reset/freed after bankrupt (before new player start)

This commit is contained in:
smatz
2008-04-26 14:20:39 +00:00
parent 805e1db332
commit 9e1b8b69e3
2 changed files with 16 additions and 3 deletions

View File

@@ -461,6 +461,8 @@ static Player *AllocatePlayer()
/* Find a free slot */
FOR_ALL_PLAYERS(p) {
if (!p->is_active) {
free(p->name);
free(p->president_name);
PlayerID i = p->index;
memset(p, 0, sizeof(Player));
memset(&_players_ai[i], 0, sizeof(PlayerAI));
@@ -918,9 +920,6 @@ CommandCost CmdPlayerCtrl(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
ChangeOwnershipOfPlayerItems(p->index, PLAYER_SPECTATOR);
p->is_active = false;
}
RemoveAllEngineReplacementForPlayer(p);
RemoveAllGroupsForPlayer(p->index);
} break;
case 3: { /* Merge a company (#1) into another company (#2), elimination company #1 */