1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. Photobucket has changed its policy concerning hotlinking images and now requires an account with a $399.00 annual fee to allow hotlink. More information is available at: this link.
    Dismiss Notice
  3. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  4. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  5. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  6. Dismiss Notice
  7. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

[Vanilla] Question: how does a map script detect custom world sizes in GetMapInitData()?

Discussion in 'Mod Creation Help' started by Scrum Lord, Dec 30, 2017.

  1. Scrum Lord

    Scrum Lord Chieftain

    Joined:
    Jul 2, 2017
    Messages:
    49
    Gender:
    Male
    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:
    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: Dec 30, 2017

Share This Page