Mercurial > hg > openttd
changeset 9514:57d15e1530d3 draft
(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.
author | rubidium <rubidium@openttd.org> |
---|---|
date | Fri, 13 Jun 2008 05:50:24 +0000 |
parents | f4833946b217 |
children | bcc765d85155 |
files | src/players.cpp |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/players.cpp +++ b/src/players.cpp @@ -1270,8 +1270,11 @@ _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); + } } }