Changeset 12124 for code/branches/wagnis_HS18/src/modules/wagnis
- Timestamp:
- Nov 28, 2018, 11:50:16 AM (6 years ago)
- Location:
- code/branches/wagnis_HS18/src/modules/wagnis
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.cc
r12119 r12124 14 14 RegisterObject(Wagnis); 15 15 this->gameBoard = nullptr; 16 this->gameStage = NOT_READY; 17 18 int n = 3; 19 for(int i = 1;i <= n;i++){ 20 WagnisPlayer* p = new WagnisPlayer(context); 21 p->gameBoard = this->gameBoard; 22 this->players.push_back(p); 23 } 16 24 } 17 25 //Destructor … … 21 29 //Runs the game 22 30 void Wagnis::start(){ 23 31 //SUPER(Wagnis,start); 32 this->createGame(); 33 } 34 35 //Tick 36 void Wagnis::tick(float dt){ 37 SUPER(Wagnis,tick,dt); 24 38 } 25 39 26 40 //Creates and links all needed classes 27 void createGame(){ 41 void Wagnis::createGame(){\ 42 orxout() << "Game creation started"; 28 43 44 if(!findGameBoard()){ 45 orxout() << "Error: GameBoard not found"; 46 } 47 48 this->gameBoard->initializeNeighbors(); 49 orxout() << "Game creation finished"; 29 50 } 30 51 52 //Finds the pointer to the gameBoard 53 bool Wagnis::findGameBoard(){ 54 for (WagnisGameboard* gb : ObjectList<WagnisGameboard>()){ 55 this->gameBoard = gb; 56 orxout()<<"Gameboard pointer found and added"; 57 return true; 58 } 59 return false; 60 } 31 61 32 62 -
code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.h
r12119 r12124 5 5 #define Wagnis_h 6 6 7 7 #include "WagnisPrereqs.h" 8 8 #include "WagnisGameboard.h" 9 9 #include "WagnisProvince.h" 10 #include "WagnisPlayer.h" 10 11 #include "gametypes/Deathmatch.h" 11 12 … … 28 29 29 30 30 enum GameStage { CHOOSE_PROVINCE_STAGE, REINFORCEMENT_STAGE, ATTACK_STAGE, MOVE_STAGE };31 32 31 namespace orxonox 33 32 { … … 38 37 virtual ~Wagnis(); 39 38 void start(); 39 void tick(float); 40 40 41 41 … … 44 44 45 45 private: 46 GameStage gameStage; 47 std::vector<WagnisPlayer*> players; 46 48 void createGame(); 49 bool findGameBoard(); 47 50 }; 48 51 } -
code/branches/wagnis_HS18/src/modules/wagnis/WagnisGameboard.cc
r12080 r12124 62 62 //Parses the string and initializes the neigbors vector of all provinces according 63 63 //Syntax: 32=7-8-4 , 2=33+5+7+1+4 64 void WagnisGameboard::initializeNeighbors(std::string str){ 64 void WagnisGameboard::initializeNeighbors(){ 65 std::string str = this->connections_string; 65 66 orxout() << "inizializing started" << endl; 66 67 orxout() << "String size:" << endl; -
code/branches/wagnis_HS18/src/modules/wagnis/WagnisGameboard.h
r12119 r12124 9 9 #define Wagnis_Gameboard_h 10 10 11 #include "WagnisPrereqs.h" 11 12 #include "WagnisProvince.h" 12 13 … … 35 36 //XML end 36 37 37 void initializeNeighbors( std::string);38 void initializeNeighbors(); 38 39 39 40 40 41 41 42 std::string connections_string; 42 43 std::vector<WagnisProvince*> provs; -
code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.h
r12119 r12124 7 7 #define Wagnis_Player_h 8 8 9 #include "WagnisPrereqs.h" 9 10 #include "Wagnis.h" 10 11 #include "OrxonoxPrereqs.h" … … 16 17 #include <string> 17 18 #include "infos/HumanPlayer.h" 18 19 enum MoveType { ATTACK, MOVE, SET_TROOPS, SET_TROOPS_INITIAL };20 19 21 20 -
code/branches/wagnis_HS18/src/modules/wagnis/WagnisPrereqs.h
r12049 r12124 66 66 { 67 67 68 class Wagnis; 68 69 class WagnisProvince; 70 class WagnisGameboard; 71 class WagnisPlayer; 72 enum GameStage { NOT_READY, CHOOSE_PROVINCE_STAGE, REINFORCEMENT_STAGE, ATTACK_STAGE, MOVE_STAGE }; 73 enum MoveType { ATTACK, MOVE, SET_TROOPS, SET_TROOPS_INITIAL }; 69 74 70 75 }
Note: See TracChangeset
for help on using the changeset viewer.