Display Context: enable bounds checking for get_team()
Also enabled it for the non-const version in game_board.
This commit is contained in:
parent
24e40cc0b1
commit
b779c91df7
2 changed files with 4 additions and 3 deletions
|
@ -24,8 +24,9 @@ std::vector<std::string>& display_context::hidden_label_categories_ref() {
|
|||
return const_cast<std::vector<std::string>&>(this->hidden_label_categories());
|
||||
}
|
||||
|
||||
const team& display_context::get_team(int side) const {
|
||||
return teams()[side-1];
|
||||
const team& display_context::get_team(int side) const
|
||||
{
|
||||
return teams().at(side - 1);
|
||||
}
|
||||
|
||||
bool display_context::would_be_discovered(const map_location & loc, int side_num, bool see_all)
|
||||
|
|
|
@ -91,7 +91,7 @@ public:
|
|||
|
||||
virtual const std::vector<team> & teams() const { return teams_; }
|
||||
using display_context::get_team; // so as not to hide the const version
|
||||
team& get_team(int i) {return teams_[i - 1];}
|
||||
team& get_team(int i) {return teams_.at(i - 1);}
|
||||
virtual std::vector<team> & teams() { return teams_; }
|
||||
virtual const gamemap & map() const { return *map_; }
|
||||
virtual const unit_map & units() const { return units_; }
|
||||
|
|
Loading…
Add table
Reference in a new issue