From 8e8a452a7eca485e73d86410bacb9d50a298b2bc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tobias=20Gl=C3=A4=C3=9Fer?= Date: Sat, 8 May 2004 11:35:04 +0000 Subject: [PATCH] Make sure that tiles are loaded before tilegroups are requested. This fixed a bug when loading leveleditor from command-line. SVN-Revision: 1041 --- src/leveleditor.cpp | 8 ++++---- src/tile.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/leveleditor.cpp b/src/leveleditor.cpp index 73ffddbc7..a45405d59 100644 --- a/src/leveleditor.cpp +++ b/src/leveleditor.cpp @@ -257,8 +257,7 @@ int leveleditor(char* filename) default: if(it >= 0) { - cur_tilegroup - = select_tilegroup_menu->get_item_by_id(it).text; + cur_tilegroup = select_tilegroup_menu->get_item_by_id(it).text; Menu::set_current(0); cur_objects = ""; @@ -446,6 +445,7 @@ void le_init_menus() select_tilegroup_menu->arrange_left = true; select_tilegroup_menu->additem(MN_LABEL,"Tilegroup",0,0); select_tilegroup_menu->additem(MN_HL,"",0,0); + select_tilegroup_menu->additem(MN_ACTION,"asd",0,0); std::set* tilegroups = TileManager::tilegroups(); int tileid = 1; for(std::set::iterator it = tilegroups->begin(); @@ -642,7 +642,7 @@ void apply_level_settings_menu() le_world->get_level()->song_title = string_list_active(level_settings_menu->get_item_by_id(MNID_SONG).list); le_world->get_level()->change_size(atoi(level_settings_menu->get_item_by_id(MNID_LENGTH).input)); - le_world->get_level()->time_left = atoi(level_settings_menu->get_item_by_id(MNID_BGIMG).input); + le_world->get_level()->time_left = atoi(level_settings_menu->get_item_by_id(MNID_TIME).input); le_world->get_level()->gravity = atof(level_settings_menu->get_item_by_id(MNID_GRAVITY).input); le_world->get_level()->bkgd_speed = atoi(level_settings_menu->get_item_by_id(MNID_BGSPEED).input); le_world->get_level()->bkgd_top.red = atoi(level_settings_menu->get_item_by_id(MNID_TopRed).input); @@ -901,7 +901,7 @@ void le_drawlevel() /* draw whats inside stuff when cursor is selecting those */ /* (draw them all the time - is this the right behaviour?) */ - if(TileManager::instance()->get(le_world->get_level()->ia_tiles[y][x + (int)(pos_x / 32)])->editor_images.size() > 0) + if(!TileManager::instance()->get(le_world->get_level()->ia_tiles[y][x + (int)(pos_x / 32)])->editor_images.empty()) TileManager::instance()->get(le_world->get_level()->ia_tiles[y][x + (int)(pos_x / 32)])->editor_images[0]->draw( x * 32 - ((int)pos_x % 32), y*32); } diff --git a/src/tile.h b/src/tile.h index 60f93fee0..c2c6a35ec 100644 --- a/src/tile.h +++ b/src/tile.h @@ -112,7 +112,7 @@ class TileManager static TileManager* instance() { return instance_ ? instance_ : instance_ = new TileManager(); } static void destroy_instance() { delete instance_; instance_ = 0; } - static std::set* tilegroups() { return tilegroups_ ? tilegroups_ : tilegroups_ = new std::set; } + static std::set* tilegroups() { if(!instance_) { instance_ = new TileManager(); } return tilegroups_ ? tilegroups_ : tilegroups_ = new std::set; } Tile* get(unsigned int id) { if(id < tiles.size()) { -- 2.11.0