diff --git a/projectfiles/CodeBlocks-SCons/wesnoth.cbp b/projectfiles/CodeBlocks-SCons/wesnoth.cbp
index 25eef962f3c0..b8f0d184c9cd 100644
--- a/projectfiles/CodeBlocks-SCons/wesnoth.cbp
+++ b/projectfiles/CodeBlocks-SCons/wesnoth.cbp
@@ -285,6 +285,7 @@
+
diff --git a/projectfiles/CodeBlocks/wesnoth.cbp b/projectfiles/CodeBlocks/wesnoth.cbp
index 1607da4b60f9..c57bacb3159b 100644
--- a/projectfiles/CodeBlocks/wesnoth.cbp
+++ b/projectfiles/CodeBlocks/wesnoth.cbp
@@ -322,6 +322,7 @@
+
diff --git a/projectfiles/CodeLite/wesnoth.project b/projectfiles/CodeLite/wesnoth.project
index 69487f8250a0..3eeaf566ffa5 100644
--- a/projectfiles/CodeLite/wesnoth.project
+++ b/projectfiles/CodeLite/wesnoth.project
@@ -4285,6 +4285,8 @@
+
+
diff --git a/projectfiles/VC9/wesnoth.vcproj b/projectfiles/VC9/wesnoth.vcproj
index 850e4f6ca346..28f1ed4e25a4 100644
--- a/projectfiles/VC9/wesnoth.vcproj
+++ b/projectfiles/VC9/wesnoth.vcproj
@@ -20060,6 +20060,14 @@
/>
+
+
+
+
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 59258a429b5b..500ad1f91030 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -736,6 +736,7 @@ set(wesnoth-main_SRC
formula_function.cpp
formula_string_utils.cpp
formula_tokenizer.cpp
+ game_board.cpp
game_config_manager.cpp
game_controller.cpp
game_display.cpp
diff --git a/src/SConscript b/src/SConscript
index 51edf252c578..0cc125f5f0df 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -268,6 +268,7 @@ wesnoth_sources = Split("""
formula_function.cpp
formula_string_utils.cpp
formula_tokenizer.cpp
+ game_board.cpp
game_config_manager.cpp
game_controller.cpp
game_display.cpp
diff --git a/src/game_board.cpp b/src/game_board.cpp
new file mode 100644
index 000000000000..dda321b6de62
--- /dev/null
+++ b/src/game_board.cpp
@@ -0,0 +1,74 @@
+/*
+ Copyright (C) 2014 by Chris Beck
+ Part of the Battle for Wesnoth Project http://www.wesnoth.org/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY.
+
+ See the COPYING file for more details.
+*/
+
+#include "config.hpp"
+#include "game_board.hpp"
+#include "unit.hpp"
+
+#include
+
+
+void game_board::new_turn(int player_num) {
+ BOOST_FOREACH (unit & i, units_) {
+ if (i.side() == player_num) {
+ i.new_turn();
+ }
+ }
+}
+
+void game_board::end_turn(int player_num) {
+ BOOST_FOREACH (unit & i, units_) {
+ if (i.side() == player_num) {
+ i.end_turn();
+ }
+ }
+}
+
+void game_board::set_all_units_user_end_turn() {
+ BOOST_FOREACH (unit & i, units_) {
+ i.set_user_end_turn(true);
+ }
+}
+
+void game_board::write_config(config & cfg) const {
+ for(std::vector::const_iterator t = teams_.begin(); t != teams_.end(); ++t) {
+ int side_num = t - teams_.begin() + 1;
+
+ config& side = cfg.add_child("side");
+ t->write(side);
+ side["no_leader"] = true;
+ side["side"] = str_cast(side_num);
+
+ //current units
+ {
+ BOOST_FOREACH(const unit & i, units_) {
+ if (i.side() == side_num) {
+ config& u = side.add_child("unit");
+ i.get_location().write(u);
+ i.write(u);
+ }
+ }
+ }
+ //recall list
+ {
+ BOOST_FOREACH(const unit & j, t->recall_list()) {
+ config& u = side.add_child("unit");
+ j.write(u);
+ }
+ }
+ }
+
+ //write the map
+ cfg["map_data"] = map_.write();
+}
diff --git a/src/game_board.hpp b/src/game_board.hpp
new file mode 100644
index 000000000000..25b78fbb4773
--- /dev/null
+++ b/src/game_board.hpp
@@ -0,0 +1,43 @@
+/*
+ Copyright (C) 2014 by Chris Beck
+ Part of the Battle for Wesnoth Project http://www.wesnoth.org/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY.
+
+ See the COPYING file for more details.
+*/
+
+#ifndef GAME_BOARD_HPP_INCLUDED
+#define GAME_BOARD_HPP_INCLUDED
+
+#include "global.hpp"
+
+#include "map.hpp"
+#include "team.hpp"
+#include "unit_map.hpp"
+
+#include
+
+class config;
+
+struct game_board {
+ game_board(const config & game_config, const config & level) : teams_(), map_(game_config, level), units_() {}
+
+ std::vector teams_;
+
+ gamemap map_;
+ unit_map units_;
+
+ void new_turn(int pnum);
+ void end_turn(int pnum);
+ void set_all_units_user_end_turn();
+
+ void write_config(config & cfg) const;
+};
+
+#endif
diff --git a/src/play_controller.cpp b/src/play_controller.cpp
index 368cd4134018..3f6e426d2c44 100644
--- a/src/play_controller.cpp
+++ b/src/play_controller.cpp
@@ -1495,57 +1495,3 @@ void play_controller::toggle_accelerated_speed()
gui_->announce(_("Accelerated speed disabled!"), font::NORMAL_COLOR);
}
}
-
-void game_board::new_turn(int player_num) {
- BOOST_FOREACH (unit & i, units_) {
- if (i.side() == player_num) {
- i.new_turn();
- }
- }
-}
-
-void game_board::end_turn(int player_num) {
- BOOST_FOREACH (unit & i, units_) {
- if (i.side() == player_num) {
- i.end_turn();
- }
- }
-}
-
-void game_board::set_all_units_user_end_turn() {
- BOOST_FOREACH (unit & i, units_) {
- i.set_user_end_turn(true);
- }
-}
-
-void game_board::write_config(config & cfg) const {
- for(std::vector::const_iterator t = teams_.begin(); t != teams_.end(); ++t) {
- int side_num = t - teams_.begin() + 1;
-
- config& side = cfg.add_child("side");
- t->write(side);
- side["no_leader"] = true;
- side["side"] = str_cast(side_num);
-
- //current units
- {
- BOOST_FOREACH(const unit & i, units_) {
- if (i.side() == side_num) {
- config& u = side.add_child("unit");
- i.get_location().write(u);
- i.write(u);
- }
- }
- }
- //recall list
- {
- BOOST_FOREACH(const unit & j, t->recall_list()) {
- config& u = side.add_child("unit");
- j.write(u);
- }
- }
- }
-
- //write the map
- cfg["map_data"] = map_.write();
-}
diff --git a/src/play_controller.hpp b/src/play_controller.hpp
index 778f2251feec..6798f0416247 100644
--- a/src/play_controller.hpp
+++ b/src/play_controller.hpp
@@ -18,6 +18,7 @@
#include "controller_base.hpp"
#include "game_end_exceptions.hpp"
+#include "game_board.hpp"
#include "help.hpp"
#include "menu_events.hpp"
#include "mouse_events.hpp"
@@ -68,23 +69,6 @@ namespace wb {
} // namespace wb
-// This should eventually be moved to it's own header but the simplest way to begin refactor is right here
-struct game_board {
- game_board(const config & game_config, const config & level) : teams_(), map_(game_config, level), units_() {}
-
- std::vector teams_;
-
- gamemap map_;
- unit_map units_;
-
- void new_turn(int pnum);
- void end_turn(int pnum);
- void set_all_units_user_end_turn();
-
- void write_config(config & cfg) const;
-};
-
-
class play_controller : public controller_base, public events::observer, public savegame::savegame_config
{
public: