From 5b84cfe04f71ff85128508b948a3c9813b442db3 Mon Sep 17 00:00:00 2001 From: andrew Date: Sun, 16 May 2021 17:10:58 +0100 Subject: [PATCH] Avoid re-registering units and cities for each texai player --- ai/tex/texaiworld.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ai/tex/texaiworld.c b/ai/tex/texaiworld.c index c36a9eb6be..8ca62d03c0 100644 --- a/ai/tex/texaiworld.c +++ b/ai/tex/texaiworld.c @@ -181,6 +181,9 @@ void texai_city_info_recv(void *data, enum texaimsgtype msgtype) struct player *pplayer = player_by_number(info->owner); if (msgtype == TEXAI_MSG_CITY_CREATED) { + if (idex_lookup_city(&texai_world, info->id) != NULL) { + return; + } struct tile *ptile = index_to_tile(&(texai_world.map), info->tindex); pcity = create_city_virtual(pplayer, ptile, ""); @@ -288,6 +291,9 @@ void texai_unit_info_recv(void *data, enum texaimsgtype msgtype) struct tile *ptile = index_to_tile(&(texai_world.map), info->tindex); if (msgtype == TEXAI_MSG_UNIT_CREATED) { + if (idex_lookup_unit(&texai_world, info->id) != NULL) { + return; + } struct texai_plr *plr_data = player_ai_data(pplayer, texai_get_self()); punit = unit_virtual_create(pplayer, NULL, type, 0); -- 2.20.1