r2257 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Tue Mar 27 09:40:47 EDT 2007


Author: div0
Date: 2007-03-27 09:40:46 -0400 (Tue, 27 Mar 2007)
New Revision: 2257

Modified:
   trunk/data/qcsrc/server/cl_client.qc
   trunk/data/qcsrc/server/cl_player.qc
   trunk/data/qcsrc/server/clientcommands.qc
   trunk/data/qcsrc/server/ctf.qc
   trunk/data/qcsrc/server/domination.qc
   trunk/data/qcsrc/server/g_world.qc
   trunk/data/qcsrc/server/havocbot_roles.qc
   trunk/data/qcsrc/server/miscfunctions.qc
   trunk/data/qcsrc/server/teamplay.qc
Log:
- in-game voting now nags until you have voted
- map voting now uses finale (needs outstanding DP patch to not flicker)
- FOR_EACH_* loop macros to easier loop over all players


Modified: trunk/data/qcsrc/server/cl_client.qc
===================================================================
--- trunk/data/qcsrc/server/cl_client.qc	2007-03-26 13:38:43 UTC (rev 2256)
+++ trunk/data/qcsrc/server/cl_client.qc	2007-03-27 13:40:46 UTC (rev 2257)
@@ -1343,6 +1343,7 @@
 =============
 */
 void() ctf_setstatus;
+.float vote_nagtime;
 void PlayerPreThink (void)
 {
 	// version nagging
@@ -1359,6 +1360,14 @@
 				self.version_nagtime = 0;
 			}
 
+	// vote nagging
+	if(self.cvar_scr_centertime)
+		if(time > self.vote_nagtime)
+		{
+			VoteNag();
+			self.vote_nagtime = time + self.cvar_scr_centertime * 0.6;
+		}
+
 	if(self.classname == "player") {
 		local vector m1, m2;
 

Modified: trunk/data/qcsrc/server/cl_player.qc
===================================================================
--- trunk/data/qcsrc/server/cl_player.qc	2007-03-26 13:38:43 UTC (rev 2256)
+++ trunk/data/qcsrc/server/cl_player.qc	2007-03-27 13:40:46 UTC (rev 2257)
@@ -455,7 +455,7 @@
 		// 2. if we don't have a cursor trace, find the player which is least
 		//    mis-aimed at
 		entity p;
-		for(p = find(world, classname, "player"); p; p = find(p, classname, "player"))
+		FOR_EACH_PLAYER(p)
 		{
 			float c;
 			c = UpdateSelectedPlayer_canSee(p, selected_score, 100); // 100 = 2.5 meters

Modified: trunk/data/qcsrc/server/clientcommands.qc
===================================================================
--- trunk/data/qcsrc/server/clientcommands.qc	2007-03-26 13:38:43 UTC (rev 2256)
+++ trunk/data/qcsrc/server/clientcommands.qc	2007-03-27 13:40:46 UTC (rev 2257)
@@ -40,44 +40,22 @@
 	else
 		msgstr = strzone(strcat("\{1}^3", source.netname, "^7: ", msgin, "\n"));
 
-	head = find(world, classname, "player");
-	while(head)
+	if(teamsay)
 	{
-		if(clienttype(head) == CLIENTTYPE_REAL)
-			if(!teamsay || (head.team == source.team))
-			{
-				sprint(head, msgstr);
-				if(teamsay)
-					centerprint(head, cmsgstr);
-				//stuffcmd(head, "play2 misc/talk.wav\n");
-			}
-		head = find(head, classname, "player");
-	}
-
-	if(!teamsay)
-	{
-		head = find(world, classname, "observer");
-		while(head)
+		FOR_EACH_REALPLAYER(head)
 		{
-			if(clienttype(head) == CLIENTTYPE_REAL)
+			if(head.team == source.team)
 			{
 				sprint(head, msgstr);
-				//stuffcmd(head, "play2 misc/talk.wav\n");
+				centerprint(head, cmsgstr);
 			}
-			head = find(head, classname, "observer");
 		}
-		head = find(world, classname, "spectator");
-		while(head)
-		{
-			if(clienttype(head) == CLIENTTYPE_REAL)
-			{
-				sprint(head, msgstr);
-				//stuffcmd(head, "play2 misc/talk.wav\n");
-			}
-			head = find(head, classname, "spectator");
-		}
-		ServerConsoleEcho(substring(msgstr, 1, strlen(msgstr) - 2), TRUE);
 	}
+	else
+	{
+		bprint(msgstr);
+		//ServerConsoleEcho(substring(msgstr, 1, strlen(msgstr) - 2), TRUE);
+	}
 
 	strunzone(msgstr);
 }
@@ -461,26 +439,12 @@
 }
 
 void VoteReset() {
-	local string searchclass;
-	searchclass = "player";
+	local entity player;
 
-	while (TRUE)
+	FOR_EACH_CLIENT(player)
 	{
-		local entity player;
-		player = find(player, classname, searchclass);
-		while(player)
-		{
-			player.vote_vote = 0;
-			player = find(player, classname, searchclass);
-		}
-
-		if("player" == searchclass) {
-			searchclass = "observer";
-		} else if("observer" == searchclass) {
-			searchclass = "spectator";
-		} else {
-			break;
-		}
+		player.vote_vote = 0;
+		centerprint_expire(player, CENTERPRIO_VOTE);
 	}
 
 	votecalled = FALSE;
@@ -519,6 +483,12 @@
 	VoteReset();
 }
 
