[ioquake3] 02/59: Fix bot team order to kill last player it killed

Simon McVittie smcv at debian.org
Wed Sep 21 19:56:56 UTC 2016


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch debian/master
in repository ioquake3.

commit 4474297af88436d07d348a10dedb8aa65c0d9dbf
Author: Zack Middleton <zturtleman at gmail.com>
Date:   Sun Jul 10 00:36:21 2016 -0500

    Fix bot team order to kill last player it killed
    
    Bot's lastkilledplayer was set to -1 after carrying out an ordered kill.
    Later in BotChat_Random() the PlayerName function was passed -1 which
    caused a "Error: PlayerName: playernum out of range" message.
    
    I think the reason it was set to negative one is so that if the bot is
    ordered to kill the player again, the bot will not say it's done and
    drop the goal. Though, if the bot killed the player based on it's own
    decision, it will just say it's done and drop the goal (bug?).
    
    Let's check the time of the last kill to see if it happened since the
    team order was received instead of setting lastkilledplayer to -1
    after completing the team ordered kill. This fixes bot dropping goal
    if target player was the last player they killed and the PlayerName
    out of range error.
---
 code/game/ai_dmnet.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/code/game/ai_dmnet.c b/code/game/ai_dmnet.c
index 38a84a4..73bc4ca 100644
--- a/code/game/ai_dmnet.c
+++ b/code/game/ai_dmnet.c
@@ -573,11 +573,10 @@ int BotGetLongTermGoal(bot_state_t *bs, int tfl, int retreat, bot_goal_t *goal)
 			bs->teammessage_time = 0;
 		}
 		//
-		if (bs->lastkilledplayer == bs->teamgoal.entitynum) {
+		if (bs->killedenemy_time > bs->teamgoal_time - TEAM_KILL_SOMEONE && bs->lastkilledplayer == bs->teamgoal.entitynum) {
 			EasyClientName(bs->teamgoal.entitynum, buf, sizeof(buf));
 			BotAI_BotInitialChat(bs, "kill_done", buf, NULL);
 			trap_BotEnterChat(bs->cs, bs->decisionmaker, CHAT_TELL);
-			bs->lastkilledplayer = -1;
 			bs->ltgtype = 0;
 		}
 		//

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/ioquake3.git



More information about the Pkg-games-commits mailing list