]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/bot/bot.qc
Merge remote-tracking branch 'origin/Mario/arena_nuke'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / bot / bot.qc
index bdcfe864e4e43666a60901933d549893f513a543..b93d87ad29f229736686045c546f26d0af1101a6 100644 (file)
@@ -32,7 +32,7 @@ void bot_think()
        if (self.bot_nextthink > time)
                return;
 
-       self.flags &~= FL_GODMODE;
+       self.flags &= ~FL_GODMODE;
        if(autocvar_bot_god)
                self.flags |= FL_GODMODE;
 
@@ -45,7 +45,7 @@ void bot_think()
 
        if (autocvar_g_campaign && !campaign_bots_may_start)
        {
-               self.nextthink = time + 0.5;
+               self.bot_nextthink = time + 0.5;
                return;
        }
 
@@ -85,7 +85,7 @@ void bot_think()
        {
                // block the bot during the countdown to game start
                self.movement = '0 0 0';
-               self.nextthink = game_starttime;
+               self.bot_nextthink = game_starttime;
                return;
        }
 
@@ -135,21 +135,20 @@ void bot_setnameandstuff()
        else
        {
                RandomSelection_Init();
-               for(;;)
+               while((readfile = fgets(file)))
                {
-                       readfile = fgets(file);
-                       if(!readfile)
-                               break;
                        if(substring(readfile, 0, 2) == "//")
                                continue;
                        if(substring(readfile, 0, 1) == "#")
                                continue;
                        tokens = tokenizebyseparator(readfile, "\t");
+                       if(tokens == 0)
+                               continue;
                        s = argv(0);
                        prio = 1;
                        FOR_EACH_CLIENT(p)
                        {
-                               if(clienttype(p) == CLIENTTYPE_BOT)
+                               if(IS_BOT_CLIENT(p))
                                if(s == p.cleanname)
                                {
                                        prio = 0;
@@ -219,7 +218,7 @@ void bot_setnameandstuff()
        i = 0;
        FOR_EACH_CLIENT(p)
        {
-               if(clienttype(p) == CLIENTTYPE_BOT)
+               if(IS_BOT_CLIENT(p))
                        if(p.cleanname == name)
                                ++i;
        }
@@ -343,7 +342,7 @@ void bot_relinkplayerlist()
        {
                player_count = player_count + 1;
                e.nextplayer = e.chain;
-               if (clienttype(e) == CLIENTTYPE_BOT)
+               if (IS_BOT_CLIENT(e))
                {
                        if (prevbot)
                                prevbot.nextbot = e;
@@ -364,7 +363,7 @@ void bot_relinkplayerlist()
 
 void bot_clientdisconnect()
 {
-       if (clienttype(self) != CLIENTTYPE_BOT)
+       if (!IS_BOT_CLIENT(self))
                return;
        bot_clearqueue(self);
        if(self.cleanname)
@@ -387,25 +386,25 @@ void bot_clientdisconnect()
 
 void bot_clientconnect()
 {
-       if (clienttype(self) != CLIENTTYPE_BOT)
+       if (!IS_BOT_CLIENT(self))
                return;
        self.bot_preferredcolors = self.clientcolors;
        self.bot_nextthink = time - random();
        self.lag_func = bot_lagfunc;
        self.isbot = TRUE;
-       self.createdtime = self.nextthink;
+       self.createdtime = self.bot_nextthink;
 
        if(!self.bot_config_loaded) // This is needed so team overrider doesn't break between matches
                bot_setnameandstuff();
 
        if(self.bot_forced_team==1)
-               self.team = FL_TEAM_1;
+               self.team = NUM_TEAM_1;
        else if(self.bot_forced_team==2)
-               self.team = FL_TEAM_2;
+               self.team = NUM_TEAM_2;
        else if(self.bot_forced_team==3)
-               self.team = FL_TEAM_3;
+               self.team = NUM_TEAM_3;
        else if(self.bot_forced_team==4)
-               self.team = FL_TEAM_4;
+               self.team = NUM_TEAM_4;
        else
                JoinBestTeam(self, FALSE, TRUE);
 
@@ -426,13 +425,13 @@ void bot_removefromlargestteam()
        bestcount = 0;
        while (head)
        {
-               if(head.team == FL_TEAM_1)
+               if(head.team == NUM_TEAM_1)
                        thiscount = c1;
-               else if(head.team == FL_TEAM_2)
+               else if(head.team == NUM_TEAM_2)
                        thiscount = c2;
-               else if(head.team == FL_TEAM_3)
+               else if(head.team == NUM_TEAM_3)
                        thiscount = c3;
-               else if(head.team == FL_TEAM_4)
+               else if(head.team == NUM_TEAM_4)
                        thiscount = c4;
                else
                        thiscount = 0;
@@ -492,7 +491,7 @@ void autoskill(float factor)
        bestplayer = -1;
        FOR_EACH_PLAYER(head)
        {
-               if(clienttype(head) == CLIENTTYPE_REAL)
+               if(IS_REAL_CLIENT(head))
                        bestplayer = max(bestplayer, head.totalfrags - head.totalfrags_lastcheck);
                else
                        bestbot = max(bestbot, head.totalfrags - head.totalfrags_lastcheck);
@@ -552,7 +551,7 @@ float bot_fixcount()
 
        FOR_EACH_REALCLIENT(head)
        {
-               if(head.classname == "player" || g_lms || g_arena || g_ca)
+               if(IS_PLAYER(head) || g_lms || head.caplayer == 1)
                        ++activerealplayers;
                ++realplayers;
        }