+void VoteNag() {
+	if(votecalled)
+		if(self.vote_vote == 0)
+			centerprint_atprio(self, CENTERPRIO_VOTE, strcat("^7^3", votecaller.netname, "^2 called a vote for:\n^1", votecalledvote, "\n\n^2You have not voted yet!"));
+}
+
 void VoteCount() {
 	local float playercount;
 	playercount = 0;
@@ -526,34 +496,16 @@
 	yescount = 0;
 	local float nocount;
 	nocount = 0;
-	local string searchclass;
-	searchclass = "player";
+	local entity player;
 
-	while (TRUE)
+	FOR_EACH_REALCLIENT(player)
 	{
-		local entity player;
-		player = find(player, classname, searchclass);
-
-		while(player)
-		{
-			if(clienttype(player) != CLIENTTYPE_BOT) {
-				if(player.vote_vote < 0) {
-					nocount++;
-				} else if(player.vote_vote > 0) {
-					yescount++;
-				}
-				playercount++;
-			}
-			player = find(player, classname, searchclass);
+		if(player.vote_vote < 0) {
+			nocount++;
+		} else if(player.vote_vote > 0) {
+			yescount++;
 		}
-
-		if("player" == searchclass) {
-			searchclass = "observer";
-		} else if("observer" == searchclass) {
-			searchclass = "specator";
-		} else {
-			break;
-		}
+		playercount++;
 	}
 
 	if((playercount == 1) && votecalledmaster) {
@@ -581,16 +533,11 @@
 	local entity e;
 	local float r, p;
 
-	e = find(world, classname, "player");
-
-	while(e)
+	FOR_EACH_REALPLAYER(e)
 	{
-		if(clienttype(e) == CLIENTTYPE_REAL)
-		{
-			p += 1;
-			if(e.ready) r += 1;
-		}
-		e = find(e, classname, "player");
+		p += 1;
+		if(e.ready)
+			r += 1;
 	}
 
 	if(p && r == p)

Modified: trunk/data/qcsrc/server/ctf.qc
===================================================================
--- trunk/data/qcsrc/server/ctf.qc	2007-03-26 13:38:43 UTC (rev 2256)
+++ trunk/data/qcsrc/server/ctf.qc	2007-03-27 13:40:46 UTC (rev 2257)
@@ -213,15 +213,13 @@
 		LogCTF("capture", other.flagcarried.team, other);
 		// give credit to the individual player
 		UpdateFrags(other, cvar("g_ctf_flagscore_capture"));
+
 		// give credit to all players of the team (rewards large teams)
 		// NOTE: this defaults to 0
-		head = find(head, classname, "player");
-		while (head)
-		{
+		FOR_EACH_PLAYER(head)
 			if (head.team == self.team)
 				UpdateFrags(head, cvar("g_ctf_flagscore_capture_team"));
-			head = find(head, classname, "player");
-		}
+
 		sound (self, CHAN_AUTO, self.noise2, 1, ATTN_NONE);
 		RegenFlag (other.flagcarried);
 		other.flagcarried = world;
@@ -246,11 +244,9 @@
 		LogCTF("steal", self.team, other);
 		sound (self, CHAN_AUTO, self.noise, 1, ATTN_NONE);
 
-		player = find(world, classname, "player");
-		while(player) {
-			if(player.team == self.team) centerprint(player, "The enemy got your flag! Retrieve it!");
-			player = find(player, classname, "player");
-		}
+		FOR_EACH_PLAYER(player)
+			if(player.team == self.team)
+				centerprint(player, "The enemy got your flag! Retrieve it!");
 
 		self.movetype = MOVETYPE_NONE;
 		setorigin(self, FLAG_CARRY_POS);
@@ -287,11 +283,10 @@
 			LogCTF("pickup", self.team, other);
 			sound (self, CHAN_AUTO, self.noise, 1, ATTN_NONE);
 
-			player = find(world, classname, "player");
-			while(player) {
-				if(player.team == self.team) centerprint(player, "The enemy got your flag! Retrieve it!");
-				player = find(player, classname, "player");
-			}
+			FOR_EACH_PLAYER(player)
+				if(player.team == self.team)
+					centerprint(player, "The enemy got your flag! Retrieve it!");
+
 			self.movetype = MOVETYPE_NONE;	// flag must have MOVETYPE_NONE here, otherwise it will drop through the floor...
 			setorigin(self, FLAG_CARRY_POS);
 			setattachment(self, other, "");

Modified: trunk/data/qcsrc/server/domination.qc
===================================================================
--- trunk/data/qcsrc/server/domination.qc	2007-03-26 13:38:43 UTC (rev 2256)
+++ trunk/data/qcsrc/server/domination.qc	2007-03-27 13:40:46 UTC (rev 2257)
@@ -125,26 +125,18 @@
 	{
 		teamfragamt = cvar("g_domination_point_teamamt");
 
-		head = find(head, classname, "player");
-		while (head)
-		{
+		FOR_EACH_PLAYER(head)
 			if (head.team == self.goalentity.team)
 				UpdateFrags(head, teamfragamt);
-			head = find(head, classname, "player");
-		}
 	}
 
 	// if the player left the game, changed teams or became spectator, we have to find another player on the same team to give credit to
 	if (!self.enemy.flags || self.enemy.team != self.goalentity.team || self.enemy.killcount == -666) // flags is zero on removed clients
 	{
 		other = self.enemy;
-		head = find(head, classname, "player");
-		while (head)
-		{
+		FOR_EACH_PLAYER(head)
 			if (head.team == self.goalentity.team)
 				self.enemy = head;
-			head = find(head, classname, "player");
-		}
 		if(self.enemy == other) // search returned no matching player, reset dom point
 		{
 			dom_controlpoint_setup();

Modified: trunk/data/qcsrc/server/g_world.qc
===================================================================
--- trunk/data/qcsrc/server/g_world.qc	2007-03-26 13:38:43 UTC (rev 2256)
+++ trunk/data/qcsrc/server/g_world.qc	2007-03-27 13:40:46 UTC (rev 2257)
@@ -907,8 +907,7 @@
 		fputs(file, strcat(s, "\n"));
 	}
 
-	other = findchainflags(flags, FL_CLIENT);
-	while (other)
+	FOR_EACH_CLIENT(other)
 	{
 		if ((clienttype(other) == CLIENTTYPE_REAL) || (clienttype(other) == CLIENTTYPE_BOT && cvar("sv_logscores_bots")))
 		{
@@ -924,7 +923,6 @@
 			else if(cvar("sv_logscores_console"))
 				ServerConsoleEcho(strcat(s, other.netname), TRUE);
 		}
-		other = other.chain;
 	}
 
 	if(cvar("sv_eventlog") && gameover)
@@ -944,18 +942,23 @@
 	{
 		e.angles = e.v_angle;
 		e.autoscreenshot = time + 0.8;	// used for autoscreenshot
-		e.armorvalue = 0;
-		e.health = -42; // show scoreboard
+		e.health = -2342;
+		// first intermission phase; voting phase has positive health (used to decide whether to send SVC_FINALE or not)
 		e.solid = SOLID_NOT;
 		e.movetype = MOVETYPE_NONE;
 		e.takedamage = DAMAGE_NO;
 		if(e.weaponentity)
 			e.weaponentity.effects = EF_NODRAW;
-		stuffcmd(e, "\ncl_gravity 0\ncl_movement_maxspeed 0\ncl_movement_jumpvelocity 0\ncl_movement_maxairspeed 0\n");
+		stuffcmd(e, "\nscr_printspeed 1000000\n");
+		if(clienttype(e) == CLIENTTYPE_REAL)
+		{
+			msg_entity = e;
+			WriteByte(MSG_ONE, SVC_INTERMISSION);
+		}
 	}
 
-	e.velocity = '0 0 0';
-	e.fixangle = TRUE; // (e.health <= 0);
+	//e.velocity = '0 0 0';
+	//e.fixangle = TRUE;
 
 	// TODO halt weapon animation
 }
@@ -998,7 +1001,7 @@
 	GameLogClose();
 
 	maxTotalFrags = 0;
-	for(other = world; (other = findflags(other, flags, FL_CLIENT)); )
+	FOR_EACH_CLIENT(other)
 	{
 		if(maxTotalFrags < other.totalfrags)
 			maxTotalFrags = other.totalfrags;
@@ -1006,7 +1009,7 @@
 			minTotalFrags = other.totalfrags;
 	}
 
-	for(other = world; (other = findflags(other, flags, FL_CLIENT)); )
+	FOR_EACH_CLIENT(other)
 	{
 		FixIntermissionClient(other);
 
@@ -1085,37 +1088,25 @@
 void(.float field, float value) SetWinners =
 {
 	entity head;
-	head = findchain(classname, "player");
-	while (head)
-	{
+	FOR_EACH_PLAYER(head)
 		head.winning = (head.field == value);
-		head = head.chain;
-	}
 }
 
 // set the .winning flag for those players with a given field value
 void(.float field, float value) AddWinners =
 {
 	entity head;
-	head = findchain(classname, "player");
-	while (head)
-	{
+	FOR_EACH_PLAYER(head)
 		if(head.field == value)
 			head.winning = 1;
-		head = head.chain;
-	}
 }
 
 // clear the .winning flags
 void(void) ClearWinners =
 {
 	entity head;
-	head = findchain(classname, "player");
-	while (head)
-	{
+	FOR_EACH_PLAYER(head)
 		head.winning = 0;
-		head = head.chain;
-	}
 }
 
 float() LMS_NewPlayerLives =
@@ -1201,9 +1192,8 @@
 	// check if the top two players have equal score.
 
 	checkrules_leaderfrags = 0;
-	head = findchain(classname, "player");
 	checkrules_equality = FALSE;
-	while (head)
+	FOR_EACH_PLAYER(head)
 	{
 		if(head.frags > checkrules_leaderfrags)
 		{
@@ -1212,7 +1202,6 @@
 		}
 		else if(head.frags > 0 && head.frags == checkrules_leaderfrags)
 			checkrules_equality = TRUE;
-		head = head.chain;
 	}
 
 	SetWinners(frags, checkrules_leaderfrags);
@@ -1237,9 +1226,8 @@
 
 	checkrules_oldleaderfrags = checkrules_leaderfrags;
 	checkrules_leaderfrags = 0;
-	head = findchain(classname, "player");
 	checkrules_equality = FALSE;
-	while (head)
+	FOR_EACH_PLAYER(head)
 	{
 		if(head.frags > checkrules_leaderfrags)
 		{
@@ -1248,7 +1236,6 @@
 		}
 		else if(head.frags > 0 && head.frags == checkrules_leaderfrags)
 			checkrules_equality = TRUE;
-		head = head.chain;
 	}
 
 	if(checkrules_leaderfrags > 0)
@@ -1322,8 +1309,7 @@
 
 	team1_score = team2_score = team3_score = team4_score = 0;
 
-	head = findchain(classname, "player");
-	while (head)
+	FOR_EACH_PLAYER(head)
 	{
 		if(head.team == COLOR_TEAM1)
 			team1_score += head.frags;
@@ -1333,7 +1319,6 @@
 			team3_score += head.frags;
 		else if(head.team == COLOR_TEAM4)
 			team4_score += head.frags;
-		head = head.chain;
 	}
 
 	return WinningConditionBase_Teamplay(fraglimit);
@@ -1348,8 +1333,7 @@
 
 	team1_score = team2_score = team3_score = team4_score = 0;
 
-	head = findchain(classname, "player");
-	while (head)
+	FOR_EACH_PLAYER(head)
 	{
 		if(head.team == COLOR_TEAM1)
 		{
@@ -1371,7 +1355,6 @@
 			if(head.frags > team4_score)
 				team4_score = head.frags;
 		}
-		head = head.chain;
 	}
 
 	return WinningConditionBase_Teamplay(fraglimit);
@@ -1394,9 +1377,8 @@
 	string s;
 	float found;
 	found = FALSE;
-	head = find(world, classname, "player");
 	teamvalue = 0;
-	while(head)
+	FOR_EACH_PLAYER(head)
 	{
 		if(!whichteam || head.team == whichteam)
 		{
@@ -1417,7 +1399,6 @@
 			s = strcat(s, " / ", ftos(v));
 			print_to(e, strcat("  ", colorcode, head.netname, colorcode, " (", s, ")"));
 		}
-		head = find(head, classname, "player");
 	}
 	if(whichteam && found)
 	{
@@ -1750,7 +1731,7 @@
 
 void MapVote_ClearAllVotes()
 {
-	for(other = world; (other = findflags(other, flags, FL_CLIENT)); )
+	FOR_EACH_CLIENT(other)
 		other.mapvote = 0;
 }
 
@@ -1855,7 +1836,7 @@
 	if(mapvote_maps_suggested[mappos])
 		GameLogEcho(strcat(":vote:suggestion_accepted:", mapvote_maps[mappos]), FALSE);
 
-	for(other = world; (other = findflags(other, flags, FL_CLIENT)); ) if(clienttype(other) == CLIENTTYPE_REAL)
+	FOR_EACH_REALCLIENT(other)
 		FixClientCvars(other);
 
 	Map_Goto_SetStr(mapvote_maps[mappos]);
@@ -1873,7 +1854,7 @@
 	}
 
 	mapvote_voters = 0;
-	for(other = world; (other = findflags(other, flags, FL_CLIENT)); ) if(clienttype(other) == CLIENTTYPE_REAL)
+	FOR_EACH_REALCLIENT(other)
 	{
 		++mapvote_voters;
 		if(other.mapvote)
@@ -1951,13 +1932,19 @@
 	if(MapVote_CheckRules_2()) // decide
 		return;
 
-	for(other = world; (other = findflags(other, flags, FL_CLIENT)); ) if(clienttype(other) == CLIENTTYPE_REAL)
+	FOR_EACH_REALCLIENT(other)
 	{
 		// hide scoreboard again
 		if(other.health != 2342)
 		{
-			stuffcmd(other, "\nin_bind 7 1 \"impulse 1\"; in_bind 7 2 \"impulse 2\"; in_bind 7 3 \"impulse 3\"; in_bind 7 4 \"impulse 4\"; in_bind 7 5 \"impulse 5\"; in_bind 7 6 \"impulse 6\"; in_bind 7 7 \"impulse 7\"; in_bind 7 8 \"impulse 8\"; in_bind 7 9 \"impulse 9\"; in_bind 7 0 \"impulse 10\"; in_bind 7 KP_1 \"impulse 1\"; in_bind 7 KP_2 \"impulse 2\"; in_bind 7 KP_3 \"impulse 3\"; in_bind 7 KP_4 \"impulse 4\"; in_bind 7 KP_5 \"impulse 5\"; in_bind 7 KP_6 \"impulse 6\"; in_bind 7 KP_7 \"impulse 7\"; in_bind 7 KP_8 \"impulse 8\"; in_bind 7 KP_9 \"impulse 9\"; in_bind 7 KP_0 \"impulse 10\"; in_bindmap 7 0\n");
 			other.health = 2342;
+			if(clienttype(other) == CLIENTTYPE_REAL)
+			{
+				stuffcmd(other, "\nin_bind 7 1 \"impulse 1\"; in_bind 7 2 \"impulse 2\"; in_bind 7 3 \"impulse 3\"; in_bind 7 4 \"impulse 4\"; in_bind 7 5 \"impulse 5\"; in_bind 7 6 \"impulse 6\"; in_bind 7 7 \"impulse 7\"; in_bind 7 8 \"impulse 8\"; in_bind 7 9 \"impulse 9\"; in_bind 7 0 \"impulse 10\"; in_bind 7 KP_1 \"impulse 1\"; in_bind 7 KP_2 \"impulse 2\"; in_bind 7 KP_3 \"impulse 3\"; in_bind 7 KP_4 \"impulse 4\"; in_bind 7 KP_5 \"impulse 5\"; in_bind 7 KP_6 \"impulse 6\"; in_bind 7 KP_7 \"impulse 7\"; in_bind 7 KP_8 \"impulse 8\"; in_bind 7 KP_9 \"impulse 9\"; in_bind 7 KP_0 \"impulse 10\"; in_bindmap 7 0\n");
+				msg_entity = other;
+				WriteByte(MSG_ONE, SVC_FINALE);
+				WriteString(MSG_ONE, "");
+			}
 		}
 
 		// notify about keep-two
@@ -1976,7 +1963,7 @@
 
 	MapVote_CheckRules_1(); // just count
 
-	for(other = world; (other = findflags(other, flags, FL_CLIENT)); ) if(clienttype(other) == CLIENTTYPE_REAL)
+	FOR_EACH_REALCLIENT(other)
 	{
 		// display voting screen
 		msgstr = "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
@@ -2007,7 +1994,7 @@
 			msgstr = strcat(msgstr, "s");
 		msgstr = strcat(msgstr, " left");
 
-		centerprint(other, msgstr);
+		centerprint_atprio(other, CENTERPRIO_MAPVOTE, msgstr);
 	}
 }
 void MapVote_Think()

Modified: trunk/data/qcsrc/server/havocbot_roles.qc
===================================================================
--- trunk/data/qcsrc/server/havocbot_roles.qc	2007-03-26 13:38:43 UTC (rev 2256)
+++ trunk/data/qcsrc/server/havocbot_roles.qc	2007-03-27 13:40:46 UTC (rev 2257)
@@ -73,8 +73,7 @@
 	//dprint(ftos(self.team)); dprint(" -> noteam is "); dprint(ftos(noteam));
 	//dprint("\n");
 
-	head = findchain(classname, "player");
-	while (head)
+	FOR_EACH_PLAYER(head)
 	{
 		if (self != head)
 		if (head.health > 0)
@@ -91,7 +90,6 @@
 				navigation_routerating(head, t * ratingscale);
 			}
 		}
-		head = head.chain;
 	}
 };
 

Modified: trunk/data/qcsrc/server/miscfunctions.qc
===================================================================
--- trunk/data/qcsrc/server/miscfunctions.qc	2007-03-26 13:38:43 UTC (rev 2256)
+++ trunk/data/qcsrc/server/miscfunctions.qc	2007-03-27 13:40:46 UTC (rev 2257)
@@ -1,3 +1,9 @@
+#define FOR_EACH_CLIENT(v) for(v = world; (v = findflags(v, flags, FL_CLIENT)) != world; )
+#define FOR_EACH_REALCLIENT(v) FOR_EACH_CLIENT(v) if(clienttype(v) == CLIENTTYPE_REAL)
+string STR_PLAYER = "player";
+#define FOR_EACH_PLAYER(v) for(v = world; (v = find(v, classname, STR_PLAYER)) != world; )
+#define FOR_EACH_REALPLAYER(v) FOR_EACH_PLAYER(v) if(clienttype(v) == CLIENTTYPE_REAL)
+
 float logfile_open;
 float logfile;
 
@@ -3,12 +9,9 @@
 void(string s) bcenterprint
 {
+	// TODO replace by MSG_ALL (would show it to spectators too, though)?
 	entity head;
-	head = find(world, classname, "player");
-	while(head)
-	{
+	FOR_EACH_PLAYER(head)
 		if(clienttype(head) == CLIENTTYPE_REAL)
 			centerprint(head, s);
-		head = find(head, classname, "player");
-	}
 }
 
@@ -404,21 +407,15 @@
 	p.frags = p.frags - f;
 
 	nTeam = 0;
-	head = find(world, classname, "player");
-	while(head)
-	{
+	FOR_EACH_PLAYER(head)
 		if(head != p)
 			if(head.team == targetteam)
 				nTeam = nTeam + 1;
-		head = find(head, classname, "player");
-	}
 
 	if(nTeam == 0)
 		return;
 
-	head = find(world, classname, "player");
-	while(head)
-	{
+	FOR_EACH_PLAYER(head)
 		if(head != p)
 			if(head.team == targetteam)
 			{
@@ -427,8 +424,6 @@
 				f = f - d;
 				nTeam = nTeam - 1;
 			}
-		head = find(head, classname, "player");
-	}
 
 	if(nTeam != 0)
 		error("nPlayers in team changed!");
@@ -503,11 +498,16 @@
 }
 
 #define CENTERPRIO_POINT 1
+#define CENTERPRIO_VOTE 4
 #define CENTERPRIO_NORMAL 5
+#define CENTERPRIO_MAPVOTE 9
 .float centerprint_priority;
 .float centerprint_expires;
 void centerprint_atprio(entity e, float prio, string s)
 {
+	if(intermission_running)
+		if(prio < CENTERPRIO_MAPVOTE)
+			return;
 	if(time > e.centerprint_expires)
 		e.centerprint_priority = 0;
 	if(prio >= e.centerprint_priority)
@@ -529,3 +529,5 @@
 {
 	centerprint_atprio(e, CENTERPRIO_NORMAL, s);
 }
+
+void VoteNag();

Modified: trunk/data/qcsrc/server/teamplay.qc
===================================================================
--- trunk/data/qcsrc/server/teamplay.qc	2007-03-26 13:38:43 UTC (rev 2256)
+++ trunk/data/qcsrc/server/teamplay.qc	2007-03-27 13:40:46 UTC (rev 2257)
@@ -565,8 +565,7 @@
 	// FIXME: also find and memorize the lowest-scoring bot on each team (in case players must be shuffled around)
 	// also remember the lowest-scoring player
 
-	head = find(world, classname, "player");
-	while(head)
+	FOR_EACH_PLAYER(head)
 	{
 		if(head != ignore)// && head.netname != "")
 		{
@@ -604,7 +603,6 @@
 				}
 			}
 		}
-		head = find(head, classname, "player");
 	}
 }
 
@@ -995,8 +993,7 @@
 	lowest_player_score = 999999999;
 
 	// find the lowest-scoring player & bot of that team
-	head = find(world, classname, "player");
-	while(head)
+	FOR_EACH_PLAYER(head)
 	{
 		if(head.team == steam)
 		{
@@ -1017,7 +1014,6 @@
 				}
 			}
 		}
-		head = find(head, classname, "player");
 	}
 
 	// prefers to move a bot...




More information about the nexuiz-commits mailing list