Scrum Lord
Warlord
- Joined
- Jul 2, 2017
- Messages
- 226
Does anyone know if there is a way to detect custom world sizes in a map script's GetMapInitData() function using the passed-in worldSize hash? I can't just look-up the grid size because my map script (Got Lakes) has other options that affect the height of the map, such as worlds with cropped N/S poles. In other words, my map script needs to know the world size by name/type so that I can dynamically set the grid size.
But I've run into a problem. I have the following snippet of code for determining the world size:
For some reason, only the standard map sizes have a non-nil hash. Custom map sizes, such as the ones from Larger Map Sizes or Yet (not) Another Maps Pack, have rows but each of those rows has a nil value for row.Hash.
On a related note, the Inland Sea map script has similar world-size lookup logic, and that map type crashes when run with a custom map size. I haven't confirmed this, but I suspect that Inland Sea is running into the same problem.
So is this a configuration/database issue or is this a bug in the map generator API? Any help/tips would be greatly appreciated.
But I've run into a problem. I have the following snippet of code for determining the world size:
Code:
function GetMapInitData(worldSize)
-- ...
local mapSizeType;
for row in GameInfo.Maps() do
if(worldSize == row.Hash) then
mapSizeType = row.MapSizeType;
break;
end
end
-- ...
end
For some reason, only the standard map sizes have a non-nil hash. Custom map sizes, such as the ones from Larger Map Sizes or Yet (not) Another Maps Pack, have rows but each of those rows has a nil value for row.Hash.
On a related note, the Inland Sea map script has similar world-size lookup logic, and that map type crashes when run with a custom map size. I haven't confirmed this, but I suspect that Inland Sea is running into the same problem.
So is this a configuration/database issue or is this a bug in the map generator API? Any help/tips would be greatly appreciated.
Last edited: