[Orxonox-commit 7518] r12124 - code/branches/wagnis_HS18/src/modules/wagnis
stadlero at orxonox.net
stadlero at orxonox.net
Wed Nov 28 11:50:16 CET 2018
Author: stadlero
Date: 2018-11-28 11:50:16 +0100 (Wed, 28 Nov 2018)
New Revision: 12124
Modified:
code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.cc
code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.h
code/branches/wagnis_HS18/src/modules/wagnis/WagnisGameboard.cc
code/branches/wagnis_HS18/src/modules/wagnis/WagnisGameboard.h
code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.h
code/branches/wagnis_HS18/src/modules/wagnis/WagnisPrereqs.h
Log:
Wagnis class wip
Modified: code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.cc
===================================================================
--- code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.cc 2018-11-28 10:36:23 UTC (rev 12123)
+++ code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.cc 2018-11-28 10:50:16 UTC (rev 12124)
@@ -13,6 +13,14 @@
Wagnis::Wagnis(Context* context) : Deathmatch(context){
RegisterObject(Wagnis);
this->gameBoard = nullptr;
+ this->gameStage = NOT_READY;
+
+ int n = 3;
+ for(int i = 1;i <= n;i++){
+ WagnisPlayer* p = new WagnisPlayer(context);
+ p->gameBoard = this->gameBoard;
+ this->players.push_back(p);
+ }
}
//Destructor
Wagnis::~Wagnis(){}
@@ -20,14 +28,36 @@
//Runs the game
void Wagnis::start(){
-
+ //SUPER(Wagnis,start);
+ this->createGame();
}
+//Tick
+void Wagnis::tick(float dt){
+ SUPER(Wagnis,tick,dt);
+}
+
//Creates and links all needed classes
-void createGame(){
+void Wagnis::createGame(){\
+ orxout() << "Game creation started";
+ if(!findGameBoard()){
+ orxout() << "Error: GameBoard not found";
+ }
+
+ this->gameBoard->initializeNeighbors();
+ orxout() << "Game creation finished";
}
+//Finds the pointer to the gameBoard
+bool Wagnis::findGameBoard(){
+ for (WagnisGameboard* gb : ObjectList<WagnisGameboard>()){
+ this->gameBoard = gb;
+ orxout()<<"Gameboard pointer found and added";
+ return true;
+ }
+ return false;
+}
Modified: code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.h
===================================================================
--- code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.h 2018-11-28 10:36:23 UTC (rev 12123)
+++ code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.h 2018-11-28 10:50:16 UTC (rev 12124)
@@ -4,9 +4,10 @@
#ifndef Wagnis_h
#define Wagnis_h
-
+#include "WagnisPrereqs.h"
#include "WagnisGameboard.h"
#include "WagnisProvince.h"
+#include "WagnisPlayer.h"
#include "gametypes/Deathmatch.h"
@@ -27,8 +28,6 @@
**/
-enum GameStage { CHOOSE_PROVINCE_STAGE, REINFORCEMENT_STAGE, ATTACK_STAGE, MOVE_STAGE };
-
namespace orxonox
{
class /**_WagnisExport**/ Wagnis : public Deathmatch
@@ -37,6 +36,7 @@
Wagnis(Context* context);
virtual ~Wagnis();
void start();
+ void tick(float);
@@ -43,7 +43,10 @@
WagnisGameboard* gameBoard;
private:
+ GameStage gameStage;
+ std::vector<WagnisPlayer*> players;
void createGame();
+ bool findGameBoard();
};
}
#endif
Modified: code/branches/wagnis_HS18/src/modules/wagnis/WagnisGameboard.cc
===================================================================
--- code/branches/wagnis_HS18/src/modules/wagnis/WagnisGameboard.cc 2018-11-28 10:36:23 UTC (rev 12123)
+++ code/branches/wagnis_HS18/src/modules/wagnis/WagnisGameboard.cc 2018-11-28 10:50:16 UTC (rev 12124)
@@ -61,7 +61,8 @@
//Parses the string and initializes the neigbors vector of all provinces according
//Syntax: 32=7-8-4 , 2=33+5+7+1+4
- void WagnisGameboard::initializeNeighbors(std::string str){
+ void WagnisGameboard::initializeNeighbors(){
+ std::string str = this->connections_string;
orxout() << "inizializing started" << endl;
orxout() << "String size:" << endl;
orxout() << str.size() << endl;
Modified: code/branches/wagnis_HS18/src/modules/wagnis/WagnisGameboard.h
===================================================================
--- code/branches/wagnis_HS18/src/modules/wagnis/WagnisGameboard.h 2018-11-28 10:36:23 UTC (rev 12123)
+++ code/branches/wagnis_HS18/src/modules/wagnis/WagnisGameboard.h 2018-11-28 10:50:16 UTC (rev 12124)
@@ -8,6 +8,7 @@
#ifndef Wagnis_Gameboard_h
#define Wagnis_Gameboard_h
+#include "WagnisPrereqs.h"
#include "WagnisProvince.h"
#include "OrxonoxPrereqs.h"
@@ -34,10 +35,10 @@
std::string getConnections_string() const;
//XML end
- void initializeNeighbors(std::string);
+ void initializeNeighbors();
-
+
std::string connections_string;
std::vector<WagnisProvince*> provs;
int parse_int(std::string,unsigned int);
Modified: code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.h
===================================================================
--- code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.h 2018-11-28 10:36:23 UTC (rev 12123)
+++ code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.h 2018-11-28 10:50:16 UTC (rev 12124)
@@ -6,6 +6,7 @@
#ifndef Wagnis_Player_h
#define Wagnis_Player_h
+#include "WagnisPrereqs.h"
#include "Wagnis.h"
#include "OrxonoxPrereqs.h"
#include "core/CoreIncludes.h"
@@ -16,11 +17,9 @@
#include <string>
#include "infos/HumanPlayer.h"
-enum MoveType { ATTACK, MOVE, SET_TROOPS, SET_TROOPS_INITIAL };
-
namespace orxonox
{
class WagnisPlayer : public HumanPlayer, public Tickable
Modified: code/branches/wagnis_HS18/src/modules/wagnis/WagnisPrereqs.h
===================================================================
--- code/branches/wagnis_HS18/src/modules/wagnis/WagnisPrereqs.h 2018-11-28 10:36:23 UTC (rev 12123)
+++ code/branches/wagnis_HS18/src/modules/wagnis/WagnisPrereqs.h 2018-11-28 10:50:16 UTC (rev 12124)
@@ -65,7 +65,12 @@
namespace orxonox
{
+ class Wagnis;
class WagnisProvince;
+ class WagnisGameboard;
+ class WagnisPlayer;
+ enum GameStage { NOT_READY, CHOOSE_PROVINCE_STAGE, REINFORCEMENT_STAGE, ATTACK_STAGE, MOVE_STAGE };
+ enum MoveType { ATTACK, MOVE, SET_TROOPS, SET_TROOPS_INITIAL };
}
More information about the Orxonox-commit
mailing list