Add const to member functions

This commit is contained in:
Rikard Falkeborn 2017-10-21 22:58:08 +02:00 committed by Jyrki Vesterinen
parent 1bfa170856
commit a8f6df50e8
6 changed files with 7 additions and 7 deletions

View file

@ -317,7 +317,7 @@ public:
private:
// This gives me 10% speed improvement over std::vector<> (g++4.0.3 x86)
std::unique_ptr<double[]> new_plane();
std::unique_ptr<double[]> new_plane() const;
void initialize_plane(unsigned plane,
unsigned a_cur,
@ -449,7 +449,7 @@ prob_matrix::prob_matrix(unsigned int a_max,
}
/** Allocate a new probability array, initialized to 0. */
std::unique_ptr<double[]> prob_matrix::new_plane()
std::unique_ptr<double[]> prob_matrix::new_plane() const
{
const unsigned int size = rows_ * cols_;
std::unique_ptr<double[]> res(new double[size]);

View file

@ -2324,7 +2324,7 @@ void display::bounds_check_position()
}
}
void display::bounds_check_position(int& xpos, int& ypos)
void display::bounds_check_position(int& xpos, int& ypos) const
{
const int tile_width = hex_width();

View file

@ -493,7 +493,7 @@ public:
double idle_anim_rate() const { return idle_anim_rate_; }
void bounds_check_position();
void bounds_check_position(int& xpos, int& ypos);
void bounds_check_position(int& xpos, int& ypos) const;
/**
* Scrolls the display by xmov,ymov pixels.

View file

@ -78,7 +78,7 @@ namespace {
char_t_to*& to_next;
char_t_to* to_end;
bool can_push(size_t count)
bool can_push(size_t count) const
{
return static_cast<size_t>(to_end - to_next) > count;
}

View file

@ -131,7 +131,7 @@ public:
return pumped_count_ >= queue_.size();
}
unsigned count()
unsigned count() const
{
return impl_.instance_count;
}

View file

@ -238,7 +238,7 @@ public:
return is_regular_game_end();
}
void maybe_throw_return_to_play_side()
void maybe_throw_return_to_play_side() const
{
if(should_return_to_play_side() && !linger_ ) {
throw return_to_play_side_exception();