Skip to content

Commit

Permalink
Too many windows bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelMoroz committed Nov 24, 2019
1 parent 6f85ef6 commit 4f87f4c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
5 changes: 5 additions & 0 deletions src/Interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ bool NoObjects()
return true;
}

int NumberOfObjects()
{
return global_objects.size();
}

void RemoveGlobalObject(int id)
{
if (global_objects.count(id) != 0)
Expand Down
1 change: 1 addition & 0 deletions src/Interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ void UpdateAspectRatio(float width, float heigth);
int AddGlobalObject(Object & a);
Object& get_glob_obj(int id);
bool NoObjects();
int NumberOfObjects();
void RemoveGlobalObject(int id);
void RemoveAllObjects();
void Add2DeleteQueue(int id);
Expand Down
9 changes: 2 additions & 7 deletions src/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,8 @@ int main(int argc, char *argv[]) {
{
if (game_mode == MAIN_MENU)
{
ConfirmExit(&scene, &overlays);
if(NumberOfObjects() < 2)
ConfirmExit(&scene, &overlays);
}
else if (game_mode == CONTROLS || game_mode == LEVELS)
{
Expand All @@ -353,13 +354,7 @@ int main(int argc, char *argv[]) {
{
//if no interface objects created
if (NoObjects())
{
ConfirmEditorExit(&scene, &overlays);
}
else if(get_glob_obj(focused).action_time < 0.f)//remove confirm window
{
RemoveGlobalObject(focused);
}
}
}
else if (keycode == SETTINGS.stg.control_mapping[RESTART])
Expand Down

0 comments on commit 4f87f4c

Please sign in to comment.