|
@@ -1,16 +1,22 @@
|
|
|
/*
|
|
|
- * Someone tells, that Qt can to build this
|
|
|
- */
|
|
|
+* Someone tells, that Qt can to build this
|
|
|
+*/
|
|
|
+#include "include/hotseatgame/GameManager.h"
|
|
|
#include "Cell.h"
|
|
|
-#include "GameManager.h"
|
|
|
-
|
|
|
#include <iostream>
|
|
|
|
|
|
-GameManager::GameManager(int colSize, int rowSize):col_table_size_(colSize), row_table_size_(rowSize) {
|
|
|
- generate_table_();
|
|
|
+GameManager::GameManager(QObject *parent) : QObject(parent)
|
|
|
+{
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+void GameManager::buildGameTable(int colSize, int rowSize){
|
|
|
+ col_table_size_ = colSize;
|
|
|
+ row_table_size_ = rowSize;
|
|
|
+ generateTable();
|
|
|
}
|
|
|
|
|
|
-void GameManager::generate_table_() {
|
|
|
+void GameManager::generateTable() {
|
|
|
game_table_.assign(col_table_size_, std::vector< Cell* >(row_table_size_, nullptr));
|
|
|
for (int col = 0; col < col_table_size_; ++col) {
|
|
|
for (int row = 0; row < row_table_size_; ++row) {
|
|
@@ -44,7 +50,7 @@ void GameManager::generate_table_() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void GameManager::print_all() {
|
|
|
+void GameManager::printAll() {
|
|
|
game_table_[0][0]->RecalculateTableWithCenterThisPoint();
|
|
|
for (int col = 0; col < col_table_size_; ++col) {
|
|
|
for (int row = 0; row < row_table_size_; ++row) {
|
|
@@ -53,3 +59,23 @@ void GameManager::print_all() {
|
|
|
std::cout << std::endl;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+UnitsQueue* GameManager::getTurnQueue(){
|
|
|
+ return &turn_queue_;
|
|
|
+}
|
|
|
+
|
|
|
+void GameManager::AddToUnitQueue(Unit* unit){
|
|
|
+ turn_queue_.add(unit);
|
|
|
+}
|
|
|
+
|
|
|
+void GameManager::RmFromUnitQueue(Unit* unit){
|
|
|
+ turn_queue_.remove(unit);
|
|
|
+}
|
|
|
+
|
|
|
+int GameManager::getCurPlayerId(){
|
|
|
+ return cur_player_id_;
|
|
|
+};
|
|
|
+
|
|
|
+Player* GameManager::getCurrentPlayer(){
|
|
|
+ return player_manager_->getPlayer(cur_player_id_);
|
|
|
+}
|