teeworlds/teeworlds — pull request #1100 by minus7 (2013-05-26 09:13:49+00:00)
Title: Loading map with invalid version crashes editor

CEditorMap::Load returned true in some cases even if the map failed to load. CEditor::CallbackOpenMap didn't reset in case of a failed load.

In particular the editor checks MAPITEMTYPE_VERSION in the datafile to be 1 but just continues if it isn't (or if this item isn't even in the file) whereas the game itself doesn't use this item at all. It seems to have been used to distinguish the current map format from an older one (see CEditorMap::Load, game/editor/io.cpp:420)

This patch just gets rid of the crash (the map loading dialog will just stay open). It might be better to get rid of this version item along with the (mostly commented out) legacy code.

The patch is based on the 0.6 branch but the same problem exists in the development branch too.