From: terencehill <piuntn@gmail.com>
Date: Sun, 19 Jun 2011 16:14:51 +0000 (+0200)
Subject: Get rid of the function getTimeoutText and use directly the timeout strings instead
X-Git-Tag: xonotic-v0.5.0~204
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=31a6820253244d6a4b374d377f1b5e5ea89a4db9;p=xonotic%2Fxonotic-data.pk3dir.git

Get rid of the function getTimeoutText and use directly the timeout strings instead
---

diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc
index 49a050f64..e79a85f8a 100644
--- a/qcsrc/server/cl_client.qc
+++ b/qcsrc/server/cl_client.qc
@@ -1977,47 +1977,6 @@ void play_countdown(float finished, string samp)
 				sound (self, CHAN_AUTO, samp, VOL_BASE, ATTN_NORM);
 }
 
-/**
- * When sv_timeout is used this function returs strings like
- * "Timeout begins in 2 seconds!\n" or "Timeout ends in 23 seconds!\n".
- * Called by centerprint functions
- * @param addOneSecond boolean, set to 1 if the welcome-message centerprint asks for the text
- */
-string getTimeoutText(float addOneSecond) {
-	if (!autocvar_sv_timeout || !timeoutStatus)
-		return "";
-
-	local string retStr;
-	if (timeoutStatus == 1) {
-		if (addOneSecond == 1) {
-			retStr = strcat("Timeout begins in ", ftos(remainingLeadTime + 1), " seconds!\n");
-		}
-		else {
-			retStr = strcat("Timeout begins in ", ftos(remainingLeadTime), " seconds!\n");
-		}
-		return retStr;
-	}
-	else if (timeoutStatus == 2) {
-		if (addOneSecond) {
-			retStr = strcat("Timeout ends in ", ftos(remainingTimeoutTime + 1), " seconds!\n");
-			//don't show messages like "Timeout ends in 0 seconds"...
-			if ((remainingTimeoutTime + 1) > 0)
-				return retStr;
-			else
-				return "";
-		}
-		else {
-			retStr = strcat("Timeout ends in ", ftos(remainingTimeoutTime), " seconds!\n");
-			//don't show messages like "Timeout ends in 0 seconds"...
-			if ((remainingTimeoutTime) > 0)
-				return retStr;
-			else
-				return "";
-		}
-	}
-	else return "";
-}
-
 void player_powerups (void)
 {
 	// add a way to see what the items were BEFORE all of these checks for the mutator hook
diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh
index 8473414d2..1eb9e7007 100644
--- a/qcsrc/server/defs.qh
+++ b/qcsrc/server/defs.qh
@@ -286,7 +286,6 @@ entity timeoutHandler; //responsible for centerprinting the timeout countdowns a
 void timeoutHandler_Think();
 void evaluateTimeout();
 void evaluateTimein();
-string getTimeoutText(float addOneSecond);
 
 .float spawnshieldtime;
 
diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc
index 6bf881935..cbe65b610 100644
--- a/qcsrc/server/g_world.qc
+++ b/qcsrc/server/g_world.qc
@@ -101,17 +101,15 @@ void fteqcc_testbugs()
  * players. Also plays reminder sounds.
  */
 void timeoutHandler_Think() {
-	local string timeStr;
 	local entity plr;
 	// NOTE: the below Send_CSQC_Centerprint_Generic send msgs with countdown_num
 	// parameter set as 0, even if the msgs are part of a countdown
 	if (timeoutStatus == 1) {
 		if (remainingLeadTime > 0) {
 			//centerprint the information to every player
-			timeStr = getTimeoutText(0);
 			FOR_EACH_REALCLIENT(plr) {
 				if(plr.classname == "player") {
-					Send_CSQC_Centerprint_Generic(plr, CPID_TIMEOUT_COUNTDOWN, timeStr, 1, 0);
+					Send_CSQC_Centerprint_Generic(plr, CPID_TIMEOUT_COUNTDOWN, "Timeout begins in %d seconds!", 1, remainingLeadTime);
 				}
 			}
 			remainingLeadTime -= 1;
@@ -135,10 +133,9 @@ void timeoutHandler_Think() {
 	}
 	else if (timeoutStatus == 2) {
 		if (remainingTimeoutTime > 0) {
-			timeStr = getTimeoutText(0);
 			FOR_EACH_REALCLIENT(plr) {
 				if(plr.classname == "player") {
-					Send_CSQC_Centerprint_Generic(plr, CPID_TIMEOUT_COUNTDOWN, timeStr, 1, 0);
+					Send_CSQC_Centerprint_Generic(plr, CPID_TIMEOUT_COUNTDOWN, "Timeout ends in %d seconds!", 1, remainingTimeoutTime);
 				}
 			}
 			if(remainingTimeoutTime == autocvar_sv_timeout_resumetime) { //play a warning sound when only <sv_timeout_resumetime> seconds are left