# HG changeset patch
# User auratoostronk
# Date 1688583531 25200
#      Wed Jul 05 11:58:51 2023 -0700
# Node ID 8a35a099c309bd94a9865613351443d43e6517d3
# Parent  33c4c09c65988e83f75d789f7cd7f8ef539a55e1
Fixed: flags in CTF could be captured after the round was over. [auratoostronk]

diff -r 33c4c09c6598 -r 8a35a099c309 docs/zandronum-history.txt
--- a/docs/zandronum-history.txt	Sun Jun 25 15:45:08 2023 -0400
+++ b/docs/zandronum-history.txt	Wed Jul 05 11:58:51 2023 -0700
@@ -99,6 +99,7 @@
 -	- Fixed: the localhost couldn't successfully join the server through the server console window if it was forcing a connect or join password. [Kaminsky]
 -	- Fixed: local CVars defined in CVARINFO were never saved in the user's config file. [Kaminsky]
 -	- Fixed: players didn't drop important items like flags, skulls, etc. when they respawned using SetPlayerClass. [Kaminsky]
+-	- Fixed: flags in CTF could be captured after the round was over. [auratoostronk]
 !	- The result value of GAMEEVENT_MEDALS event scripts can now be used to determine whether or not the player receives the medal. [Kaminsky]
 !	- GAMEMODE flags are now validated after all GAMEMODE lumps have been parsed instead of after each one. The internal game mode name (e.g. "TeamLMS") is now printed with the error message instead of the actual name. [Kaminsky]
 !	- Added an extra check to ensure that game modes have a (short) name. [Kaminsky]
diff -r 33c4c09c6598 -r 8a35a099c309 src/g_shared/a_flags.cpp
--- a/src/g_shared/a_flags.cpp	Sun Jun 25 15:45:08 2023 -0400
+++ b/src/g_shared/a_flags.cpp	Wed Jul 05 11:58:51 2023 -0700
@@ -431,6 +431,10 @@
 	if (( this->GetClass( ) != TEAM_GetItem( Owner->player->Team )) &&
 		( pItem->GetClass( ) == TEAM_GetItem( Owner->player->Team )))
 	{
+		//[NS] Do not allow scoring when the round is over.
+		if ( GAMEMODE_IsGameInProgress() == false )
+			return ( Super::HandlePickup( pItem ));
+
 		// Don't award a point if we're touching a dropped version of our flag.
 		if ( static_cast<AFlag *>( pItem )->AllowFlagPickup( Owner ) == RETURN_FLAG )
 			return ( Super::HandlePickup( pItem )); 
