From 69181e4ff2af247f005cd99f5a5da5d0068a8116 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Mon, 15 May 2023 06:51:13 -0400 Subject: [PATCH] Bots: Fix a couple bugs with item priority - Fix Ring Debt priorities being used even when not at 0 rings - Fix extra item results not being considered for priorities. --- src/k_botitem.c | 9 +++++++++ src/k_roulette.c | 8 +++++--- src/k_roulette.h | 6 +++--- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/k_botitem.c b/src/k_botitem.c index c4ecc4af3..8758db8dc 100644 --- a/src/k_botitem.c +++ b/src/k_botitem.c @@ -1638,6 +1638,15 @@ void K_BotPickItemPriority(player_t *player) continue; } + if (priority == BOT_ITEM_PR_RINGDEBT) + { + if (player->rings > 0) + { + // Only consider this priority when in ring debt. + continue; + } + } + player->botvars.roulettePriority = max( player->botvars.roulettePriority, priority ); } diff --git a/src/k_roulette.c b/src/k_roulette.c index db97e1695..afb9ef519 100644 --- a/src/k_roulette.c +++ b/src/k_roulette.c @@ -263,13 +263,15 @@ boolean K_ItemSingularity(kartitems_t item) } /*-------------------------------------------------- - botItemPriority_e K_GetBotItemPriority(kartitems_t type) + botItemPriority_e K_GetBotItemPriority(kartitems_t result) See header file for description. --------------------------------------------------*/ -botItemPriority_e K_GetBotItemPriority(kartitems_t type) +botItemPriority_e K_GetBotItemPriority(kartitems_t result) { - switch (type) + result = K_ItemResultToType(result); + + switch (result) { case KITEM_SPB: { diff --git a/src/k_roulette.h b/src/k_roulette.h index f31345e8f..61624525d 100644 --- a/src/k_roulette.h +++ b/src/k_roulette.h @@ -58,20 +58,20 @@ boolean K_ItemSingularity(kartitems_t item); /*-------------------------------------------------- - botItemPriority_e K_GetBotItemPriority(kartitems_t type) + botItemPriority_e K_GetBotItemPriority(kartitems_t result) Returns an item's priority value, which bots use to determine what kind of item they want when the roulette is started. Input Arguments:- - item - The item to check. + result - The item result type to check. Return:- The item's priority type. --------------------------------------------------*/ -botItemPriority_e K_GetBotItemPriority(kartitems_t type); +botItemPriority_e K_GetBotItemPriority(kartitems_t result); /*--------------------------------------------------