+void ctf_CheckStalemate(void)
+{
+ // declarations
+ float stale_red_flags, stale_blue_flags;
+ entity tmp_entity;
+
+ // build list of stale flags
+ for(tmp_entity = ctf_worldflaglist; tmp_entity; tmp_entity = tmp_entity.ctf_worldflagnext)
+ {
+ if(autocvar_g_ctf_flagcarrier_waypointforenemy_stalemate)
+ if(time >= tmp_entity.ctf_pickuptime + autocvar_g_ctf_flagcarrier_waypointforenemy_stalemate)
+ {
+ tmp_entity.ctf_staleflagnext = ctf_staleflaglist; // link flag into staleflaglist
+ ctf_staleflaglist = tmp_entity;
+
+ switch(tmp_entity.team)
+ {
+ case COLOR_TEAM1: ++stale_red_flags; break;
+ case COLOR_TEAM2: ++stale_blue_flags; break;
+ }
+ }
+ }
+
+ // if sufficient stalemate, then set up the waypointsprite and announce the stalemate if necessary
+ if(stale_red_flags && stale_blue_flags)
+ {
+ for(tmp_entity = ctf_staleflaglist; tmp_entity; tmp_entity = tmp_entity.ctf_staleflagnext)
+ {
+ if not(tmp_entity.owner.wps_enemyflagcarrier)
+ WaypointSprite_Spawn("enemyflagcarrier", 0, 0, tmp_entity.owner, FLAG_WAYPOINT_OFFSET, world, tmp_entity.team, tmp_entity.owner, wps_enemyflagcarrier, TRUE, RADARICON_FLAG, WPCOLOR_ENEMYFC(tmp_entity.owner.team));
+ }
+
+ if not(wpforenemy_announced)
+ {
+ FOR_EACH_REALPLAYER(tmp_entity)
+ {
+ if(tmp_entity.flagcarried)
+ centerprint(tmp_entity, "Stalemate! Enemies can now see you on radar!");
+ else
+ centerprint(tmp_entity, "Stalemate! Flag carriers can now be seen by enemies on radar!");
+ }
+
+ wpforenemy_announced = TRUE;
+ }
+ }
+}
+