From b9b42dd421f403a6ed0daf276fecfbeb92b93d4d Mon Sep 17 00:00:00 2001 From: David Kindl Date: Thu, 8 Oct 2026 13:05:20 +0200 Subject: [PATCH 1/2] Remove 3rd variable argument (`map` or `z`) from serv.map(location) and make it always `z` (#1602) --- Changelog.txt | 4 ++++ src/game/CServerConfig.cpp | 6 ++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 4e3e2732e..03a522f39 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -4148,3 +4148,7 @@ When setting a property like MORE to the a spell or skill defname, trying to rea 14-09-2026, Mulambo WARNING! POTENTIALLY BREAKING CHANGE! - Changed: Chance to hit in `CombatDamageEra=0` (Sphere custom) now returns calculated value, instead of random number from that value. + +08-10-2026, Mulambo + WARNING! POTENTIALLY BREAKING CHANGE! +- Changed: `serv.map(location)` 3rd parameter is now always `z` position (was `map` when received 3 arguments or `z` when received 4 arguments). diff --git a/src/game/CServerConfig.cpp b/src/game/CServerConfig.cpp index 170b45597..62c44e0ad 100644 --- a/src/game/CServerConfig.cpp +++ b/src/game/CServerConfig.cpp @@ -1681,11 +1681,9 @@ bool CServerConfig::r_WriteVal( lpctstr ptcKey, CSString & sVal, CTextConsole * FALLTHROUGH; case 3: - if ( IsDigit(ppVal[2][0]) || (( iArgs == 4 ) && ( ppVal[2][0] == '-' )) ) + if (IsDigit(ppVal[2][0]) || ppVal[2][0] == '-') { - pt.m_z = (char)(( iArgs == 4 ) ? atoi(ppVal[2]) : 0); - if ( iArgs == 3 ) - pt.m_map = (byte)(atoi(ppVal[2])); + pt.m_z = static_cast(atoi(ppVal[2])); } FALLTHROUGH; From 05022e2ad252e569437fc87a9b83f09ca7121d4d Mon Sep 17 00:00:00 2001 From: David Kindl Date: Thu, 8 Oct 2026 17:05:10 +0200 Subject: [PATCH 2/2] Add map ID check, otherwise it can crash the sphere with invalid id --- src/game/CServerConfig.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/game/CServerConfig.cpp b/src/game/CServerConfig.cpp index 62c44e0ad..b4ef6fc75 100644 --- a/src/game/CServerConfig.cpp +++ b/src/game/CServerConfig.cpp @@ -1677,6 +1677,11 @@ bool CServerConfig::r_WriteVal( lpctstr ptcKey, CSString & sVal, CTextConsole * if (IsDigit(ppVal[3][0])) { pt.m_map = (byte)(atoi(ppVal[3])); + + if (!g_MapList.IsMapSupported(pt.m_map)) { + g_Log.EventError("Unsupported Map %d\n", pt.m_map); + return false; + } } FALLTHROUGH;