Make sure that tiles are loaded before tilegroups are requested. This fixed a bug...
authorTobias Gläßer <tobi.web@gmx.de>
Sat, 8 May 2004 11:35:04 +0000 (11:35 +0000)
committerTobias Gläßer <tobi.web@gmx.de>
Sat, 8 May 2004 11:35:04 +0000 (11:35 +0000)
SVN-Revision: 1041

src/leveleditor.cpp
src/tile.h

index 73ffddb..a45405d 100644 (file)
@@ -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<TileGroup>* tilegroups = TileManager::tilegroups();
   int tileid = 1;
   for(std::set<TileGroup>::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);
 
     }
index 60f93fe..c2c6a35 100644 (file)
@@ -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<TileGroup>* tilegroups() { return tilegroups_ ? tilegroups_ : tilegroups_ = new std::set<TileGroup>; }
+  static std::set<TileGroup>* tilegroups() { if(!instance_) { instance_ = new TileManager(); } return tilegroups_ ? tilegroups_ : tilegroups_ = new std::set<TileGroup>; }
   Tile* get(unsigned int id) {
     if(id < tiles.size())
       {