Load time areas from the map file.

This commit is contained in:
fendrin 2013-05-06 21:18:00 +02:00
parent 738abe2299
commit 18dbe08aa9
2 changed files with 23 additions and 7 deletions

View file

@ -51,10 +51,11 @@ map_context::map_context(const editor_map& map, const display& disp)
, needs_labels_reset_(false)
, changed_locations_()
, everything_changed_(false)
, active_area_(1)
, labels_(disp, NULL)
, units_()
, teams_()
, tod_manager_()
, tod_manager_(new tod_manager)
, state_()
{
}
@ -73,10 +74,11 @@ map_context::map_context(const config& game_config, const std::string& filename,
, needs_labels_reset_(false)
, changed_locations_()
, everything_changed_(false)
, active_area_(0)
, labels_(disp, NULL)
, units_()
, teams_()
, tod_manager_()
, tod_manager_(NULL)
, state_()
{
/*
@ -140,6 +142,11 @@ map_context::map_context(const config& game_config, const std::string& filename,
labels_.read(level);
tod_manager_.reset(new tod_manager(level));
BOOST_FOREACH(const config &t, level.child_range("time_area")) {
tod_manager_->add_time_area(t);
}
resources::teams = &teams_;
int i = 1;
@ -265,7 +272,7 @@ bool map_context::save()
{
std::string data = map_.write();
config wml_data;
config wml_data = tod_manager_->to_config();
labels_.write(wml_data);
//TODO think about saving the map to the wml file

View file

@ -22,6 +22,7 @@
#include "gamestatus.hpp"
#include <boost/utility.hpp>
#include <boost/scoped_ptr.hpp>
namespace editor {
@ -69,7 +70,9 @@ public:
/** Adds a new side to the map */
void new_side() {
teams_.push_back(team());
team t;
t.set_hidden(false);
teams_.push_back(t);
}
/** Get the team from the current map context object */
@ -90,14 +93,18 @@ public:
return units_;
}
tod_manager& get_time_manager() {
return tod_manager_;
tod_manager* get_time_manager() {
return tod_manager_.get();
}
game_state& get_game_state() {
return state_;
}
int get_active_area() {
return active_area_;
}
/**
* Draw a terrain on a single location on the map.
* Sets the refresh flags accordingly.
@ -336,10 +343,12 @@ protected:
private:
int active_area_;
map_labels labels_;
unit_map units_;
std::vector<team> teams_;
tod_manager tod_manager_;
boost::scoped_ptr<tod_manager> tod_manager_;
game_state state_;
};