From e53f26f3ebf2ae34b685104237224dc4f8bac0fa Mon Sep 17 00:00:00 2001 From: fgsfds Date: Mon, 15 Jan 2024 09:45:56 +0100 Subject: [PATCH] port: fix #347 patch submitted by Ryan Dwyer The patch allows all humans/bots to be selected regardless of team. It also adds a check to make sure a bot is not given a command to attack itself. --- src/game/activemenu.c | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/src/game/activemenu.c b/src/game/activemenu.c index bba991a14..bc984de99 100644 --- a/src/game/activemenu.c +++ b/src/game/activemenu.c @@ -90,19 +90,8 @@ MenuItemHandlerResult amPickTargetMenuList(s32 operation, struct menuitem *item, switch (operation) { case MENUOP_GETOPTIONCOUNT: if (g_AmMenus[g_AmIndex].prevallbots) { - // All bots: num bot opponents + all human players - s32 count = 0; - s32 i; - struct chrdata *playerchr = g_Vars.currentplayer->prop->chr; - - for (i = PLAYERCOUNT(); i < g_MpNumChrs; i++) { - if (g_MpAllChrPtrs[i]->team != playerchr->team) { - count++; - } - } - - count += PLAYERCOUNT(); - data->list.value = count; + // All bots + data->list.value = g_MpNumChrs; } else { // Single bot: All except the bot itself data->list.value = g_MpNumChrs - 1; @@ -125,9 +114,7 @@ MenuItemHandlerResult amPickTargetMenuList(s32 operation, struct menuitem *item, chrindex++; if (g_AmMenus[g_AmIndex].prevallbots) { - if (playerchr == g_MpAllChrPtrs[chrindex] || playerchr->team != g_MpAllChrPtrs[chrindex]->team) { - numremaining--; - } + numremaining--; } else { if (botchr != g_MpAllChrPtrs[chrindex]) { numremaining--; @@ -139,7 +126,9 @@ MenuItemHandlerResult amPickTargetMenuList(s32 operation, struct menuitem *item, g_AmMenus[g_AmIndex].prevallbots = false; for (i = 0; i < g_Vars.currentplayer->numaibuddies; i++) { - botApplyAttack(g_MpAllChrPtrs[g_Vars.currentplayer->aibuddynums[i]], g_MpAllChrPtrs[chrindex]->prop); + if (g_Vars.currentplayer->aibuddynums[i] != chrindex) { + botApplyAttack(g_MpAllChrPtrs[g_Vars.currentplayer->aibuddynums[i]], g_MpAllChrPtrs[chrindex]->prop); + } } } else { botApplyAttack(botchr, g_MpAllChrPtrs[chrindex]->prop); @@ -167,9 +156,7 @@ MenuItemHandlerResult amPickTargetMenuList(s32 operation, struct menuitem *item, chrindex++; if (g_AmMenus[g_AmIndex].prevallbots) { - if (playerchr == g_MpAllChrPtrs[chrindex] || playerchr->team != g_MpAllChrPtrs[chrindex]->team) { - numremaining--; - } + numremaining--; } else { if (botchr != g_MpAllChrPtrs[chrindex]) { numremaining--;