From: terencehill Date: Wed, 10 Apr 2013 16:15:32 +0000 (+0200) Subject: round_handler: allow infinite round time (*round_timelimit 0) and remove 10 seconds... X-Git-Tag: xonotic-v0.7.0~61^2~5 X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=e33dcf5ea9dcdbcf166f9bee9fb4cd6cae9318cd round_handler: allow infinite round time (*round_timelimit 0) and remove 10 seconds minimum round time --- diff --git a/qcsrc/server/mutators/gamemode_arena.qc b/qcsrc/server/mutators/gamemode_arena.qc index 484e641991..46b8faccc1 100644 --- a/qcsrc/server/mutators/gamemode_arena.qc +++ b/qcsrc/server/mutators/gamemode_arena.qc @@ -60,7 +60,7 @@ float Arena_CheckWinner() { entity e; - if(round_handler_GetTimeLeft() <= 0) + if(round_handler_GetEndTime() > 0 && round_handler_GetEndTime() - time <= 0) { Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_ROUND_OVER); Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_ROUND_OVER); diff --git a/qcsrc/server/mutators/gamemode_ca.qc b/qcsrc/server/mutators/gamemode_ca.qc index f00c4df393..11330fbd7d 100644 --- a/qcsrc/server/mutators/gamemode_ca.qc +++ b/qcsrc/server/mutators/gamemode_ca.qc @@ -67,7 +67,7 @@ float CA_GetWinnerTeam() #define CA_ALIVE_TEAMS_OK() (CA_ALIVE_TEAMS() == ca_teams) float CA_CheckWinner() { - if(round_handler_GetTimeLeft() <= 0) + if(round_handler_GetEndTime() > 0 && round_handler_GetEndTime() - time <= 0) { Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_ROUND_OVER); Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_ROUND_OVER); diff --git a/qcsrc/server/mutators/gamemode_freezetag.qc b/qcsrc/server/mutators/gamemode_freezetag.qc index 3f8094e16b..cfd39794f0 100644 --- a/qcsrc/server/mutators/gamemode_freezetag.qc +++ b/qcsrc/server/mutators/gamemode_freezetag.qc @@ -95,7 +95,7 @@ float freezetag_getWinnerTeam() float freezetag_CheckWinner() { entity e; - if(round_handler_GetTimeLeft() <= 0) + if(round_handler_GetEndTime() > 0 && round_handler_GetEndTime() - time <= 0) { Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_ROUND_OVER); Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_ROUND_OVER); diff --git a/qcsrc/server/round_handler.qc b/qcsrc/server/round_handler.qc index 8715a4deaa..af69e8e9e5 100644 --- a/qcsrc/server/round_handler.qc +++ b/qcsrc/server/round_handler.qc @@ -33,7 +33,7 @@ void round_handler_Think() if(f == 0) { self.cnt = 0; - self.round_endtime = time + self.round_timelimit; + self.round_endtime = (self.round_timelimit) ? time + self.round_timelimit : 0; self.nextthink = time; if(self.roundStart) self.roundStart(); @@ -67,7 +67,7 @@ void round_handler_Init(float the_delay, float the_count, float the_round_timeli round_handler.delay = (the_delay > 0) ? the_delay : 0; round_handler.count = fabs(floor(the_count)); round_handler.cnt = round_handler.count + 1; - round_handler.round_timelimit = max(10, the_round_timelimit); + round_handler.round_timelimit = (the_round_timelimit > 0) ? the_round_timelimit : 0; } // NOTE: this is only needed because if round_handler spawns at time 1 diff --git a/qcsrc/server/round_handler.qh b/qcsrc/server/round_handler.qh index 48803113f8..22a91dc2c6 100644 --- a/qcsrc/server/round_handler.qh +++ b/qcsrc/server/round_handler.qh @@ -19,5 +19,5 @@ void round_handler_Remove(); #define round_handler_AwaitingNextRound() (round_handler.wait) #define round_handler_CountdownRunning() (!round_handler.wait && round_handler.cnt) #define round_handler_IsRoundStarted() (!round_handler.wait && !round_handler.cnt) -#define round_handler_GetTimeLeft() (round_handler.round_endtime - time) +#define round_handler_GetEndTime() (round_handler.round_endtime)