-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect Maths to determine Total Width and Total Height in generateMap.lua #19
Comments
*Scratches head* What in the world was I thinking with the total width and total height. That is obviously wrong. It would only work when one number is positive and the other is negative. I need to update stdlib and take advantage of all the area functions that were introduced after I wrote this code originally. The included stdlib is ancient and somewhere between 0.5.0-0.6.0 releases if memory serves me. So many things added since then. |
Fixed in FactorioMaps 0.16.1. Will release it on mod portal later once I test a bit more. Grab it from here if you want it now. Not sure what these FILE NOT FOUND messages are about. Did these happen so show up after you made the changes to calculating the inGameTotalWidth and inGameTotalHeight? |
Using Top Left X/Y of -377, -6145 and Bottom Right X/Y of 0, -5700 as an example, your maths concludes the variables inGameTotalWidth of 377, and inGameTotalHeigh of 11845.
The correct results should be 377, and 445.
You have to Minus the Bottom Right X/Y from Top Left X/Y to find out the width / height.
I've tested, and updated my local generateMap.lua to the following to reflect the fix required instead.
local inGameTotalWidth = math.ceil(data.bottomRight.x - data.topLeft.x)
local inGameTotalHeight = math.ceil(data.bottomRight.y - data.topLeft.y)
Also, to stop the FILE NOT FOUND messages due to missing jpg layer files, i've also updated the following lines. Please note, I have only tested with "Huge" grid size setting.
As you zoom in however, it crops the edges off (still has the zoom level detail based on your Top Left / Bottom right co-ords)
--for y = 0, numVScreenshots - 1 do
to
for y = -1, numVScreenshots do
and
--for x = 0, numHScreenshots - 1 do
to
for x = -1, numHScreenshots do
The text was updated successfully, but these errors were encountered: