From a8086958b772e23aee0ab6155e67b8bdb9ff836b Mon Sep 17 00:00:00 2001 From: Loobinex Date: Sun, 13 Oct 2024 20:03:21 +0200 Subject: [PATCH] Fixed RESEARCH script command (#3557) It has been broken for well over a decade, since the function was first rewritten. Fixes #3555 Fixed unrelated function: Fixes #3558 --- src/player_compprocs.c | 1 - src/room_library.c | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/player_compprocs.c b/src/player_compprocs.c index 161ada69f1..29c4c20128 100644 --- a/src/player_compprocs.c +++ b/src/player_compprocs.c @@ -1215,7 +1215,6 @@ static long computer_look_for_opponent(struct Computer2 *comp, MapSubtlCoord stl { set_flag(potential_opponents, to_flag(slab_owner)); current_idx = comp->opponent_relations[slab_owner].next_idx; - slab_owner = slab_owner; pos = &comp->opponent_relations[slab_owner].pos_A[current_idx]; comp->opponent_relations[slab_owner].next_idx = (current_idx + 1) % COMPUTER_SPARK_POSITIONS_COUNT; comp->opponent_relations[slab_owner].field_0 = game.play_gameturn; diff --git a/src/room_library.c b/src/room_library.c index 4bef8005bc..21ba9a50ed 100644 --- a/src/room_library.c +++ b/src/room_library.c @@ -266,6 +266,7 @@ TbBool add_research_to_all_players(long rtyp, long rkind, long amount) TbBool update_players_research_amount(PlayerNumber plyr_idx, long rtyp, long rkind, long amount) { struct Dungeon* dungeon = get_dungeon(plyr_idx); + short n = 0; for (long i = 0; i < dungeon->research_num; i++) { struct ResearchVal* resrch = &dungeon->research[i]; @@ -273,9 +274,11 @@ TbBool update_players_research_amount(PlayerNumber plyr_idx, long rtyp, long rki { resrch->req_amount = amount; } + n++; + } + if (n > 0) return true; - } - return false; + return false; } TbBool update_or_add_players_research_amount(PlayerNumber plyr_idx, long rtyp, long rkind, long amount)