r3476 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sun Mar 2 10:01:39 EST 2008


Author: lordhavoc
Date: 2008-03-02 10:01:37 -0500 (Sun, 02 Mar 2008)
New Revision: 3476

Modified:
   trunk/data/qcsrc/server/bots.qc
   trunk/data/qcsrc/server/cl_client.qc
   trunk/data/qcsrc/server/clientcommands.qc
   trunk/data/qcsrc/server/teamplay.qc
Log:
fixed bug with bots not joining the smallest team


Modified: trunk/data/qcsrc/server/bots.qc
===================================================================
--- trunk/data/qcsrc/server/bots.qc	2008-03-02 15:01:24 UTC (rev 3475)
+++ trunk/data/qcsrc/server/bots.qc	2008-03-02 15:01:37 UTC (rev 3476)
@@ -1443,9 +1443,8 @@
 	pants = bound(0, floor(random() * 13), 13);
 	//shirt = bound(0, floor(random() * 16), 15);
 	shirt = pants;
-	self.clientcolors = shirt * 16 + pants;
+	setcolor(self, shirt * 16 + pants);
 	self.bot_preferredcolors = self.clientcolors;
-	self.team = pants + 1;
 
 	// now pick a name...
 
@@ -1898,7 +1897,7 @@
 };
 
 void() havocbot_setupbot;
-float JoinBestTeam(entity pl, float only_return_best);
+float JoinBestTeam(entity pl, float only_return_best, float forcebestteam);
 
 void() bot_clientconnect =
 {
@@ -1909,7 +1908,7 @@
 	self.lag_func = bot_lagfunc;
 	self.isbot = TRUE;
 	self.createdtime = self.nextthink;
-	JoinBestTeam(self, FALSE);
+	JoinBestTeam(self, FALSE, TRUE);
 	havocbot_setupbot();
 	self.bot_mouseskill=random()-0.5;
 	self.bot_thinkskill=random()-0.5;

Modified: trunk/data/qcsrc/server/cl_client.qc
===================================================================
--- trunk/data/qcsrc/server/cl_client.qc	2008-03-02 15:01:24 UTC (rev 3475)
+++ trunk/data/qcsrc/server/cl_client.qc	2008-03-02 15:01:37 UTC (rev 3476)
@@ -692,7 +692,7 @@
 	if(self.killindicator_teamchange == -1)
 	{
 		self.team = -1;
-		JoinBestTeam( self, 0 );
+		JoinBestTeam( self, FALSE, FALSE );
 	}
 	else
 	{
@@ -864,7 +864,7 @@
 	//if(g_domination)
 	//	dom_player_join_team(self);
 
-	//JoinBestTeam(self, FALSE);
+	//JoinBestTeam(self, FALSE, FALSE);
 
 	if((cvar("sv_spectate") == 1 && !g_lms) || cvar("g_campaign")) {
 		self.classname = "observer";
@@ -1434,8 +1434,8 @@
 {
 	if(!cvar("teamplay") || cvar("g_campaign") || cvar("g_balance_teams")) {
 		self.classname = "player";
-		if(cvar("g_campaign") || cvar("g_balance_teams"))
-			JoinBestTeam(self, 0);
+		if(cvar("g_campaign") || cvar("g_balance_teams") || cvar("g_balance_teams_force"))
+			JoinBestTeam(self, FALSE, TRUE);
 		if(cvar("g_campaign"))
 			campaign_bots_may_start = 1;
 		PutClientInServer();

Modified: trunk/data/qcsrc/server/clientcommands.qc
===================================================================
--- trunk/data/qcsrc/server/clientcommands.qc	2008-03-02 15:01:24 UTC (rev 3475)
+++ trunk/data/qcsrc/server/clientcommands.qc	2008-03-02 15:01:37 UTC (rev 3476)
@@ -161,7 +161,7 @@
 			ns = substring(argv(1), 1, 999);
 			t = 2;
 		}
-	
+
 	if(tokens >= 3)
 		if(argv(1) == "#")
 		{
@@ -175,7 +175,7 @@
 		for(i = t; i < tokens; ++i)
 			GetKickVoteVictim_reason = strcat(GetKickVoteVictim_reason, argv(i), " ");
 		GetKickVoteVictim_reason = substring(GetKickVoteVictim_reason, 0, strlen(GetKickVoteVictim_reason) - 1);
-		
+
 		n = stof(ns);
 		if(ns == ftos(n)) if(n >= 1) if(n <= maxclients)
 		{
@@ -426,13 +426,13 @@
 		} else {
 			self.version = stof(argv(1));
 		}
-		if(self.version != cvar("gameversion"))	
+		if(self.version != cvar("gameversion"))
 		{
 			self.classname = "observer";
 			self.frags = -2;
 			PutClientInServer();
-		} else if(cvar("g_campaign") || cvar("g_balance_teams")) {
-			//JoinBestTeam(self, 0);
+		} else if(cvar("g_campaign") || cvar("g_balance_teams") || cvar("g_balance_teams_force")) {
+			//JoinBestTeam(self, FALSE, TRUE);
 		} else if(cvar("teamplay") && !cvar("sv_spectate")) {
 			self.classname = "observer";
 			stuffcmd(self,"menu_showteamselect\n");
@@ -828,7 +828,7 @@
 		return;
 
 	bprint("^1Server is restarting...\n");
-	
+
 	// no arena, assault & onslaught support yet...
 	if(g_arena | g_assault | g_onslaught | gameover | intermission_running)
 		localcmd("restart\n");
@@ -843,7 +843,7 @@
 	}
 
 	reset_map();
-	
+
 	if(cvar("sv_eventlog"))
 		GameLogEcho(":restart", FALSE);
 }

Modified: trunk/data/qcsrc/server/teamplay.qc
===================================================================
--- trunk/data/qcsrc/server/teamplay.qc	2008-03-02 15:01:24 UTC (rev 3475)
+++ trunk/data/qcsrc/server/teamplay.qc	2008-03-02 15:01:37 UTC (rev 3476)
@@ -805,7 +805,7 @@
 	return smallestteam;
 }
 
-float JoinBestTeam(entity pl, float only_return_best)
+float JoinBestTeam(entity pl, float only_return_best, float forcebestteam)
 {
 	float smallest, selectedteam;
 
@@ -826,7 +826,7 @@
 
 	// if we don't care what team he ends up on, put him on whatever team he entered as.
 	// if he's not on a valid team, then let other code put him on the smallest team
-	if(!cvar("g_campaign") && !cvar("g_balance_teams") && !cvar("g_balance_teams_force"))
+	if(!forcebestteam)
 	{
 		if(     c1 >= 0 && pl.team == COLOR_TEAM1)
 			selectedteam = pl.team;




More information about the nexuiz-commits mailing list