Skip to content

Commit

Permalink
Add const to member functions
Browse files Browse the repository at this point in the history
  • Loading branch information
rikardfalkeborn authored and GregoryLundberg committed Nov 30, 2017
1 parent 9207e23 commit 866e44c
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/attack_prediction.cpp
Expand Up @@ -317,7 +317,7 @@ class prob_matrix

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,
Expand Down Expand Up @@ -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]);
Expand Down
2 changes: 1 addition & 1 deletion src/display.cpp
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion src/display.hpp
Expand Up @@ -493,7 +493,7 @@ class display : public filter_context, public video2::draw_layering
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.
Expand Down
2 changes: 1 addition & 1 deletion src/filesystem_boost.cpp
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/game_events/pump.cpp
Expand Up @@ -131,7 +131,7 @@ class pump_manager
return pumped_count_ >= queue_.size();
}

unsigned count()
unsigned count() const
{
return impl_.instance_count;
}
Expand Down
2 changes: 1 addition & 1 deletion src/play_controller.hpp
Expand Up @@ -238,7 +238,7 @@ class play_controller : public controller_base, public events::observer, 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();
Expand Down

0 comments on commit 866e44c

Please sign in to comment.