Skip to content

Commit dfae8af

Browse files
committed
fix random map gen: treat new_map_x and new_map_y in Spring map dimensions size rather than double that
1 parent 38e6e43 commit dfae8af

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

doc/changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ Misc:
174174
- IME editing support for those with the proper SDL2 version/IME tool combination
175175
! Made lockluaui.txt obsolete: no longer necessary for it to exists in order to enable VFS for LuaUI
176176
- use SHA2 rather than CRC32 content hashes
177+
! blank map params: new_map_x and new_map_y are now in map dimension sizes rather than map dimension * 2. new_map_z renamed to new_map_y
177178

178179
Fixes:
179180
- fix #1968 (units not moving in direction of next queued [build-]command if current order blocked)

rts/Map/Generation/SimpleMapGenerator.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,22 @@ void CSimpleMapGenerator::GenerateInfo()
2525
}
2626

2727
const std::string* newMapXStr = mapOpts.try_get("new_map_x");
28-
const std::string* newMapZStr = mapOpts.try_get("new_map_z");
28+
const std::string* newMapYStr = mapOpts.try_get("new_map_y");
2929

30-
if (newMapXStr == nullptr || newMapZStr == nullptr) {
30+
if (newMapXStr == nullptr || newMapYStr == nullptr) {
3131
mapSize = int2(1, 1);
3232
return;
3333
}
3434

3535

3636
try {
37-
const int newMapX = std::stoi(*newMapXStr);
38-
const int newMapZ = std::stoi(*newMapZStr);
37+
// mapSize coordinates are actually 2x the spring map dimensions
38+
// Example: 10x10 map has mapSize = (5, 5)
39+
const int newMapX = std::stoi(*newMapXStr) / 2;
40+
const int newMapY = std::stoi(*newMapYStr) / 2;
3941

40-
if (newMapX > 0 && newMapZ > 0)
41-
mapSize = int2(newMapX, newMapZ);
42+
if (newMapX > 0 && newMapY > 0)
43+
mapSize = int2(newMapX, newMapY);
4244

4345
} catch (...) {
4446
mapSize = int2(1, 1);

0 commit comments

Comments
 (0)