diff options
author | rubidium <rubidium@openttd.org> | 2008-06-13 05:50:24 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-06-13 05:50:24 +0000 |
commit | f2404ac20f63b26d16203c2e2a26a143d0782495 (patch) | |
tree | 89e59834bed4428388f4a4365af4682031c3324a | |
parent | 5d828d8eee1a2cfcaf209b938b1845b42f11691e (diff) | |
download | openttd-f2404ac20f63b26d16203c2e2a26a143d0782495.tar.xz |
(svn r13505) -Fix: clear the memory for the new AI during the loading of a savegame so it does not try to execute commands generated in a different savegame, which could be resulting in the AI trying to give orders to stations that do not exist.
-rw-r--r-- | src/players.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/players.cpp b/src/players.cpp index 66338609d..a024cd47a 100644 --- a/src/players.cpp +++ b/src/players.cpp @@ -1270,8 +1270,11 @@ static void Load_PLYR() _player_colors[index] = p->player_color; /* This is needed so an AI is attached to a loaded AI */ - if (p->is_ai && (!_networking || _network_server) && _ai.enabled) + if (p->is_ai && (!_networking || _network_server) && _ai.enabled) { + /* Clear the memory of the new AI, otherwise we might be doing wrong things. */ + memset(&_players_ainew[index], 0, sizeof(PlayerAiNew)); AI_StartNewAI(p->index); + } } } |