From: Mario Date: Fri, 15 Jan 2016 17:41:32 +0000 (+1000) Subject: Move assault winning condition function into the assault file X-Git-Tag: xonotic-v0.8.2~1232 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=6551ba10c2a3a64b7232f0e5fb599af4e9b0b40a;p=xonotic%2Fxonotic-data.pk3dir.git Move assault winning condition function into the assault file --- diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 160be7389..5fc7b9f99 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -1648,51 +1648,6 @@ void ClearWinners() FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(it.winning = 0)); } -// Assault winning condition: If the attackers triggered a round end (by fulfilling all objectives) -// they win. Otherwise the defending team wins once the timelimit passes. -void assault_new_round(); -float WinningCondition_Assault() -{SELFPARAM(); - float status; - - WinningConditionHelper(); // set worldstatus - - status = WINNING_NO; - // as the timelimit has not yet passed just assume the defending team will win - if(assault_attacker_team == NUM_TEAM_1) - { - SetWinners(team, NUM_TEAM_2); - } - else - { - SetWinners(team, NUM_TEAM_1); - } - - entity ent; - ent = find(world, classname, "target_assault_roundend"); - if(ent) - { - if(ent.winning) // round end has been triggered by attacking team - { - bprint("ASSAULT: round completed...\n"); - SetWinners(team, assault_attacker_team); - - TeamScore_AddToTeam(assault_attacker_team, ST_ASSAULT_OBJECTIVES, 666 - TeamScore_AddToTeam(assault_attacker_team, ST_ASSAULT_OBJECTIVES, 0)); - - if(ent.cnt == 1 || autocvar_g_campaign) // this was the second round - { - status = WINNING_YES; - } - else - { - WITH(entity, self, ent, assault_new_round()); - } - } - } - - return status; -} - void ShuffleMaplist() { cvar_set("g_maplist", shufflewords(autocvar_g_maplist)); diff --git a/qcsrc/server/mutators/mutator/gamemode_assault.qc b/qcsrc/server/mutators/mutator/gamemode_assault.qc index 7cdd00f41..b822911c8 100644 --- a/qcsrc/server/mutators/mutator/gamemode_assault.qc +++ b/qcsrc/server/mutators/mutator/gamemode_assault.qc @@ -295,6 +295,48 @@ void assault_new_round() ReadyRestart_force(); // sets game_starttime } +// Assault winning condition: If the attackers triggered a round end (by fulfilling all objectives) +// they win. Otherwise the defending team wins once the timelimit passes. +int WinningCondition_Assault() +{ + WinningConditionHelper(); // set worldstatus + + int status = WINNING_NO; + // as the timelimit has not yet passed just assume the defending team will win + if(assault_attacker_team == NUM_TEAM_1) + { + SetWinners(team, NUM_TEAM_2); + } + else + { + SetWinners(team, NUM_TEAM_1); + } + + entity ent; + ent = find(world, classname, "target_assault_roundend"); + if(ent) + { + if(ent.winning) // round end has been triggered by attacking team + { + bprint("ASSAULT: round completed...\n"); + SetWinners(team, assault_attacker_team); + + TeamScore_AddToTeam(assault_attacker_team, ST_ASSAULT_OBJECTIVES, 666 - TeamScore_AddToTeam(assault_attacker_team, ST_ASSAULT_OBJECTIVES, 0)); + + if(ent.cnt == 1 || autocvar_g_campaign) // this was the second round + { + status = WINNING_YES; + } + else + { + WITH(entity, self, ent, assault_new_round()); + } + } + } + + return status; +} + // spawnfuncs spawnfunc(info_player_attacker) {