]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc
Rename Team_*ControlPoints functions to Team_*OwnedItems so they can be used without...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / gamemodes / gamemode / onslaught / sv_onslaught.qc
index c9f2ea740aa4ac4fad7b79540493e2d40d75031a..c071be0e0e63108817b641c71402885dd2d92b67 100644 (file)
@@ -1126,7 +1126,7 @@ void Onslaught_count_generators()
        total_generators = 0;
        for (int i = 1; i <= NUM_TEAMS; ++i)
        {
-               Team_SetNumberOfControlPoints(Team_GetTeamFromIndex(i), 0);
+               Team_SetNumberOfOwnedItems(Team_GetTeamFromIndex(i), 0);
        }
        for(e = ons_worldgeneratorlist; e; e = e.ons_worldgeneratornext)
        {
@@ -1136,37 +1136,12 @@ void Onslaught_count_generators()
                        continue;
                }
                entity team_ = Entity_GetTeam(e);
-               int num_control_points = Team_GetNumberOfControlPoints(team_);
-               ++num_control_points;
-               Team_SetNumberOfControlPoints(team_, num_control_points);
+               int num_generators = Team_GetNumberOfOwnedItems(team_);
+               ++num_generators;
+               Team_SetNumberOfOwnedItems(team_, num_generators);
        }
 }
 
-int Onslaught_GetWinnerTeam()
-{
-       int winner_team = 0;
-       if (Team_GetNumberOfControlPoints(Team_GetTeamFromIndex(1)) >= 1)
-       {
-               winner_team = NUM_TEAM_1;
-       }
-       for (int i = 2; i <= NUM_TEAMS; ++i)
-       {
-               if (Team_GetNumberOfControlPoints(Team_GetTeamFromIndex(i)) >= 1)
-               {
-                       if (winner_team != 0)
-                       {
-                               return 0;
-                       }
-                       winner_team = Team_IndexToTeam(i);
-               }
-       }
-       if (winner_team)
-       {
-               return winner_team;
-       }
-       return -1; // no generators left?
-}
-
 void nades_Clear(entity e);
 
 bool Onslaught_CheckWinner()
@@ -1213,13 +1188,9 @@ bool Onslaught_CheckWinner()
        else { wpforenemy_announced = false; ons_stalemate = false; }
 
        Onslaught_count_generators();
-
-       if (Team_GetNumberOfTeamsWithControlPoints() > 1)
-       {
+       int winner_team = Team_GetWinnerTeam_WIthOwnedItems(1);
+       if (!winner_team)
                return 0;
-       }
-
-       int winner_team = Onslaught_GetWinnerTeam();
 
        if(winner_team > 0)
        {
@@ -2180,6 +2151,7 @@ void ons_DelayedInit(entity this) // Do this check with a delay so we can wait f
 void ons_Initialize()
 {
        g_onslaught = true;
+       g_onsshields = IL_NEW();
        ons_captureshield_force = autocvar_g_onslaught_shield_force;
 
        cam = new(objective_camera);