• R/O
  • SSH

zandronum-sandbox-stable: Commit


Commit MetaInfo

Revision3a92fdfd97a02d1fa364647baccb99f1de296f64 (tree)
Time2022-02-14 01:39:00
AuthorAdam Kaminski <kaminskiadam9@gmai...>
CommiterAdam Kaminski

Log Message

Fixed: GetMapRotationInfo now always returns zero (or an empty string) if the maplist is empty, the map position's level info is invalid, or if the current map position isn't the current level.

Change Summary

Incremental Difference

diff -r ddb966a92da9 -r 3a92fdfd97a0 src/p_acs.cpp
--- a/src/p_acs.cpp Thu Feb 10 12:28:30 2022 -0500
+++ b/src/p_acs.cpp Sun Feb 13 11:39:00 2022 -0500
@@ -7681,6 +7681,18 @@
76817681 case ACSF_GetMapRotationInfo:
76827682 {
76837683 ULONG ulPosition = ( args[0] <= 0 ) ? MAPROTATION_GetCurrentPosition() : ( args[0] - 1 );
7684+ level_info_t *rotationMap = MAPROTATION_GetMap( ulPosition );
7685+
7686+ // [AK] If the map position's level info is invalid, this could mean that there's no maplist
7687+ // or that the position is invalid, so return zero (or an empty string if we wanted the name).
7688+ // If we're checking the current map position, make sure it's the current level too.
7689+ if (( rotationMap == NULL ) || (( args[0] <= 0 ) && ( stricmp( level.mapname, rotationMap->mapname ) != 0 )))
7690+ {
7691+ if (( args[1] == MAPROTATION_Name ) || ( args[1] == MAPROTATION_LumpName ))
7692+ return GlobalACSStrings.AddString( "" );
7693+
7694+ return 0;
7695+ }
76847696
76857697 switch ( args[1] )
76867698 {
@@ -7693,13 +7705,7 @@
76937705
76947706 case MAPROTATION_Name:
76957707 case MAPROTATION_LumpName:
7696- {
7697- level_info_t *level = MAPROTATION_GetMap( ulPosition );
7698- if ( level == NULL )
7699- return GlobalACSStrings.AddString( "" );
7700-
7701- return GlobalACSStrings.AddString( args[1] == MAPROTATION_Name ? level->LookupLevelName().GetChars() : level->mapname );
7702- }
7708+ return GlobalACSStrings.AddString( args[1] == MAPROTATION_Name ? rotationMap->LookupLevelName().GetChars() : rotationMap->mapname );
77037709 }
77047710
77057711 return 0;
Show on old repository browser