Fix bugs switching between game and editor and back: make sure ModeFlag is set to 0 before it has any chance to show an alert message, fixing a crash; allow OBJ_NONE in Assert; make Game_wind invisible when loading editor in case we show an alert; call mouse_flush() in ui_init() to fix mouse issues

This commit is contained in:
Chris Taylor 2012-04-14 17:41:50 +08:00
parent ef6e5180db
commit b80b863f49
5 changed files with 7 additions and 3 deletions

View file

@ -6,6 +6,7 @@ main/gamesave.c: Fix crash when loading a level in the editor
editor/segment.c, include/editor/editor.h, main/gamesave.c: Set Gamesave_current_version to correct version when making a new mine, move create_new_mine to gamesave.c
main/gamesave.c: Don't bother generating a game text file (.txm) every time a level is loaded, even if the EDITOR is compiled. Just when a level is saved
editor/med.c, main/game.c, main/gamecntl.c: Delete-E while playing a level now works properly - it closes Game_wind and sets Cursegp if necessary when going to the editor
editor/med.c, main/dumpmine.c, main/gamecntl.c, ui/ui.c: Fix bugs switching between game and editor and back: make sure ModeFlag is set to 0 before it has any chance to show an alert message, fixing a crash; allow OBJ_NONE in Assert; make Game_wind invisible when loading editor in case we show an alert; call mouse_flush() in ui_init() to fix mouse issues
20120412
--------

View file

@ -464,9 +464,9 @@ void init_editor()
FNTScaleX = FNTScaleY = 1; // No font scaling!
ui_pad_goto(padnum);
gamestate_restore_check();
ModeFlag = 0;
gamestate_restore_check();
}
int ShowAbout()

View file

@ -50,7 +50,7 @@ char *object_types(int objnum)
{
int type = Objects[objnum].type;
Assert((type >= 0) && (type < MAX_OBJECT_TYPES));
Assert((type == OBJ_NONE) || ((type >= 0) && (type < MAX_OBJECT_TYPES)));
return Object_type_names[type];
}

View file

@ -822,6 +822,7 @@ int HandleTestKey(int key)
#ifdef EDITOR //editor-specific functions
case KEY_E + KEY_DEBUGGED:
window_set_visible(Game_wind, 0); // don't let the game do anything while we set the editor up
init_editor();
window_close(Game_wind);
break;

View file

@ -51,6 +51,8 @@ void ui_init()
CWHITE = gr_find_closest_color( 50, 50, 50 );
CBRIGHT = gr_find_closest_color( 58, 58, 58 );
CRED = gr_find_closest_color( 63, 0, 0 );
mouse_flush();
//key_init();