Issue800

Title game breaking if level in between is missing/removed; user'd've to fix manually
Priority release-blocker Status resolved
Assigned To fluzz Keywords
Linked issues Watchers fluzz

Submitted on 2015-03-14 20h36 by matthiaskrgr, last changed by fluzz.

Messages
Author: matthiaskrgr Date: 2015-03-14   20h36
We currently have 72 levels.
Now if we create two additional levels (73 and 74), remove level 73 again, save,
quit the game and restart the editor, it (editor) refuses to load.

---------------------------------------------------------------------------------
FreedroidRPG 0.15-1434-g51d1e8e encountered a problem in function: LoadShip
Level number 73 should exist but is NULL.


The problem is that we cannot start the editor anymore due to this, so without
manually editing the map file, there is no way we can fix this problem (thinking
of "normal" users here).

Starting a new game is not possible because of this as well.

Perhaps we should automatically create an empty level that fills in the gap then
or do something so that the user gets a chance to fix the issue without having
to edit files by hand.
Author: matthiaskrgr Date: 2015-03-14   20h37
Or for a different approach, we could refuse saving the map in such a "broken"
state.
Author: digifuzzy Date: 2015-04-13   03h03
If I were to take this bug (probable), there is one of two approaches I could
take to resolve it.

The long way...
Remove sequential enforcement in both the level editor and the game. This would
allow for levels to be grouped by function (e.g. Debug levels could be 90 - 95
and tutorial level(s) >95).

The short way...
Use the level editor to enforce sequential integrity prior to saving/closing. If
any gaps are found, the level #'s above are shifted downward to fill the gap.

Take away point: level number is arbitrary! I'm aware of the wiki documentation
not relying on level number for sequencing but I'm not so sure about game details.
Author: jesusalva Date: 2015-04-13   13h21
Hmm... I don't remember this bug 
happening before.
If I remember correctly, if you removed 
Lv 73, the level 74 would become Level 
73.
Author: fluzz Date: 2015-04-18   18h16
The game is expected to support missing level number since a long time.
There is a level_exists() function meant to be used when looping through all
level numbers from 0 to MAX_LEVELS.

So the use of that function is missing somewhere...

I'll check and fix the code.
Author: fluzz Date: 2015-04-23   07h32
Fixed in commit df28950, by removing the check against missing level numbers.
As already said, the game supports missing level numbers since a long.
I have no idea why this check was added...
History
Date User Action Args
2015-04-23 07:32:11fluzzsetstatus: open -> resolved
messages: + msg3128
2015-04-18 18:16:55fluzzsetassignedto: fluzz
nosy: + fluzz
2015-04-18 18:16:41fluzzsetmessages: + msg3125
2015-04-13 13:21:21jesusalvasetmessages: + msg3109
2015-04-13 03:03:38digifuzzysetmessages: + msg3105
2015-03-14 20:37:17matthiaskrgrsetmessages: + msg3096
2015-03-14 20:36:17matthiaskrgrcreate