Add const to some functions
This commit is contained in:
parent
77184d4af0
commit
343eb9ab1b
10 changed files with 13 additions and 13 deletions
|
@ -32,7 +32,7 @@ namespace {
|
|||
/**
|
||||
* Returns whether the given add-on name char is not whitelisted.
|
||||
*/
|
||||
inline bool operator()(char c)
|
||||
inline bool operator()(char c) const
|
||||
{
|
||||
switch(c)
|
||||
{
|
||||
|
|
|
@ -72,7 +72,7 @@ config candidate_action_evaluation_loop::to_config() const
|
|||
|
||||
class desc_sorter_of_candidate_actions {
|
||||
public:
|
||||
bool operator()(const candidate_action_ptr &a, const candidate_action_ptr &b)
|
||||
bool operator()(const candidate_action_ptr &a, const candidate_action_ptr &b) const
|
||||
{
|
||||
return a->get_max_score() > b->get_max_score();
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ template<typename T>
|
|||
class void_value
|
||||
{
|
||||
public:
|
||||
const T operator()() { return T(); }
|
||||
const T operator()() const { return T(); }
|
||||
};
|
||||
|
||||
template<typename T, typename T_void_value=void_value<T> >
|
||||
|
|
|
@ -61,7 +61,7 @@ public:
|
|||
* If it doesn't exist or has missing images, you'll get "under construction"
|
||||
* symbols instead of arrow graphics.
|
||||
*/
|
||||
std::string get_style() {return style_;}
|
||||
std::string get_style() const {return style_;}
|
||||
void set_style(const std::string& style);
|
||||
///If you add more styles, you should look at move::update_arrow_style()
|
||||
static const std::string STYLE_STANDARD;
|
||||
|
|
|
@ -164,7 +164,7 @@ void carryover_info::remove_side(const std::string& id) {
|
|||
struct save_id_equals
|
||||
{
|
||||
save_id_equals(const std::string& val) : value (val) {}
|
||||
bool operator () (carryover& v2)
|
||||
bool operator () (carryover& v2) const
|
||||
{
|
||||
return value == v2.get_save_id();
|
||||
}
|
||||
|
|
|
@ -2065,7 +2065,7 @@ void display::set_default_zoom()
|
|||
}
|
||||
}
|
||||
|
||||
bool display::tile_fully_on_screen(const map_location& loc)
|
||||
bool display::tile_fully_on_screen(const map_location& loc) const
|
||||
{
|
||||
int x = get_location_x(loc);
|
||||
int y = get_location_y(loc);
|
||||
|
|
|
@ -554,7 +554,7 @@ public:
|
|||
events::generic_event& complete_redraw_event() { return complete_redraw_event_; }
|
||||
|
||||
/** Check if a tile is fully visible on screen. */
|
||||
bool tile_fully_on_screen(const map_location& loc);
|
||||
bool tile_fully_on_screen(const map_location& loc) const;
|
||||
|
||||
/** Checks if location @a loc or one of the adjacent tiles is visible on screen. */
|
||||
bool tile_nearly_on_screen(const map_location &loc) const;
|
||||
|
|
|
@ -62,12 +62,12 @@ public:
|
|||
}
|
||||
#endif
|
||||
|
||||
std::string str() {
|
||||
std::string str() const {
|
||||
return stream_.str();
|
||||
}
|
||||
|
||||
// Implicit x-value conversion to string
|
||||
operator std::string()
|
||||
operator std::string() const
|
||||
#if HAVE_REF_QUALIFIERS
|
||||
&&
|
||||
#endif
|
||||
|
|
|
@ -1094,7 +1094,7 @@ private:
|
|||
struct indexer {
|
||||
size_t i;
|
||||
explicit indexer(size_t i) : i(i) {}
|
||||
variant operator()(const variant& v) {
|
||||
variant operator()(const variant& v) const {
|
||||
if(i >= v.num_elements()) {
|
||||
return variant();
|
||||
} else {
|
||||
|
@ -1103,7 +1103,7 @@ private:
|
|||
}
|
||||
};
|
||||
struct comparator {
|
||||
bool operator()(const variant& a, const variant& b) {
|
||||
bool operator()(const variant& a, const variant& b) const {
|
||||
return a.num_elements() < b.num_elements();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -92,7 +92,7 @@ public:
|
|||
throw "No scenariodata found";
|
||||
}
|
||||
const std::set<std::string>& connected_users() const;
|
||||
const std::vector<std::string>& user_team_names()
|
||||
const std::vector<std::string>& user_team_names() const
|
||||
{ return user_team_names_; }
|
||||
std::vector<side_engine_ptr>& side_engines() { return side_engines_; }
|
||||
const mp_game_settings& params() const { return params_; }
|
||||
|
@ -186,7 +186,7 @@ public:
|
|||
// The id of the side of the previous scenario that should control this side.
|
||||
std::string previous_save_id() const
|
||||
{ return (!cfg_["previous_save_id"].empty()) ? cfg_["previous_save_id"] : save_id(); }
|
||||
const std::vector<controller_option>& controller_options()
|
||||
const std::vector<controller_option>& controller_options() const
|
||||
{ return controller_options_; }
|
||||
const config& cfg() const { return cfg_; }
|
||||
ng::controller controller() const { return controller_; }
|
||||
|
|
Loading…
Add table
Reference in a new issue