remove display dependency from map_generator
This commit is contained in:
parent
0ecf4d8ab9
commit
bb546c17bc
10 changed files with 20 additions and 18 deletions
|
@ -853,9 +853,9 @@ bool create_engine::generator_assigned() const
|
|||
return generator_ != NULL;
|
||||
}
|
||||
|
||||
void create_engine::generator_user_config(display& disp)
|
||||
void create_engine::generator_user_config(CVideo& v)
|
||||
{
|
||||
generator_->user_config(disp);
|
||||
generator_->user_config(v);
|
||||
}
|
||||
|
||||
int create_engine::find_level_by_id(const std::string& id) const
|
||||
|
|
|
@ -246,7 +246,7 @@ public:
|
|||
bool toggle_current_mod(bool force = false);
|
||||
|
||||
bool generator_assigned() const;
|
||||
void generator_user_config(display& disp);
|
||||
void generator_user_config(CVideo& v);
|
||||
|
||||
int find_level_by_id(const std::string& id) const;
|
||||
int find_extra_by_id(const MP_EXTRA extra_type, const std::string& id) const;
|
||||
|
|
|
@ -383,7 +383,7 @@ void create::process_event_impl(const process_event_data & data)
|
|||
}
|
||||
|
||||
if (engine_.generator_assigned() && generator_settings_.pressed()) {
|
||||
engine_.generator_user_config(disp_);
|
||||
engine_.generator_user_config(disp_.video());
|
||||
|
||||
level_changed = true;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "default_map_generator.hpp"
|
||||
|
||||
#include "default_map_generator_job.hpp"
|
||||
#include "display.hpp"
|
||||
#include "video.hpp"
|
||||
#include "gettext.hpp"
|
||||
#include "log.hpp"
|
||||
#include "map.hpp"
|
||||
|
@ -27,6 +27,7 @@
|
|||
#include "show_dialog.hpp"
|
||||
#include "seed_rng.hpp"
|
||||
#include "widgets/slider.hpp"
|
||||
#include "sdl/rect.hpp"
|
||||
|
||||
static lg::log_domain log_engine("engine");
|
||||
#define DBG_NG LOG_STREAM(debug, log_engine)
|
||||
|
@ -96,12 +97,12 @@ default_map_generator::default_map_generator(const config &cfg) :
|
|||
|
||||
bool default_map_generator::allow_user_config() const { return true; }
|
||||
|
||||
void default_map_generator::user_config(display& disp)
|
||||
void default_map_generator::user_config(CVideo& v)
|
||||
{
|
||||
const resize_lock prevent_resizing;
|
||||
const events::event_context dialog_events_context;
|
||||
|
||||
CVideo& screen = disp.video();
|
||||
CVideo& screen = v;
|
||||
|
||||
const int width = 600;
|
||||
const int height = 400;
|
||||
|
@ -328,7 +329,7 @@ void default_map_generator::user_config(display& disp)
|
|||
|
||||
update_rect(xpos,ypos,width,height);
|
||||
|
||||
disp.update_display();
|
||||
v.flip();
|
||||
CVideo::delay(100);
|
||||
events::pump();
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
default_map_generator(const config &game_config);
|
||||
|
||||
bool allow_user_config() const;
|
||||
void user_config(display& disp);
|
||||
void user_config(CVideo& v);
|
||||
|
||||
std::string name() const;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "lua_map_generator.hpp"
|
||||
|
||||
#include "config.hpp"
|
||||
#include "display.hpp"
|
||||
#include "video.hpp"
|
||||
#include "game_errors.hpp"
|
||||
#include "scripting/mapgen_lua_kernel.hpp"
|
||||
|
||||
|
@ -43,9 +43,9 @@ lua_map_generator::lua_map_generator(const config & cfg)
|
|||
}
|
||||
}
|
||||
|
||||
void lua_map_generator::user_config(display & disp)
|
||||
void lua_map_generator::user_config(CVideo & v)
|
||||
{
|
||||
lk_.set_video(&disp.video());
|
||||
lk_.set_video(&v);
|
||||
try {
|
||||
lk_.user_config(user_config_.c_str(), generator_data_);
|
||||
} catch (game::lua_error & e) {
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include <string>
|
||||
|
||||
struct lua_State;
|
||||
class display;
|
||||
class CVideo;
|
||||
|
||||
// TODO: Add support for user configurability (via defining a gui2 dialog in lua)
|
||||
// What's missing is that you need access to the 'wesnoth' object to call show dialog
|
||||
|
@ -41,7 +41,7 @@ public:
|
|||
|
||||
std::string config_name() const { return config_name_; }
|
||||
|
||||
virtual void user_config(display & disp);
|
||||
virtual void user_config(CVideo & v);
|
||||
virtual std::string create_map(boost::optional<boost::uint32_t> randomseed);
|
||||
virtual config create_scenario(boost::optional<boost::uint32_t> randomseed);
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ bool map_generator::allow_user_config() const
|
|||
return false;
|
||||
}
|
||||
|
||||
void map_generator::user_config(display& /*disp*/)
|
||||
void map_generator::user_config(CVideo& /*v*/)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#define MAP_GEN_HPP_INCLUDED
|
||||
|
||||
class config;
|
||||
class display;
|
||||
class CVideo;
|
||||
|
||||
#include "exceptions.hpp"
|
||||
#include "map_location.hpp"
|
||||
|
@ -49,7 +49,7 @@ public:
|
|||
* to modify how the generator behaves.
|
||||
* (This function will not be called if allow_user_config() returns false).
|
||||
*/
|
||||
virtual void user_config(display& disp);
|
||||
virtual void user_config(CVideo& v);
|
||||
|
||||
/**
|
||||
* Returns a string identifying the generator by name.
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
#include "gui/dialogs/editor_generate_map.hpp"
|
||||
|
||||
#include "display.hpp"
|
||||
#include "gui/auxiliary/find_widget.tpp"
|
||||
#include "gui/dialogs/helper.hpp"
|
||||
|
||||
|
@ -88,7 +89,7 @@ void teditor_generate_map::do_generator_selected(twindow& window)
|
|||
|
||||
void teditor_generate_map::do_settings(twindow&)
|
||||
{
|
||||
get_selected_map_generator()->user_config(*gui_);
|
||||
get_selected_map_generator()->user_config(gui_->video());
|
||||
}
|
||||
|
||||
map_generator* teditor_generate_map::get_selected_map_generator()
|
||||
|
|
Loading…
Add table
Reference in a new issue