Skip to content

Commit

Permalink
game_display uses game_board in it's constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeck88 committed Jun 8, 2014
1 parent 8534aa2 commit 57cc44b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 22 deletions.
1 change: 1 addition & 0 deletions src/game_board.hpp
Expand Up @@ -59,6 +59,7 @@ class game_board {
friend class playmp_controller;
friend class events::mouse_handler;

friend class game_display;
/**
* Temporary unit move structs:
*
Expand Down
15 changes: 7 additions & 8 deletions src/game_display.cpp
Expand Up @@ -61,10 +61,10 @@ static lg::log_domain log_engine("engine");

std::map<map_location,fixed_t> game_display::debugHighlights_;

game_display::game_display(unit_map& units, CVideo& video, const gamemap& map,
const tod_manager& tod, const std::vector<team>& t,
game_display::game_display(game_board& board, CVideo& video,
const tod_manager& tod,
const config& theme_cfg, const config& level) :
display(&units, video, &map, &t, theme_cfg, level),
display(&board.units_, video, & board.map(), & board.teams(), theme_cfg, level),
overlay_map_(),
fake_units_(),
attack_indicator_src_(),
Expand All @@ -86,13 +86,12 @@ game_display::game_display(unit_map& units, CVideo& video, const gamemap& map,

game_display* game_display::create_dummy_display(CVideo& video)
{
static unit_map dummy_umap;
static config dummy_cfg;
static gamemap dummy_map(dummy_cfg, "");
static config dummy_cfg2;
static game_board dummy_board(dummy_cfg, dummy_cfg2);
static tod_manager dummy_tod(dummy_cfg);
static std::vector<team> dummy_teams;
return new game_display(dummy_umap, video, dummy_map, dummy_tod,
dummy_teams, dummy_cfg, dummy_cfg);
return new game_display(dummy_board, video, dummy_tod,
dummy_cfg, dummy_cfg);
}

game_display::~game_display()
Expand Down
6 changes: 3 additions & 3 deletions src/game_display.hpp
Expand Up @@ -37,9 +37,9 @@ class unit_map;
class game_display : public display
{
public:
game_display(unit_map& units, CVideo& video,
const gamemap& map, const tod_manager& tod_manager,
const std::vector<team>& t, const config& theme_cfg,
game_display(game_board& board, CVideo& video,
const tod_manager& tod_manager,
const config& theme_cfg,
const config& level);

static game_display* create_dummy_display(CVideo& video);
Expand Down
2 changes: 1 addition & 1 deletion src/play_controller.cpp
Expand Up @@ -259,7 +259,7 @@ void play_controller::init(CVideo& video){

LOG_NG << "building terrain rules... " << (SDL_GetTicks() - ticks_) << std::endl;
loadscreen::start_stage("build terrain");
gui_.reset(new game_display(gameboard_.units_, video, gameboard_.map_, tod_manager_, gameboard_.teams_, theme_cfg, level_));
gui_.reset(new game_display(gameboard_, video, tod_manager_, theme_cfg, level_));
if (!gui_->video().faked()) {
if (gamestate_.mp_settings().mp_countdown)
gui_->get_theme().modify_label("time-icon", _ ("time left for current turn"));
Expand Down
17 changes: 7 additions & 10 deletions src/tests/utils/fake_display.cpp
Expand Up @@ -16,22 +16,20 @@

#include "fake_display.hpp"

#include "game_board.hpp"
#include "game_display.hpp"
#include "tod_manager.hpp"
#include "map.hpp"
#include "unit_map.hpp"

namespace test_utils {

class fake_display_manager {
static fake_display_manager* manager_;

CVideo video_;
unit_map dummy_umap_;
config dummy_cfg_;
gamemap dummy_map_;
config dummy_cfg2_;
game_board dummy_board_;
tod_manager dummy_tod_;
std::vector<team> dummy_teams_;
const events::event_context main_event_context_;


Expand All @@ -58,14 +56,13 @@ namespace test_utils {

fake_display_manager::fake_display_manager() :
video_(CVideo::FAKE_TEST),
dummy_umap_(),
dummy_cfg_(),
dummy_map_(dummy_cfg_,""),
dummy_cfg2_(),
dummy_board_(dummy_cfg_, dummy_cfg2_),
dummy_tod_(dummy_cfg_),
dummy_teams_(),
main_event_context_(),
disp_(dummy_umap_, video_, dummy_map_, dummy_tod_,
dummy_teams_, dummy_cfg_, dummy_cfg_)
disp_(dummy_board_, video_, dummy_tod_,
dummy_cfg_, dummy_cfg_)
{
}

Expand Down

0 comments on commit 57cc44b

Please sign in to comment.