#include <map>
#include <typeinfo>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <errno.h>
-#include <unistd.h>
-#include <SDL.h>
-#include <SDL_image.h>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <cmath>
+#include <cerrno>
#include <algorithm>
#include <iostream>
+#include <unistd.h>
-#include "leveleditor.h"
+#include "SDL.h"
+#include "SDL_image.h"
+#include "leveleditor.h"
#include "screen/screen.h"
#include "defines.h"
#include "globals.h"
#include "player.h"
#include "scene.h"
#include "tile.h"
+#include "tile_manager.h"
#include "resources.h"
#include "background.h"
#include "camera.h"
le_mouse_clicked[LEFT] = false;
le_mouse_clicked[RIGHT] = false;
- le_selection = new Surface(datadir + "/images/leveleditor/select.png", USE_ALPHA);
+ le_selection = new Surface(datadir + "/images/leveleditor/select.png", true);
select_tilegroup_menu_effect.init(false);
select_objects_menu_effect.init(false);
for(std::vector<int>::const_iterator sit = (*it).tiles.begin();
sit != (*it).tiles.end(); ++sit, ++i)
{
- Tile& tile = *(TileManager::instance()->get(*sit));
+ Tile& tile = TileManager::instance()->get(*sit);
Surface* image;
if(tile.editor_images.size() > 0)
image = tile.editor_images[0];
le_object_properties_bt->draw(context);
}
- sprintf(str, "%d/%d", le_levelnb,le_level_subset->levels);
- context.draw_text(white_text, str, Vector((le_level_subset->levels < 10) ? -10 : 0, 16), LAYER_GUI);
+ sprintf(str, "%d/%d", le_levelnb, le_level_subset->get_num_levels());
+ context.draw_text(white_text, str, Vector((le_level_subset->get_num_levels() < 10) ? -10 : 0, 16), LAYER_GUI);
if(!le_help_shown)
context.draw_text(white_small_text, "F1 for Help", Vector(10, 430), LAYER_GUI);
le_next_level_bt->event(event);
if(le_next_level_bt->get_state() == BUTTON_CLICKED)
{
- if(le_levelnb < le_level_subset->levels)
+ if(le_levelnb < le_level_subset->get_num_levels())
{
goto_level(le_levelnb+1);
}
Surface* surf = new Surface(le_level->get_sector("main")->background->get_image(), false);
if(confirm_dialog(surf, str))
{
- new_lev.save(le_level_subset->name.c_str());
- le_level_subset->levels = le_levelnb;
+ le_level_subset->add_level("newlevel.stl");
+ new_lev.save(le_level_subset->get_level_filename(le_levelnb+1));
goto_level(le_levelnb);
}
if(surf != NULL)
for(unsigned int t = 0; t < sizeof(text[i])/sizeof(char *); t++)
context.draw_text(white_text, text[i][t], Vector(5, 80+(t*white_text->get_height())), LAYER_GUI);
- sprintf(str,"Press any key to continue - Page %d/%d?", i, sizeof(text));
+ sprintf(str,"Press any key to continue - Page %d/%d?", i, static_cast<int>(sizeof(text)));
context.draw_text(gold_text, str, Vector(0, 0), LAYER_GUI);
context.do_drawing();