Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 12124


Ignore:
Timestamp:
Nov 28, 2018, 11:50:16 AM (6 years ago)
Author:
stadlero
Message:

Wagnis class wip

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  
    1414    RegisterObject(Wagnis);
    1515    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    }
    1624}
    1725//Destructor
     
    2129//Runs the game
    2230void Wagnis::start(){
    23    
     31    //SUPER(Wagnis,start);
     32    this->createGame();
     33}
     34
     35//Tick
     36void Wagnis::tick(float dt){
     37    SUPER(Wagnis,tick,dt);
    2438}
    2539
    2640//Creates and links all needed classes
    27 void createGame(){
     41void Wagnis::createGame(){\
     42    orxout() << "Game creation started";
    2843
     44    if(!findGameBoard()){
     45        orxout() << "Error: GameBoard not found";
     46    }
     47
     48    this->gameBoard->initializeNeighbors();
     49    orxout() << "Game creation finished";
    2950}
    3051
     52//Finds the pointer to the gameBoard
     53bool 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}
    3161
    3262
  • code/branches/wagnis_HS18/src/modules/wagnis/Wagnis.h

    r12119 r12124  
    55#define Wagnis_h
    66
    7 
     7#include "WagnisPrereqs.h"
    88#include "WagnisGameboard.h"
    99#include "WagnisProvince.h"
     10#include "WagnisPlayer.h"
    1011#include "gametypes/Deathmatch.h"
    1112
     
    2829
    2930
    30 enum GameStage { CHOOSE_PROVINCE_STAGE, REINFORCEMENT_STAGE, ATTACK_STAGE, MOVE_STAGE };
    31 
    3231namespace orxonox
    3332{
     
    3837        virtual ~Wagnis();
    3938        void start();
     39        void tick(float);
    4040
    4141
     
    4444
    4545        private:
     46        GameStage gameStage;
     47        std::vector<WagnisPlayer*> players;
    4648        void createGame();
     49        bool findGameBoard();
    4750    };
    4851}
  • code/branches/wagnis_HS18/src/modules/wagnis/WagnisGameboard.cc

    r12080 r12124  
    6262    //Parses the string and initializes the neigbors vector of all provinces according
    6363    //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;
    6566        orxout() << "inizializing started" << endl;
    6667        orxout() << "String size:" << endl;
  • code/branches/wagnis_HS18/src/modules/wagnis/WagnisGameboard.h

    r12119 r12124  
    99#define Wagnis_Gameboard_h
    1010
     11#include "WagnisPrereqs.h"
    1112#include "WagnisProvince.h"
    1213
     
    3536        //XML end
    3637       
    37         void initializeNeighbors(std::string);
     38        void initializeNeighbors();
    3839
    3940
    40        
     41
    4142        std::string connections_string;
    4243        std::vector<WagnisProvince*> provs;
  • code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.h

    r12119 r12124  
    77#define Wagnis_Player_h
    88
     9#include "WagnisPrereqs.h"
    910#include "Wagnis.h"
    1011#include "OrxonoxPrereqs.h"
     
    1617#include <string>
    1718#include "infos/HumanPlayer.h"
    18 
    19 enum MoveType { ATTACK, MOVE, SET_TROOPS, SET_TROOPS_INITIAL };
    2019
    2120
  • code/branches/wagnis_HS18/src/modules/wagnis/WagnisPrereqs.h

    r12049 r12124  
    6666{
    6767
     68    class Wagnis;
    6869    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 };
    6974
    7075}
Note: See TracChangeset for help on using the changeset viewer.