Skip to content

Commit

Permalink
add access controls to game_board
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeck88 committed Jun 1, 2014
1 parent 8b6339a commit d557ea5
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 8 deletions.
26 changes: 23 additions & 3 deletions src/game_board.hpp
Expand Up @@ -25,19 +25,39 @@

class config;

struct game_board {
game_board(const config & game_config, const config & level) : teams_(), map_(game_config, level), units_() {}
class game_board {

std::vector<team> teams_;

gamemap map_;
unit_map units_;

//TODO: Remove these when we have refactored enough to make it possible.
friend class play_controller;
friend class replay_controller;
friend class playsingle_controller;
friend class playmp_controller;

public:

// Constructors and const accessors

game_board(const config & game_config, const config & level) : teams_(), map_(game_config, level), units_() {}

const std::vector<team> & teams() const { return teams_; }
const gamemap & map() const { return map_; }
const unit_map & units() const { return units_; }

// Saving

void write_config(config & cfg) const;

// Manipulators from play_controller

void new_turn(int pnum);
void end_turn(int pnum);
void set_all_units_user_end_turn();

void write_config(config & cfg) const;
};

#endif
8 changes: 4 additions & 4 deletions src/game_preferences.cpp
Expand Up @@ -1081,10 +1081,10 @@ void encounter_map_terrain(const gamemap& map){
}

void encounter_all_content(const game_board & gameboard_) {
preferences::encounter_recruitable_units(gameboard_.teams_);
preferences::encounter_start_units(gameboard_.units_);
preferences::encounter_recallable_units(gameboard_.teams_);
preferences::encounter_map_terrain(gameboard_.map_);
preferences::encounter_recruitable_units(gameboard_.teams());
preferences::encounter_start_units(gameboard_.units());
preferences::encounter_recallable_units(gameboard_.teams());
preferences::encounter_map_terrain(gameboard_.map());
}

void acquaintance::load_from_config(const config& cfg)
Expand Down
2 changes: 1 addition & 1 deletion src/game_preferences.hpp
Expand Up @@ -14,7 +14,7 @@
#ifndef GAME_PREFERENCES_HPP_INCLUDED
#define GAME_PREFERENCES_HPP_INCLUDED

struct game_board;
class game_board;
class gamemap;
class game_state;
class team;
Expand Down

0 comments on commit d557ea5

Please sign in to comment.