Revert "Game Display: don't use resources::tod_manager"

This reverts commit c21b049d52.
This commit is contained in:
Charles Dang 2024-08-31 17:15:06 -04:00
parent 742f400612
commit 03cf5e64ce
3 changed files with 14 additions and 19 deletions

View file

@ -24,7 +24,6 @@
#include "cursor.hpp"
#include "display_chat_manager.hpp"
#include "fake_unit_manager.hpp"
#include "filter_context.hpp"
#include "floating_label.hpp"
#include "game_board.hpp"
#include "preferences/preferences.hpp"
@ -61,14 +60,12 @@ std::map<map_location, int> game_display::debugHighlights_;
*/
std::vector<texture> footsteps_images(const map_location& loc, const pathfind::marked_route & route_, const display_context * dc_);
game_display::game_display(
const filter_context& fc,
game_display::game_display(game_board& board,
std::weak_ptr<wb::manager> wb,
reports& reports_object,
const std::string& theme_id,
const config& level)
: display(&fc.get_disp_context(), wb, reports_object, theme_id, level)
, fc_(fc)
: display(&board, wb, reports_object, theme_id, level)
, overlay_map_()
, attack_indicator_src_()
, attack_indicator_dst_()
@ -94,8 +91,8 @@ game_display::~game_display()
void game_display::new_turn()
{
if(!first_turn_) {
const time_of_day& tod = fc_.get_tod_man().get_time_of_day();
const time_of_day& old_tod = fc_.get_tod_man().get_previous_time_of_day();
const time_of_day& tod = resources::tod_manager->get_time_of_day();
const time_of_day& old_tod = resources::tod_manager->get_previous_time_of_day();
if(old_tod.image_mask != tod.image_mask) {
fade_tod_mask(old_tod.image_mask, tod.image_mask);
@ -338,12 +335,12 @@ void game_display::draw_hex(const map_location& loc)
const time_of_day& game_display::get_time_of_day(const map_location& loc) const
{
return fc_.get_tod_man().get_time_of_day(loc);
return resources::tod_manager->get_time_of_day(loc);
}
bool game_display::has_time_area() const
{
return fc_.get_tod_man().has_time_area();
return resources::tod_manager->has_time_area();
}
void game_display::layout()

View file

@ -16,12 +16,13 @@
#pragma once
class config;
class filter_context;
class game_board;
#include "display.hpp"
#include "display_chat_manager.hpp"
#include "pathfind/pathfind.hpp"
// This needs to be separate from display.h because of the static
// singleton member, which will otherwise trigger link failure
// when building the editor.
@ -29,12 +30,11 @@ class filter_context;
class game_display : public display
{
public:
game_display(
const filter_context& fc,
std::weak_ptr<wb::manager> wb,
reports & reports_object,
const std::string& theme_id,
const config& level);
game_display(game_board& board,
std::weak_ptr<wb::manager> wb,
reports & reports_object,
const std::string& theme_id,
const config& level);
~game_display();
@ -231,8 +231,6 @@ public:
bool maybe_rebuild();
private:
const filter_context& fc_;
overlay_map overlay_map_;
// Locations of the attack direction indicator's parts

View file

@ -239,7 +239,7 @@ void play_controller::init(const config& level)
LOG_NG << "building terrain rules... " << (SDL_GetTicks() - ticks());
gui2::dialogs::loading_screen::progress(loading_stage::build_terrain);
gui_.reset(new game_display(gamestate(), whiteboard_manager_, *gamestate().reports_, theme(), level));
gui_.reset(new game_display(gamestate().board_, whiteboard_manager_, *gamestate().reports_, theme(), level));
map_start_ = map_location(level.child_or_empty("display").child_or_empty("location"));
if(start_faded_) {
gui_->set_fade({0,0,0,255});