Call display method instead of game_display if latter doesn't override
The proliferation of game_display::get_singleton() was due to 786233d5c9
where I replaced resources::screen (itself a game_display* pointer) with the game_display singleton.
Using the game_display pointer has already caused one case of UB (issue #2447), so I figured it best to
call the base class pointer in all cases where a game_display-specific function or override was not used.
This commit is contained in:
parent
b04bc7d7b0
commit
574fd0ec4b
30 changed files with 143 additions and 145 deletions
|
@ -142,11 +142,11 @@ namespace
|
|||
animator.start_animations();
|
||||
animator.wait_for_end();
|
||||
animator.set_all_standing();
|
||||
game_display::get_singleton()->invalidate(loc);
|
||||
display::get_singleton()->invalidate(loc);
|
||||
events::pump();
|
||||
}
|
||||
|
||||
game_display::get_singleton()->invalidate_all();
|
||||
display::get_singleton()->invalidate_all();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -963,7 +963,7 @@ void attack::fire_event(const std::string& n)
|
|||
actions::recalculate_fog(defender_side);
|
||||
|
||||
if(update_display_) {
|
||||
game_display::get_singleton()->redraw_minimap();
|
||||
display::get_singleton()->redraw_minimap();
|
||||
}
|
||||
|
||||
fire_event("attack_end");
|
||||
|
@ -1227,7 +1227,7 @@ void attack::unit_killed(unit_info& attacker,
|
|||
attacker.xp_ = game_config::kill_xp(defender.get_unit().level());
|
||||
defender.xp_ = 0;
|
||||
|
||||
game_display::get_singleton()->invalidate(attacker.loc_);
|
||||
display::get_singleton()->invalidate(attacker.loc_);
|
||||
|
||||
game_events::entity_location death_loc(defender.loc_, defender.id_);
|
||||
game_events::entity_location attacker_loc(attacker.loc_, attacker.id_);
|
||||
|
@ -1321,7 +1321,7 @@ void attack::unit_killed(unit_info& attacker,
|
|||
preferences::encountered_units().insert(newunit->type_id());
|
||||
|
||||
if(update_display_) {
|
||||
game_display::get_singleton()->invalidate(death_loc);
|
||||
display::get_singleton()->invalidate(death_loc);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -1450,7 +1450,7 @@ void attack::perform()
|
|||
|
||||
// TODO: if we knew the viewing team, we could skip this display update
|
||||
if(update_minimap_ && update_display_) {
|
||||
game_display::get_singleton()->redraw_minimap();
|
||||
display::get_singleton()->redraw_minimap();
|
||||
}
|
||||
|
||||
if(a_.valid()) {
|
||||
|
@ -1470,8 +1470,8 @@ void attack::perform()
|
|||
|
||||
if(update_display_) {
|
||||
game_display::get_singleton()->invalidate_unit();
|
||||
game_display::get_singleton()->invalidate(a_.loc_);
|
||||
game_display::get_singleton()->invalidate(d_.loc_);
|
||||
display::get_singleton()->invalidate(a_.loc_);
|
||||
display::get_singleton()->invalidate(d_.loc_);
|
||||
}
|
||||
|
||||
if(OOS_error_) {
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
#include "actions/vision.hpp"
|
||||
|
||||
#include "config.hpp"
|
||||
#include "display.hpp"
|
||||
#include "filter_context.hpp"
|
||||
#include "game_display.hpp"
|
||||
#include "game_events/pump.hpp"
|
||||
#include "game_state.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
|
@ -667,9 +667,9 @@ place_recruit_result place_recruit(unit_ptr u, const map_location &recruit_locat
|
|||
}
|
||||
// Make sure the unit appears (if either !show or the animation is suppressed).
|
||||
new_unit_itor->set_hidden(false);
|
||||
if ( game_display::get_singleton() != nullptr ) {
|
||||
game_display::get_singleton()->invalidate(current_loc);
|
||||
game_display::get_singleton()->redraw_minimap();
|
||||
if (display::get_singleton() != nullptr ) {
|
||||
display::get_singleton()->invalidate(current_loc);
|
||||
display::get_singleton()->redraw_minimap();
|
||||
}
|
||||
|
||||
// Village capturing.
|
||||
|
@ -728,8 +728,8 @@ void recruit_unit(const unit_type & u_type, int side_num, const map_location & l
|
|||
}
|
||||
|
||||
// Update the screen.
|
||||
if ( game_display::get_singleton() != nullptr )
|
||||
game_display::get_singleton()->invalidate_game_status();
|
||||
if (display::get_singleton() != nullptr )
|
||||
display::get_singleton()->invalidate_game_status();
|
||||
// Other updates were done by place_recruit().
|
||||
}
|
||||
|
||||
|
@ -775,8 +775,8 @@ bool recall_unit(const std::string & id, team & current_team,
|
|||
}
|
||||
|
||||
// Update the screen.
|
||||
if ( game_display::get_singleton() != nullptr )
|
||||
game_display::get_singleton()->invalidate_game_status();
|
||||
if (display::get_singleton() != nullptr )
|
||||
display::get_singleton()->invalidate_game_status();
|
||||
// Other updates were done by place_recruit().
|
||||
|
||||
return true;
|
||||
|
|
|
@ -347,7 +347,7 @@ void calculate_healing(int side, bool update_display)
|
|||
}
|
||||
|
||||
const team & viewing_team =
|
||||
resources::gameboard->teams()[game_display::get_singleton()->viewing_team()];
|
||||
resources::gameboard->teams()[display::get_singleton()->viewing_team()];
|
||||
if (!resources::controller->is_skipping_replay() && update_display &&
|
||||
patient.is_visible_to_team(viewing_team, *resources::gameboard, false) )
|
||||
{
|
||||
|
|
|
@ -174,8 +174,8 @@ game_events::pump_result_t get_village(const map_location& loc, int side, bool *
|
|||
}
|
||||
|
||||
if(not_defeated) {
|
||||
if (game_display::get_singleton() != nullptr) {
|
||||
game_display::get_singleton()->invalidate(loc);
|
||||
if (display::get_singleton() != nullptr) {
|
||||
display::get_singleton()->invalidate(loc);
|
||||
}
|
||||
return t->get_village(loc, old_owner_side, fire_event ? resources::gamedata : nullptr);
|
||||
}
|
||||
|
@ -348,7 +348,7 @@ namespace { // Private helpers for move_unit()
|
|||
: spectator_(move_spectator)
|
||||
, skip_sighting_(skip_sightings)
|
||||
, skip_ally_sighting_(skip_ally_sightings)
|
||||
, playing_team_is_viewing_(game_display::get_singleton()->playing_team() == game_display::get_singleton()->viewing_team() || game_display::get_singleton()->show_everything())
|
||||
, playing_team_is_viewing_(display::get_singleton()->playing_team() == display::get_singleton()->viewing_team() || display::get_singleton()->show_everything())
|
||||
, route_(route)
|
||||
, begin_(route.begin())
|
||||
, full_end_(route.end())
|
||||
|
@ -1106,7 +1106,7 @@ namespace { // Private helpers for move_unit()
|
|||
}
|
||||
|
||||
// Update the screen.
|
||||
game_display::get_singleton()->redraw_minimap();
|
||||
display::get_singleton()->redraw_minimap();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "actions/move.hpp" //for actions::get_village
|
||||
|
||||
#include "config.hpp"
|
||||
#include "display.hpp"
|
||||
#include "filter_context.hpp"
|
||||
#include "game_board.hpp"
|
||||
#include "game_events/pump.hpp"
|
||||
|
@ -31,14 +32,12 @@
|
|||
#include "log.hpp"
|
||||
#include "map/map.hpp"
|
||||
#include "pathfind/pathfind.hpp"
|
||||
#include "resources.hpp" // for game_display::get_singleton(), resources::gamedata
|
||||
#include "resources.hpp" // for resources::gamedata
|
||||
#include "team.hpp" //for team
|
||||
#include "units/unit.hpp" // for unit
|
||||
#include "units/udisplay.hpp" // for unit_display
|
||||
#include "variable.hpp" // for vconfig
|
||||
|
||||
#include "game_display.hpp" // for game_display::get_singleton()
|
||||
|
||||
static lg::log_domain log_engine("engine");
|
||||
#define DBG_NG LOG_STREAM(debug, log_engine)
|
||||
#define LOG_NG LOG_STREAM(info, log_engine)
|
||||
|
@ -221,7 +220,7 @@ void unit_creator::post_create(const map_location &loc, const unit &new_unit, bo
|
|||
preferences::encountered_units().insert(new_unit.type_id());
|
||||
}
|
||||
|
||||
bool show = show_ && (game_display::get_singleton() !=nullptr) && !game_display::get_singleton()->fogged(loc);
|
||||
bool show = show_ && (display::get_singleton() !=nullptr) && !display::get_singleton()->fogged(loc);
|
||||
bool animate = show && anim;
|
||||
|
||||
if (get_village_) {
|
||||
|
@ -236,10 +235,10 @@ void unit_creator::post_create(const map_location &loc, const unit &new_unit, bo
|
|||
resources::game_events->pump().fire("unit_placed", loc);
|
||||
}
|
||||
|
||||
if (game_display::get_singleton()!=nullptr) {
|
||||
if (display::get_singleton()!=nullptr) {
|
||||
|
||||
if (invalidate_ ) {
|
||||
game_display::get_singleton()->invalidate(loc);
|
||||
display::get_singleton()->invalidate(loc);
|
||||
}
|
||||
|
||||
if (animate) {
|
||||
|
|
|
@ -272,13 +272,13 @@ bool shroud_clearer::clear_loc(team &tm, const map_location &loc,
|
|||
|
||||
// Possible screen invalidation.
|
||||
if ( was_fogged ) {
|
||||
game_display::get_singleton()->invalidate(loc);
|
||||
display::get_singleton()->invalidate(loc);
|
||||
// Need to also invalidate adjacent hexes to get rid of the
|
||||
// "fog edge" graphics.
|
||||
map_location adjacent[6];
|
||||
get_adjacent_tiles(loc, adjacent);
|
||||
for ( int i = 0; i != 6; ++i )
|
||||
game_display::get_singleton()->invalidate(adjacent[i]);
|
||||
display::get_singleton()->invalidate(adjacent[i]);
|
||||
}
|
||||
|
||||
// Check for units?
|
||||
|
@ -336,8 +336,8 @@ bool shroud_clearer::clear_unit(const map_location &view_loc, team &view_team,
|
|||
move_unit_spectator * spectator, bool instant)
|
||||
{
|
||||
// Give animations a chance to progress; see bug #20324.
|
||||
if ( !instant && game_display::get_singleton() )
|
||||
game_display::get_singleton()->draw(true);
|
||||
if ( !instant && display::get_singleton() )
|
||||
display::get_singleton()->draw(true);
|
||||
|
||||
bool cleared_something = false;
|
||||
// Dummy variables to make some logic simpler.
|
||||
|
@ -351,15 +351,15 @@ bool shroud_clearer::clear_unit(const map_location &view_loc, team &view_team,
|
|||
if ( view_team_ != &view_team ) {
|
||||
calculate_jamming(&view_team);
|
||||
// Give animations a chance to progress; see bug #20324.
|
||||
if ( !instant && game_display::get_singleton() )
|
||||
game_display::get_singleton()->draw(true);
|
||||
if ( !instant && display::get_singleton() )
|
||||
display::get_singleton()->draw(true);
|
||||
}
|
||||
|
||||
// Determine the hexes to clear.
|
||||
pathfind::vision_path sight(costs, slowed, sight_range, view_loc, jamming_);
|
||||
// Give animations a chance to progress; see bug #20324.
|
||||
if ( !instant && game_display::get_singleton() )
|
||||
game_display::get_singleton()->draw(true);
|
||||
if ( !instant && display::get_singleton() )
|
||||
display::get_singleton()->draw(true);
|
||||
|
||||
// Clear the fog.
|
||||
for (const pathfind::paths::step &dest : sight.destinations) {
|
||||
|
@ -580,9 +580,9 @@ game_events::pump_result_t shroud_clearer::fire_events()
|
|||
*/
|
||||
void shroud_clearer::invalidate_after_clear()
|
||||
{
|
||||
game_display::get_singleton()->invalidate_game_status();
|
||||
game_display::get_singleton()->recalculate_minimap();
|
||||
game_display::get_singleton()->labels().recalculate_shroud();
|
||||
display::get_singleton()->invalidate_game_status();
|
||||
display::get_singleton()->recalculate_minimap();
|
||||
display::get_singleton()->labels().recalculate_shroud();
|
||||
// The tiles are invalidated as they are cleared, so no need
|
||||
// to invalidate them here.
|
||||
}
|
||||
|
@ -721,7 +721,7 @@ void recalculate_fog(int side)
|
|||
tm.refog();
|
||||
// Invalidate the screen before clearing the shroud.
|
||||
// This speeds up the invalidations within clear_shroud_unit().
|
||||
game_display::get_singleton()->invalidate_all();
|
||||
display::get_singleton()->invalidate_all();
|
||||
|
||||
shroud_clearer clearer;
|
||||
for (const unit &u : resources::gameboard->units())
|
||||
|
|
|
@ -326,7 +326,7 @@ game_info& readwrite_context_impl::get_info_w(){
|
|||
void readonly_context_impl::diagnostic(const std::string& msg)
|
||||
{
|
||||
if(game_config::debug) {
|
||||
game_display::get_singleton()->set_diagnostic(msg);
|
||||
display::get_singleton()->set_diagnostic(msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,9 +25,9 @@
|
|||
#include "ai/manager.hpp"
|
||||
#include "actions/attack.hpp"
|
||||
#include "attack_prediction.hpp"
|
||||
#include "display.hpp"
|
||||
#include "filter_context.hpp"
|
||||
#include "game_board.hpp"
|
||||
#include "game_display.hpp"
|
||||
#include "log.hpp"
|
||||
#include "map/map.hpp"
|
||||
#include "map/label.hpp"
|
||||
|
@ -732,10 +732,10 @@ void recruitment::show_important_hexes() const {
|
|||
if (!game_config::debug) {
|
||||
return;
|
||||
}
|
||||
game_display::get_singleton()->labels().clear_all();
|
||||
display::get_singleton()->labels().clear_all();
|
||||
for (const map_location& loc : important_hexes_) {
|
||||
// Little hack: use map_location north from loc and make 2 linebreaks to center the "X".
|
||||
game_display::get_singleton()->labels().set_label(loc.get_direction(map_location::NORTH), "\n\nX");
|
||||
display::get_singleton()->labels().set_label(loc.get_direction(map_location::NORTH), "\n\nX");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ void editor_action_item_replace::perform_without_undo(map_context& /*mc*/) const
|
|||
//
|
||||
////TODO check if that is useful
|
||||
//// game_display::get_singleton()->invalidate_item_after_move(loc_, new_loc_);
|
||||
//// game_display::get_singleton()->draw();
|
||||
//// display::get_singleton()->draw();
|
||||
}
|
||||
|
||||
IMPLEMENT_ACTION(item_facing)
|
||||
|
|
|
@ -104,7 +104,7 @@ void editor_action_unit_replace::perform_without_undo(map_context& mc) const
|
|||
|
||||
// TODO check if that is useful
|
||||
// game_display::get_singleton()->invalidate_unit_after_move(loc_, new_loc_);
|
||||
// game_display::get_singleton()->draw();
|
||||
// display::get_singleton()->draw();
|
||||
}
|
||||
|
||||
IMPLEMENT_ACTION(unit_facing)
|
||||
|
|
|
@ -634,7 +634,7 @@ WML_HANDLER_FUNCTION(replace_map,, cfg)
|
|||
lg::wml_error() << *errmsg << std::endl;
|
||||
}
|
||||
|
||||
game_display::get_singleton()->reload_map();
|
||||
display::get_singleton()->reload_map();
|
||||
game_display::get_singleton()->needs_rebuild(true);
|
||||
ai::manager::get_singleton().raise_map_changed();
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include <vector>
|
||||
#include "utils/functional.hpp"
|
||||
#include "gettext.hpp"
|
||||
#include "game_display.hpp"
|
||||
#include "display.hpp"
|
||||
#include "font/text_formatting.hpp"
|
||||
#include "map/label.hpp"
|
||||
#include "gui/auxiliary/find_widget.hpp"
|
||||
|
@ -42,7 +42,7 @@ namespace dialogs
|
|||
REGISTER_DIALOG(label_settings)
|
||||
|
||||
label_settings::label_settings(display_context& dc) : viewer(dc) {
|
||||
const std::vector<std::string>& all_categories = game_display::get_singleton()->labels().all_categories();
|
||||
const std::vector<std::string>& all_categories = display::get_singleton()->labels().all_categories();
|
||||
const std::vector<std::string>& hidden_categories = viewer.hidden_label_categories();
|
||||
|
||||
for(size_t i = 0; i < all_categories.size(); i++) {
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
#include "pathfind/pathfind.hpp"
|
||||
#include "pathfind/teleport.hpp"
|
||||
|
||||
#include "display.hpp"
|
||||
#include "game_board.hpp"
|
||||
#include "game_display.hpp"
|
||||
#include "gettext.hpp"
|
||||
#include "log.hpp"
|
||||
#include "map/map.hpp"
|
||||
|
@ -586,7 +586,7 @@ vision_path::vision_path(const unit& viewer, const map_location& loc,
|
|||
|
||||
// The three nullptr parameters indicate (in order):
|
||||
// ignore units, ignore ZoC (no effect), and don't build a cost_map.
|
||||
const team& viewing_team = resources::gameboard->teams()[game_display::get_singleton()->viewing_team()];
|
||||
const team& viewing_team = resources::gameboard->teams()[display::get_singleton()->viewing_team()];
|
||||
find_routes(loc, viewer.movement_type().get_vision(),
|
||||
viewer.get_state(unit::STATE_SLOWED), sight_range, sight_range,
|
||||
0, destinations, &edges, &viewer, nullptr, nullptr, &viewing_team, &jamming_map, nullptr, true);
|
||||
|
@ -610,7 +610,7 @@ vision_path::vision_path(const movetype::terrain_costs & view_costs, bool slowed
|
|||
{
|
||||
// The three nullptr parameters indicate (in order):
|
||||
// ignore units, ignore ZoC (no effect), and don't build a cost_map.
|
||||
const team& viewing_team = resources::gameboard->teams()[game_display::get_singleton()->viewing_team()];
|
||||
const team& viewing_team = resources::gameboard->teams()[display::get_singleton()->viewing_team()];
|
||||
const unit_map::const_iterator u = resources::gameboard->units().find(loc);
|
||||
find_routes(loc, view_costs, slowed, sight_range, sight_range, 0,
|
||||
destinations, &edges, u.valid() ? &*u : nullptr, nullptr, nullptr, &viewing_team, &jamming_map, nullptr, true);
|
||||
|
@ -673,7 +673,7 @@ marked_route mark_route(const plain_route &rt)
|
|||
assert(last_step || resources::gameboard->map().on_board(*(i+1)));
|
||||
const int move_cost = last_step ? 0 : u.movement_cost((resources::gameboard->map())[*(i+1)]);
|
||||
|
||||
const team& viewing_team = resources::gameboard->teams()[game_display::get_singleton()->viewing_team()];
|
||||
const team& viewing_team = resources::gameboard->teams()[display::get_singleton()->viewing_team()];
|
||||
|
||||
if (last_step || zoc || move_cost > movement) {
|
||||
// check if we stop an a village and so maybe capture it
|
||||
|
|
|
@ -186,19 +186,19 @@ turn_info::PROCESS_DATA_RESULT turn_info::process_network_data(const config& cfg
|
|||
resources::controller->on_not_observer();
|
||||
}
|
||||
|
||||
if (resources::gameboard->is_observer() || (resources::gameboard->teams())[game_display::get_singleton()->playing_team()].is_local_human()) {
|
||||
game_display::get_singleton()->set_team(game_display::get_singleton()->playing_team());
|
||||
game_display::get_singleton()->redraw_everything();
|
||||
game_display::get_singleton()->recalculate_minimap();
|
||||
if (resources::gameboard->is_observer() || (resources::gameboard->teams())[display::get_singleton()->playing_team()].is_local_human()) {
|
||||
display::get_singleton()->set_team(display::get_singleton()->playing_team());
|
||||
display::get_singleton()->redraw_everything();
|
||||
display::get_singleton()->recalculate_minimap();
|
||||
} else if (tm.is_local_human()) {
|
||||
game_display::get_singleton()->set_team(side - 1);
|
||||
game_display::get_singleton()->redraw_everything();
|
||||
game_display::get_singleton()->recalculate_minimap();
|
||||
display::get_singleton()->set_team(side - 1);
|
||||
display::get_singleton()->redraw_everything();
|
||||
display::get_singleton()->recalculate_minimap();
|
||||
}
|
||||
|
||||
resources::whiteboard->on_change_controller(side,tm);
|
||||
|
||||
game_display::get_singleton()->labels().recalculate_labels();
|
||||
display::get_singleton()->labels().recalculate_labels();
|
||||
|
||||
const bool restart = game_display::get_singleton()->playing_side() == side && (was_local || tm.is_local());
|
||||
return restart ? PROCESS_RESTART_TURN : PROCESS_CONTINUE;
|
||||
|
@ -347,7 +347,7 @@ turn_info::PROCESS_DATA_RESULT turn_info::process_network_data(const config& cfg
|
|||
// The host has ended linger mode in a campaign -> enable the "End scenario" button
|
||||
// and tell we did get the notification.
|
||||
else if (cfg.child("notify_next_scenario")) {
|
||||
std::shared_ptr<gui::button> btn_end = game_display::get_singleton()->find_action_button("button-endturn");
|
||||
std::shared_ptr<gui::button> btn_end = display::get_singleton()->find_action_button("button-endturn");
|
||||
if(btn_end) {
|
||||
btn_end->enable(true);
|
||||
}
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include "log.hpp"
|
||||
#include "play_controller.hpp"
|
||||
#include "game_data.hpp"
|
||||
#include "game_display.hpp"
|
||||
#include "game_config_manager.hpp"
|
||||
#include "resources.hpp"
|
||||
|
||||
|
@ -126,8 +125,8 @@ bool show_theme_dialog()
|
|||
|
||||
if (action >= 0) {
|
||||
preferences::set_theme(themes[action].id);
|
||||
if(game_display::get_singleton() && resources::controller && resources::gamedata && resources::gamedata->get_theme().empty()) {
|
||||
game_display::get_singleton()->set_theme(resources::controller->get_theme(game_config_manager::get()->game_config(), themes[action].id));
|
||||
if(display::get_singleton() && resources::controller && resources::gamedata && resources::gamedata->get_theme().empty()) {
|
||||
display::get_singleton()->set_theme(resources::controller->get_theme(game_config_manager::get()->game_config(), themes[action].id));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -674,7 +674,7 @@ REPLAY_RETURN do_replay(bool one_move)
|
|||
log_scope("do replay");
|
||||
|
||||
if (!resources::controller->is_skipping_replay()) {
|
||||
game_display::get_singleton()->recalculate_minimap();
|
||||
display::get_singleton()->recalculate_minimap();
|
||||
}
|
||||
|
||||
update_locker lock_update(CVideo::get_singleton(), resources::controller->is_skipping_replay());
|
||||
|
@ -744,9 +744,9 @@ REPLAY_RETURN do_replay_handle(bool one_move)
|
|||
}
|
||||
else if (const config &label_config = cfg->child("label"))
|
||||
{
|
||||
terrain_label label(game_display::get_singleton()->labels(), label_config);
|
||||
terrain_label label(display::get_singleton()->labels(), label_config);
|
||||
|
||||
game_display::get_singleton()->labels().set_label(label.location(),
|
||||
display::get_singleton()->labels().set_label(label.location(),
|
||||
label.text(),
|
||||
label.creator(),
|
||||
label.team_name(),
|
||||
|
@ -754,7 +754,7 @@ REPLAY_RETURN do_replay_handle(bool one_move)
|
|||
}
|
||||
else if (const config &clear_labels = cfg->child("clear_labels"))
|
||||
{
|
||||
game_display::get_singleton()->labels().clear(std::string(clear_labels["team_name"]), clear_labels["force"].to_bool());
|
||||
display::get_singleton()->labels().clear(std::string(clear_labels["team_name"]), clear_labels["force"].to_bool());
|
||||
}
|
||||
else if (const config &rename = cfg->child("rename"))
|
||||
{
|
||||
|
|
|
@ -394,7 +394,7 @@ namespace
|
|||
symbols["player"] = resources::controller->current_team().current_player();
|
||||
display::announce_options announce_options;
|
||||
announce_options.lifetime = 1000;
|
||||
game_display::get_singleton()->announce(vgettext(message, symbols), font::NORMAL_COLOR, announce_options);
|
||||
display::get_singleton()->announce(vgettext(message, symbols), font::NORMAL_COLOR, announce_options);
|
||||
}
|
||||
}
|
||||
SYNCED_COMMAND_HANDLER_FUNCTION(debug_unit, child, use_undo, /*show*/, /*error_handler*/)
|
||||
|
@ -456,7 +456,7 @@ SYNCED_COMMAND_HANDLER_FUNCTION(debug_unit, child, use_undo, /*show*/, /*error_
|
|||
if (name == "fail") { //testcase for bug #18488
|
||||
assert(i.valid());
|
||||
}
|
||||
game_display::get_singleton()->invalidate(loc);
|
||||
display::get_singleton()->invalidate(loc);
|
||||
game_display::get_singleton()->invalidate_unit();
|
||||
|
||||
return true;
|
||||
|
@ -535,7 +535,7 @@ SYNCED_COMMAND_HANDLER_FUNCTION(debug_kill, child, use_undo, /*show*/, /*error_h
|
|||
if (i.valid()) {
|
||||
unit_display::unit_die(loc, *i);
|
||||
}
|
||||
game_display::get_singleton()->redraw_minimap();
|
||||
display::get_singleton()->redraw_minimap();
|
||||
if (i.valid()) {
|
||||
i->set_hitpoints(0);
|
||||
}
|
||||
|
@ -582,7 +582,7 @@ SYNCED_COMMAND_HANDLER_FUNCTION(debug_turn_limit, child, use_undo, /*show*/, /*e
|
|||
debug_notification(":turn_limit debug command was used during turn of $player");
|
||||
|
||||
resources::tod_manager->set_number_of_turns(child["turn_limit"].to_int(-1));
|
||||
game_display::get_singleton()->redraw_everything();
|
||||
display::get_singleton()->redraw_everything();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -597,7 +597,7 @@ SYNCED_COMMAND_HANDLER_FUNCTION(debug_turn, child, use_undo, /*show*/, /*error_h
|
|||
resources::tod_manager->set_turn(child["turn"].to_int(1), resources::gamedata);
|
||||
|
||||
game_display::get_singleton()->new_turn();
|
||||
game_display::get_singleton()->redraw_everything();
|
||||
display::get_singleton()->redraw_everything();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -629,7 +629,7 @@ SYNCED_COMMAND_HANDLER_FUNCTION(debug_gold, child, use_undo, /*show*/, /*error_h
|
|||
debug_notification(":gold debug command was used during turn of $player");
|
||||
|
||||
resources::controller->current_team().spend_gold(-child["gold"].to_int(0));
|
||||
game_display::get_singleton()->redraw_everything();
|
||||
display::get_singleton()->redraw_everything();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -643,7 +643,7 @@ SYNCED_COMMAND_HANDLER_FUNCTION(debug_event, child, use_undo, /*show*/, /*error_
|
|||
debug_notification(":throw debug command was used during turn of $player");
|
||||
|
||||
resources::controller->pump().fire(child["eventname"]);
|
||||
game_display::get_singleton()->redraw_everything();
|
||||
display::get_singleton()->redraw_everything();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -661,8 +661,8 @@ SYNCED_COMMAND_HANDLER_FUNCTION(debug_fog, /*child*/, use_undo, /*show*/, /*erro
|
|||
current_team.set_fog(!current_team.uses_fog());
|
||||
actions::recalculate_fog(current_team.side());
|
||||
|
||||
game_display::get_singleton()->recalculate_minimap();
|
||||
game_display::get_singleton()->redraw_everything();
|
||||
display::get_singleton()->recalculate_minimap();
|
||||
display::get_singleton()->redraw_everything();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -680,8 +680,8 @@ SYNCED_COMMAND_HANDLER_FUNCTION(debug_shroud, /*child*/, use_undo, /*show*/, /*e
|
|||
current_team.set_shroud(!current_team.uses_shroud());
|
||||
actions::clear_shroud(current_team.side());
|
||||
|
||||
game_display::get_singleton()->recalculate_minimap();
|
||||
game_display::get_singleton()->redraw_everything();
|
||||
display::get_singleton()->recalculate_minimap();
|
||||
display::get_singleton()->redraw_everything();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
#include "synced_user_choice.hpp"
|
||||
|
||||
#include "actions/undo.hpp"
|
||||
#include "display.hpp"
|
||||
#include "floating_label.hpp"
|
||||
#include "game_display.hpp"
|
||||
#include "game_data.hpp"
|
||||
#include "log.hpp"
|
||||
#include "play_controller.hpp"
|
||||
|
@ -79,7 +79,7 @@ namespace
|
|||
void start_show_label()
|
||||
{
|
||||
assert(label_id_ == -1);
|
||||
SDL_Rect area = game_display::get_singleton()->map_outside_area();
|
||||
SDL_Rect area = display::get_singleton()->map_outside_area();
|
||||
font::floating_label flabel(message_);
|
||||
flabel.set_font_size(font::SIZE_XLARGE);
|
||||
flabel.set_color(font::NORMAL_COLOR);
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
|
||||
#include "units/animation.hpp"
|
||||
|
||||
#include "display.hpp"
|
||||
#include "filter_context.hpp"
|
||||
#include "game_display.hpp"
|
||||
#include "map/map.hpp"
|
||||
#include "play_controller.hpp"
|
||||
#include "resources.hpp"
|
||||
|
@ -1003,7 +1003,7 @@ bool unit_animation::animation_finished_potential() const
|
|||
|
||||
void unit_animation::update_last_draw_time()
|
||||
{
|
||||
double acceleration = unit_anim_.accelerate ? game_display::get_singleton()->turbo_speed() : 1.0;
|
||||
double acceleration = unit_anim_.accelerate ? display::get_singleton()->turbo_speed() : 1.0;
|
||||
unit_anim_.update_last_draw_time(acceleration);
|
||||
for(auto& anim : sub_anims_) {
|
||||
anim.second.update_last_draw_time(acceleration);
|
||||
|
|
|
@ -553,7 +553,7 @@ void unit_frame::redraw(const int frame_time, bool on_start_time, bool in_scope_
|
|||
my_y -= current_data.directional_y;
|
||||
}
|
||||
|
||||
game_display::get_singleton()->render_image(my_x, my_y,
|
||||
display::get_singleton()->render_image(my_x, my_y,
|
||||
static_cast<display::drawing_layer>(display::LAYER_UNIT_FIRST + current_data.drawing_layer),
|
||||
src, image, facing_west, false,
|
||||
ftofxp(current_data.highlight_ratio), current_data.blend_with ? *current_data.blend_with : color_t(),
|
||||
|
@ -604,16 +604,16 @@ void unit_frame::redraw(const int frame_time, bool on_start_time, bool in_scope_
|
|||
|
||||
if(direction != map_location::SOUTH_WEST && direction != map_location::NORTH_WEST) {
|
||||
halo_id = halo_man.add(
|
||||
static_cast<int>(x + current_data.halo_x * game_display::get_singleton()->get_zoom_factor()),
|
||||
static_cast<int>(y + current_data.halo_y * game_display::get_singleton()->get_zoom_factor()),
|
||||
static_cast<int>(x + current_data.halo_x * display::get_singleton()->get_zoom_factor()),
|
||||
static_cast<int>(y + current_data.halo_y * display::get_singleton()->get_zoom_factor()),
|
||||
current_data.halo + current_data.halo_mod,
|
||||
map_location(-1, -1),
|
||||
orientation
|
||||
);
|
||||
} else {
|
||||
halo_id = halo_man.add(
|
||||
static_cast<int>(x - current_data.halo_x * game_display::get_singleton()->get_zoom_factor()),
|
||||
static_cast<int>(y + current_data.halo_y * game_display::get_singleton()->get_zoom_factor()),
|
||||
static_cast<int>(x - current_data.halo_x * display::get_singleton()->get_zoom_factor()),
|
||||
static_cast<int>(y + current_data.halo_y * display::get_singleton()->get_zoom_factor()),
|
||||
current_data.halo + current_data.halo_mod,
|
||||
map_location(-1, -1),
|
||||
orientation
|
||||
|
@ -635,7 +635,7 @@ std::set<map_location> unit_frame::get_overlaped_hex(const int frame_time, const
|
|||
const frame_parameters current_data = merge_parameters(frame_time, animation_val, engine_val);
|
||||
|
||||
double tmp_offset = current_data.offset;
|
||||
const int d2 = game_display::get_singleton()->hex_size() / 2;
|
||||
const int d2 = display::get_singleton()->hex_size() / 2;
|
||||
|
||||
image::locator image_loc;
|
||||
if(direction != map_location::NORTH && direction != map_location::SOUTH) {
|
||||
|
|
|
@ -86,7 +86,7 @@ attack::attack(const config& cfg, bool hidden)
|
|||
|
||||
void attack::init()
|
||||
{
|
||||
game_display::get_singleton()->invalidate(target_hex_);
|
||||
display::get_singleton()->invalidate(target_hex_);
|
||||
}
|
||||
|
||||
attack::~attack()
|
||||
|
@ -102,11 +102,11 @@ void attack::accept(visitor& v)
|
|||
/* private */
|
||||
void attack::invalidate()
|
||||
{
|
||||
if(game_display::get_singleton())
|
||||
if(display::get_singleton())
|
||||
{
|
||||
//invalidate dest and target hex so attack indicator is properly cleared
|
||||
game_display::get_singleton()->invalidate(get_dest_hex());
|
||||
game_display::get_singleton()->invalidate(target_hex_);
|
||||
display::get_singleton()->invalidate(get_dest_hex());
|
||||
display::get_singleton()->invalidate(target_hex_);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -200,18 +200,18 @@ void attack::draw_hex(const map_location& hex)
|
|||
|
||||
if (hex == get_dest_hex()) //add symbol to attacker hex
|
||||
{
|
||||
int xpos = game_display::get_singleton()->get_location_x(get_dest_hex());
|
||||
int ypos = game_display::get_singleton()->get_location_y(get_dest_hex());
|
||||
int xpos = display::get_singleton()->get_location_x(get_dest_hex());
|
||||
int ypos = display::get_singleton()->get_location_y(get_dest_hex());
|
||||
|
||||
game_display::get_singleton()->drawing_buffer_add(layer, get_dest_hex(), xpos, ypos,
|
||||
display::get_singleton()->drawing_buffer_add(layer, get_dest_hex(), xpos, ypos,
|
||||
image::get_image("whiteboard/attack-indicator-src-" + direction_text + ".png", image::SCALED_TO_HEX));
|
||||
}
|
||||
else if (hex == target_hex_) //add symbol to defender hex
|
||||
{
|
||||
int xpos = game_display::get_singleton()->get_location_x(target_hex_);
|
||||
int ypos = game_display::get_singleton()->get_location_y(target_hex_);
|
||||
int xpos = display::get_singleton()->get_location_x(target_hex_);
|
||||
int ypos = display::get_singleton()->get_location_y(target_hex_);
|
||||
|
||||
game_display::get_singleton()->drawing_buffer_add(layer, target_hex_, xpos, ypos,
|
||||
display::get_singleton()->drawing_buffer_add(layer, target_hex_, xpos, ypos,
|
||||
image::get_image("whiteboard/attack-indicator-dst-" + direction_text + ".png", image::SCALED_TO_HEX));
|
||||
}
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ void attack::draw_hex(const map_location& hex)
|
|||
void attack::redraw()
|
||||
{
|
||||
move::redraw();
|
||||
game_display::get_singleton()->invalidate(target_hex_);
|
||||
display::get_singleton()->invalidate(target_hex_);
|
||||
}
|
||||
|
||||
action::error attack::check_validity() const
|
||||
|
|
|
@ -146,7 +146,7 @@ void highlighter::highlight()
|
|||
find_secondary_highlights();
|
||||
|
||||
//Make sure owner unit is the only one displayed in its hex
|
||||
game_display::get_singleton()->add_exclusive_draw(owner_unit_->get_location(), *owner_unit_);
|
||||
display::get_singleton()->add_exclusive_draw(owner_unit_->get_location(), *owner_unit_);
|
||||
exclusive_display_hexes_.insert(owner_unit_->get_location());
|
||||
|
||||
if(!secondary_highlights_.empty()) {
|
||||
|
@ -179,7 +179,7 @@ void highlighter::unhighlight()
|
|||
|
||||
//unhide other units if needed
|
||||
for(map_location hex : exclusive_display_hexes_) {
|
||||
game_display::get_singleton()->remove_exclusive_draw(hex);
|
||||
display::get_singleton()->remove_exclusive_draw(hex);
|
||||
}
|
||||
exclusive_display_hexes_.clear();
|
||||
}
|
||||
|
@ -225,7 +225,7 @@ void highlighter::find_main_highlight()
|
|||
assert(main_highlight_.expired());
|
||||
//@todo re-enable the following assert once I find out what happends to
|
||||
// viewing side assignments after victory
|
||||
//assert(side_actions_->team_index() == game_display::get_singleton()->viewing_team());
|
||||
//assert(side_actions_->team_index() == display::get_singleton()->viewing_team());
|
||||
|
||||
main_highlight_ = find_action_at(mouseover_hex_);
|
||||
if(action_ptr main = main_highlight_.lock()) {
|
||||
|
@ -293,7 +293,7 @@ void highlighter::highlight_main_visitor::visit(move_ptr move)
|
|||
///@todo find some highlight animation
|
||||
move->get_fake_unit()->anim_comp().set_ghosted(true);
|
||||
//Make sure the fake unit is the only one displayed in its hex
|
||||
game_display::get_singleton()->add_exclusive_draw(move->get_fake_unit()->get_location(), *move->get_fake_unit());
|
||||
display::get_singleton()->add_exclusive_draw(move->get_fake_unit()->get_location(), *move->get_fake_unit());
|
||||
highlighter_.exclusive_display_hexes_.insert(move->get_fake_unit()->get_location());
|
||||
|
||||
highlighter_.last_action_redraw(move);
|
||||
|
@ -312,7 +312,7 @@ void highlighter::highlight_main_visitor::visit(recruit_ptr recruit)
|
|||
///@todo: find some suitable effect for mouseover on planned recruit.
|
||||
|
||||
//Make sure the fake unit is the only one displayed in its hex
|
||||
game_display::get_singleton()->add_exclusive_draw(recruit->get_fake_unit()->get_location(), *recruit->get_fake_unit());
|
||||
display::get_singleton()->add_exclusive_draw(recruit->get_fake_unit()->get_location(), *recruit->get_fake_unit());
|
||||
highlighter_.exclusive_display_hexes_.insert(recruit->get_fake_unit()->get_location());
|
||||
}
|
||||
}
|
||||
|
@ -325,7 +325,7 @@ void highlighter::highlight_secondary_visitor::visit(move_ptr move)
|
|||
if(move->get_fake_unit()) {
|
||||
move->get_fake_unit()->anim_comp().set_ghosted(true);
|
||||
//Make sure the fake unit is the only one displayed in its hex
|
||||
game_display::get_singleton()->add_exclusive_draw(move->get_fake_unit()->get_location(), *move->get_fake_unit());
|
||||
display::get_singleton()->add_exclusive_draw(move->get_fake_unit()->get_location(), *move->get_fake_unit());
|
||||
highlighter_.exclusive_display_hexes_.insert(move->get_fake_unit()->get_location());
|
||||
|
||||
highlighter_.last_action_redraw(move);
|
||||
|
@ -360,7 +360,7 @@ void highlighter::unhighlight_visitor::visit(recall_ptr recall)
|
|||
//@todo: find some suitable effect for mouseover on planned recall.
|
||||
|
||||
//Make sure the fake unit is the only one displayed in its hex
|
||||
game_display::get_singleton()->add_exclusive_draw(recall->get_fake_unit()->get_location(), *recall->get_fake_unit());
|
||||
display::get_singleton()->add_exclusive_draw(recall->get_fake_unit()->get_location(), *recall->get_fake_unit());
|
||||
highlighter_.exclusive_display_hexes_.insert(recall->get_fake_unit()->get_location());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ manager::~manager()
|
|||
#if 0
|
||||
static void print_to_chat(const std::string& title, const std::string& message)
|
||||
{
|
||||
game_display::get_singleton()->add_chat_message(time(nullptr), title, 0, message,
|
||||
display::get_singleton()->add_chat_message(time(nullptr), title, 0, message,
|
||||
events::chat_handler::MESSAGE_PRIVATE, false);
|
||||
}
|
||||
#endif
|
||||
|
@ -469,7 +469,7 @@ static void draw_numbers(const map_location& hex, side_actions::numbers_t number
|
|||
color_t color = team::get_side_color(static_cast<int>(team_numbers[i]+1));
|
||||
const double x_in_hex = x_origin + x_offset;
|
||||
const double y_in_hex = y_origin + y_offset;
|
||||
game_display::get_singleton()->draw_text_in_hex(hex, display::LAYER_ACTIONS_NUMBERING,
|
||||
display::get_singleton()->draw_text_in_hex(hex, display::LAYER_ACTIONS_NUMBERING,
|
||||
number_text, font_size, color, x_in_hex, y_in_hex);
|
||||
x_offset += x_offset_base;
|
||||
y_offset += y_offset_base;
|
||||
|
@ -601,7 +601,7 @@ void manager::on_gamestate_change()
|
|||
// Set mutated flag so action queue gets validated on next future map build
|
||||
gamestate_mutated_ = true;
|
||||
//Clear exclusive draws that might not get a chance to be cleared the normal way
|
||||
game_display::get_singleton()->clear_exclusive_draws();
|
||||
display::get_singleton()->clear_exclusive_draws();
|
||||
}
|
||||
|
||||
void manager::send_network_data()
|
||||
|
@ -669,7 +669,7 @@ void manager::create_temp_move()
|
|||
if (!temp_moved_unit) temp_moved_unit =
|
||||
future_visible_unit(resources::controller->get_mouse_handler_base().get_last_hex(), viewer_side());
|
||||
if (!temp_moved_unit) return;
|
||||
if (temp_moved_unit->side() != game_display::get_singleton()->viewing_side()) return;
|
||||
if (temp_moved_unit->side() != display::get_singleton()->viewing_side()) return;
|
||||
|
||||
/*
|
||||
* DONE CHECKING PRE-CONDITIONS, CREATE THE TEMP MOVE
|
||||
|
@ -847,8 +847,8 @@ void manager::save_temp_attack(const map_location& attacker_loc, const map_locat
|
|||
|
||||
print_help_once();
|
||||
|
||||
game_display::get_singleton()->invalidate(defender_loc);
|
||||
game_display::get_singleton()->invalidate(attacker_loc);
|
||||
display::get_singleton()->invalidate(defender_loc);
|
||||
display::get_singleton()->invalidate(attacker_loc);
|
||||
erase_temp_move();
|
||||
LOG_WB << *viewer_actions() << "\n";
|
||||
}
|
||||
|
@ -859,7 +859,7 @@ bool manager::save_recruit(const std::string& name, int side_num, const map_loca
|
|||
bool created_planned_recruit = false;
|
||||
|
||||
if (active_ && !executing_actions_ && !resources::controller->is_linger_mode()) {
|
||||
if (side_num != game_display::get_singleton()->viewing_side())
|
||||
if (side_num != display::get_singleton()->viewing_side())
|
||||
{
|
||||
LOG_WB <<"manager::save_recruit called for a different side than viewing side.\n";
|
||||
created_planned_recruit = false;
|
||||
|
@ -888,7 +888,7 @@ bool manager::save_recall(const unit& unit, int side_num, const map_location& re
|
|||
|
||||
if (active_ && !executing_actions_ && !resources::controller->is_linger_mode())
|
||||
{
|
||||
if (side_num != game_display::get_singleton()->viewing_side())
|
||||
if (side_num != display::get_singleton()->viewing_side())
|
||||
{
|
||||
LOG_WB <<"manager::save_recall called for a different side than viewing side.\n";
|
||||
created_planned_recall = false;
|
||||
|
|
|
@ -391,7 +391,7 @@ void move::draw_hex(const map_location& hex)
|
|||
{
|
||||
std::stringstream turn_text;
|
||||
turn_text << turn_number_;
|
||||
game_display::get_singleton()->draw_text_in_hex(hex, display::LAYER_MOVE_INFO, turn_text.str(), 17, font::NORMAL_COLOR, 0.5,0.8);
|
||||
display::get_singleton()->draw_text_in_hex(hex, display::LAYER_MOVE_INFO, turn_text.str(), 17, font::NORMAL_COLOR, 0.5,0.8);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -537,7 +537,7 @@ void move::calculate_move_cost()
|
|||
|
||||
// @todo: find a better treatment of movement points when defining moves out-of-turn
|
||||
if(get_unit()->movement_left() - route_->move_cost < 0
|
||||
&& resources::controller->current_side() == game_display::get_singleton()->viewing_side()) {
|
||||
&& resources::controller->current_side() == display::get_singleton()->viewing_side()) {
|
||||
WRN_WB << "Move defined with insufficient movement left." << std::endl;
|
||||
}
|
||||
|
||||
|
@ -555,8 +555,8 @@ void move::calculate_move_cost()
|
|||
|
||||
void move::redraw()
|
||||
{
|
||||
game_display::get_singleton()->invalidate(get_source_hex());
|
||||
game_display::get_singleton()->invalidate(get_dest_hex());
|
||||
display::get_singleton()->invalidate(get_source_hex());
|
||||
display::get_singleton()->invalidate(get_dest_hex());
|
||||
update_arrow_style();
|
||||
}
|
||||
|
||||
|
|
|
@ -24,10 +24,10 @@
|
|||
#include "whiteboard/visitor.hpp"
|
||||
|
||||
#include "actions/create.hpp"
|
||||
#include "display.hpp"
|
||||
#include "fake_unit_manager.hpp"
|
||||
#include "fake_unit_ptr.hpp"
|
||||
#include "game_board.hpp"
|
||||
#include "game_display.hpp"
|
||||
#include "recall_list_manager.hpp"
|
||||
#include "resources.hpp"
|
||||
#include "replay_helper.hpp"
|
||||
|
@ -161,7 +161,7 @@ void recall::apply_temp_modifier(unit_map& unit_map)
|
|||
|
||||
resources::gameboard->teams().at(team_index()).get_side_actions()->change_gold_spent_by(cost);
|
||||
// Update gold in top bar
|
||||
game_display::get_singleton()->invalidate_game_status();
|
||||
display::get_singleton()->invalidate_game_status();
|
||||
}
|
||||
|
||||
void recall::remove_temp_modifier(unit_map& unit_map)
|
||||
|
@ -191,14 +191,14 @@ void recall::draw_hex(const map_location& hex)
|
|||
}
|
||||
size_t font_size = 16;
|
||||
color_t color {255, 0, 0}; //red
|
||||
game_display::get_singleton()->draw_text_in_hex(hex, display::LAYER_ACTIONS_NUMBERING,
|
||||
display::get_singleton()->draw_text_in_hex(hex, display::LAYER_ACTIONS_NUMBERING,
|
||||
number_text.str(), font_size, color, x_offset, y_offset);
|
||||
}
|
||||
}
|
||||
|
||||
void recall::redraw()
|
||||
{
|
||||
game_display::get_singleton()->invalidate(recall_hex_);
|
||||
display::get_singleton()->invalidate(recall_hex_);
|
||||
}
|
||||
|
||||
action::error recall::check_validity() const
|
||||
|
|
|
@ -134,7 +134,7 @@ void recruit::apply_temp_modifier(unit_map& unit_map)
|
|||
unit_map.insert(temp_unit_);
|
||||
|
||||
// Update gold in the top bar
|
||||
game_display::get_singleton()->invalidate_game_status();
|
||||
display::get_singleton()->invalidate_game_status();
|
||||
}
|
||||
|
||||
void recruit::remove_temp_modifier(unit_map& unit_map)
|
||||
|
@ -155,14 +155,14 @@ void recruit::draw_hex(const map_location& hex)
|
|||
number_text << font::unicode_minus << cost_;
|
||||
size_t font_size = 16;
|
||||
color_t color {255, 0, 0}; //red
|
||||
game_display::get_singleton()->draw_text_in_hex(hex, display::LAYER_ACTIONS_NUMBERING,
|
||||
display::get_singleton()->draw_text_in_hex(hex, display::LAYER_ACTIONS_NUMBERING,
|
||||
number_text.str(), font_size, color, x_offset, y_offset);
|
||||
}
|
||||
}
|
||||
|
||||
void recruit::redraw()
|
||||
{
|
||||
game_display::get_singleton()->invalidate(recruit_hex_);
|
||||
display::get_singleton()->invalidate(recruit_hex_);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
#include "actions/create.hpp"
|
||||
#include "actions/undo.hpp"
|
||||
#include "game_display.hpp"
|
||||
#include "display.hpp"
|
||||
#include "game_end_exceptions.hpp"
|
||||
#include "game_state.hpp"
|
||||
#include "map/map.hpp"
|
||||
|
@ -726,7 +726,7 @@ void side_actions::execute_net_cmd(const net_cmd& cmd)
|
|||
//update numbering hexes as necessary
|
||||
++itor;
|
||||
for(iterator end_itor = end(); itor != end_itor; ++itor) {
|
||||
game_display::get_singleton()->invalidate((*itor)->get_numbering_hex());
|
||||
display::get_singleton()->invalidate((*itor)->get_numbering_hex());
|
||||
}
|
||||
} else if(type=="replace") {
|
||||
size_t turn = cmd["turn"].to_int();
|
||||
|
@ -765,7 +765,7 @@ void side_actions::execute_net_cmd(const net_cmd& cmd)
|
|||
|
||||
//update numbering hexes as necessary
|
||||
for(iterator end_itor = end(); itor != end_itor; ++itor) {
|
||||
game_display::get_singleton()->invalidate((*itor)->get_numbering_hex());
|
||||
display::get_singleton()->invalidate((*itor)->get_numbering_hex());
|
||||
}
|
||||
} else if(type=="bump_later") {
|
||||
size_t turn = cmd["turn"].to_int();
|
||||
|
@ -784,8 +784,8 @@ void side_actions::execute_net_cmd(const net_cmd& cmd)
|
|||
LOG_WB << "Command received: action bumped later from turn #" << turn << ", position #" << pos << "\n";
|
||||
|
||||
//update numbering hexes as necessary
|
||||
game_display::get_singleton()->invalidate(first_action->get_numbering_hex());
|
||||
game_display::get_singleton()->invalidate(second_action->get_numbering_hex());
|
||||
display::get_singleton()->invalidate(first_action->get_numbering_hex());
|
||||
display::get_singleton()->invalidate(second_action->get_numbering_hex());
|
||||
} else if(type=="clear") {
|
||||
LOG_WB << "Command received: clear\n";
|
||||
clear();
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include "arrow.hpp"
|
||||
#include "config.hpp"
|
||||
#include "game_display.hpp"
|
||||
#include "display.hpp"
|
||||
#include "game_end_exceptions.hpp"
|
||||
#include "mouse_events.hpp"
|
||||
#include "play_controller.hpp"
|
||||
|
@ -85,14 +85,14 @@ suppose_dead::suppose_dead(const config& cfg, bool hidden)
|
|||
|
||||
void suppose_dead::init()
|
||||
{
|
||||
game_display::get_singleton()->invalidate(loc_);
|
||||
display::get_singleton()->invalidate(loc_);
|
||||
}
|
||||
|
||||
suppose_dead::~suppose_dead()
|
||||
{
|
||||
//invalidate hex so that skull indicator is properly cleared
|
||||
if(game_display::get_singleton())
|
||||
game_display::get_singleton()->invalidate(loc_);
|
||||
if(display::get_singleton())
|
||||
display::get_singleton()->invalidate(loc_);
|
||||
}
|
||||
|
||||
unit_ptr suppose_dead::get_unit() const
|
||||
|
@ -140,16 +140,16 @@ void suppose_dead::draw_hex(const map_location& hex)
|
|||
//@todo: Possibly use a different layer
|
||||
const display::drawing_layer layer = display::LAYER_ARROWS;
|
||||
|
||||
int xpos = game_display::get_singleton()->get_location_x(loc_);
|
||||
int ypos = game_display::get_singleton()->get_location_y(loc_);
|
||||
game_display::get_singleton()->drawing_buffer_add(layer, loc_, xpos, ypos,
|
||||
int xpos = display::get_singleton()->get_location_x(loc_);
|
||||
int ypos = display::get_singleton()->get_location_y(loc_);
|
||||
display::get_singleton()->drawing_buffer_add(layer, loc_, xpos, ypos,
|
||||
image::get_image("whiteboard/suppose_dead.png", image::SCALED_TO_HEX));
|
||||
}
|
||||
}
|
||||
|
||||
void suppose_dead::redraw()
|
||||
{
|
||||
game_display::get_singleton()->invalidate(loc_);
|
||||
display::get_singleton()->invalidate(loc_);
|
||||
}
|
||||
|
||||
action::error suppose_dead::check_validity() const
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "whiteboard/side_actions.hpp"
|
||||
|
||||
#include "actions/create.hpp"
|
||||
#include "game_display.hpp"
|
||||
#include "display.hpp"
|
||||
#include "map/map.hpp"
|
||||
#include "play_controller.hpp"
|
||||
#include "resources.hpp"
|
||||
|
@ -39,18 +39,18 @@ namespace wb {
|
|||
|
||||
size_t viewer_team()
|
||||
{
|
||||
return game_display::get_singleton()->viewing_team();
|
||||
return display::get_singleton()->viewing_team();
|
||||
}
|
||||
|
||||
int viewer_side()
|
||||
{
|
||||
return game_display::get_singleton()->viewing_side();
|
||||
return display::get_singleton()->viewing_side();
|
||||
}
|
||||
|
||||
side_actions_ptr viewer_actions()
|
||||
{
|
||||
side_actions_ptr side_actions =
|
||||
resources::gameboard->teams()[game_display::get_singleton()->viewing_team()].get_side_actions();
|
||||
resources::gameboard->teams()[display::get_singleton()->viewing_team()].get_side_actions();
|
||||
return side_actions;
|
||||
}
|
||||
|
||||
|
@ -142,13 +142,13 @@ temporary_unit_hider::~temporary_unit_hider()
|
|||
void ghost_owner_unit(unit* unit)
|
||||
{
|
||||
unit->anim_comp().set_disabled_ghosted(false);
|
||||
game_display::get_singleton()->invalidate(unit->get_location());
|
||||
display::get_singleton()->invalidate(unit->get_location());
|
||||
}
|
||||
|
||||
void unghost_owner_unit(unit* unit)
|
||||
{
|
||||
unit->anim_comp().set_standing(true);
|
||||
game_display::get_singleton()->invalidate(unit->get_location());
|
||||
display::get_singleton()->invalidate(unit->get_location());
|
||||
}
|
||||
|
||||
bool has_actions()
|
||||
|
|
Loading…
Add table
Reference in a new issue