More use of reference for ToD.
Helps to reduce a bit the overhead of local_light for common case.
This commit is contained in:
parent
ffab40fb13
commit
7e53c42340
4 changed files with 12 additions and 5 deletions
|
@ -38,6 +38,7 @@
|
|||
#include "preferences.hpp"
|
||||
#include "sdl_utils.hpp"
|
||||
#include "text.hpp"
|
||||
#include "time_of_day.hpp"
|
||||
#include "tooltips.hpp"
|
||||
#include "arrow.hpp"
|
||||
|
||||
|
@ -146,6 +147,12 @@ display::~display()
|
|||
{
|
||||
}
|
||||
|
||||
const time_of_day& display::get_time_of_day(const map_location& /*loc*/) const
|
||||
{
|
||||
static const time_of_day tod;
|
||||
return tod;
|
||||
}
|
||||
|
||||
void display::fill_images_list(const std::string& prefix, std::vector<std::string>& images)
|
||||
{
|
||||
// search prefix.png, prefix1.png, prefix2.png ...
|
||||
|
@ -691,7 +698,7 @@ std::vector<surface> display::get_terrain_images(const map_location &loc,
|
|||
std::string color_mod;
|
||||
bool use_lightmap = false;
|
||||
if(game_config::local_light){
|
||||
const time_of_day tod = get_time_of_day(loc);
|
||||
const time_of_day& tod = get_time_of_day(loc);
|
||||
|
||||
map_location adjs[6];
|
||||
get_adjacent_tiles(loc,adjs);
|
||||
|
@ -700,7 +707,7 @@ std::vector<surface> display::get_terrain_images(const map_location &loc,
|
|||
//get all the light transitions
|
||||
std::ostringstream light_trans;
|
||||
for(int d=0; d<6; ++d){
|
||||
const time_of_day atod = get_time_of_day(adjs[d]);
|
||||
const time_of_day& atod = get_time_of_day(adjs[d]);
|
||||
if(atod.red == tod.red && atod.green == tod.green && atod.blue == tod.blue)
|
||||
continue;
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
|
||||
class config;
|
||||
class terrain_builder;
|
||||
struct time_of_day;
|
||||
class map_labels;
|
||||
class arrow;
|
||||
|
||||
|
@ -45,7 +46,6 @@ class arrow;
|
|||
#include "map_location.hpp"
|
||||
#include "reports.hpp"
|
||||
#include "team.hpp"
|
||||
#include "time_of_day.hpp"
|
||||
#include "theme.hpp"
|
||||
#include "video.hpp"
|
||||
#include "widgets/button.hpp"
|
||||
|
|
|
@ -409,7 +409,7 @@ void game_display::draw_hex(const map_location& loc)
|
|||
//simulate_delay += 1;
|
||||
}
|
||||
|
||||
const time_of_day game_display::get_time_of_day(const map_location& loc) const
|
||||
const time_of_day& game_display::get_time_of_day(const map_location& loc) const
|
||||
{
|
||||
return tod_manager_.get_time_of_day(loc);
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ public:
|
|||
/** Same as invalidate_unit() if moving the displayed unit. */
|
||||
void invalidate_unit_after_move(const map_location& src, const map_location& dst);
|
||||
|
||||
const time_of_day get_time_of_day(const map_location& loc) const;
|
||||
const time_of_day& get_time_of_day(const map_location& loc) const;
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue