Title warn when saving obstacles with negative x/y index
Priority critical Status resolved
Assigned To fluzz Keywords editor
Linked issues Watchers fluzz

Submitted on 2014-09-12 17h35 by matthiaskrgr, last changed by fluzz.

Author: matthiaskrgr Date: 2014-09-12   17h35
It recently occurred to me that I saved a map, and then git diff showed
obstacles with negative y position index in levels.dat

 t319 x45.93 y-33.68
 t316 x41.05 y-20.92
 t317 x41.56 y72.84
 t148 x40.98 y-19.62
 t320 x36.77 y-14.82
 t143 x40.40 y-19.50
 t146 x40.16 y-19.55

I currently have no idea how that happened so I'd like to have some warning when
we are going to save obstacles with negative x or y index (if it doesn't drain
too much performance when saving a level), at least until this issue is somehow
Author: fluzz Date: 2015-01-05   16h51
Such obstacles are not visible, right ? So we could just discard them when
writing levels.dat

What do you think ?
Author: matthiaskrgr Date: 2015-01-06   20h17
No, I want to have a visible (stderr) warning as soon as negative obstacle
indexes appear *somewhere* in saved data, since in my opinion it indicates a
(gave?) bug somewhere in the code.
Instead of just ignoring the root of the bug and discarding the invalid
obstacles, we should fix the bug itself so that negative obstacle indexes can no
longer occur.

It will at least hopefully give some idea where to search for the bug.
Author: matthiaskrgr Date: 2015-01-06   20h31
Perhaps we could, when saving and/or loading a map, check if all obstacles have
positive x/y coordinates, and if not, throw an error.
Author: fluzz Date: 2015-01-12   13h19
Implemented in commit 7e074eb62fd5b60e03e8242cdb544c7c26967e7e
Date User Action Args
2015-01-12 13:19:19fluzzsetstatus: open -> resolved
assignedto: fluzz
messages: + msg3032
nosy: + fluzz
2015-01-06 20:31:42matthiaskrgrsetmessages: + msg3030
2015-01-06 20:17:59matthiaskrgrsetmessages: + msg3029
2015-01-05 16:51:47fluzzsetmessages: + msg3027
2014-09-12 17:35:34matthiaskrgrcreate