Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 12109 for code


Ignore:
Timestamp:
Nov 21, 2018, 10:19:21 AM (5 years ago)
Author:
stadlero
Message:

Player class does now compile

Location:
code/branches/wagnis_HS18/src/modules/wagnis
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/wagnis_HS18/src/modules/wagnis/CMakeLists.txt

    r12100 r12109  
    22  WagnisProvince.cc
    33  WagnisGameboard.cc
     4  WagnisPlayer.cc
    45)
    56
  • code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.cc

    r12105 r12109  
    1414
    1515    //Constructor
    16     WagnisPlayer::WagnisPlayer(Context* context,WagnisGameboard* gb) : Baseclass(context){
     16    WagnisPlayer::WagnisPlayer(Context* context) : HumanPlayer(context){
    1717        RegisterObject(WagnisPlayer);
    1818        this->origin = nullptr;
    1919        this->target = nullptr;
    20         this->gameBoard = gb;
     20        this->gameBoard = nullptr;
    2121    }
    2222    //Destructor
     
    2929    }
    3030    //checks if a move is valid, possible MoveTypes: ATTACK, MOVE, SET_TROOPS, SET_TROOPS_INITIAL
    31     bool WagnisPlayer::checkMove(WagnisProvince*,WagnisProvince*,MoveType)
     31    bool WagnisPlayer::checkMove(WagnisProvince*,WagnisProvince*,MoveType move_type)
    3232    {
    33         if (MoveType == ATTACK)
     33        if (move_type == ATTACK)
    3434        {
    3535            if (isNeighbour(this->origin, this->target))//TODO: provinces neighbours
     
    4343        }
    4444
    45         if (MoveType == MOVE)
     45        if (move_type == MOVE)
    4646        {
    4747            if (existPath(this->origin, this->target))//TODO: path exists, all belong to same player
     
    5353        }
    5454
    55         if (MoveType == SET_Troops)
     55        if (move_type == SET_TROOPS)
    5656        {
    5757            if (this->target->getOwner_ID() == this->Player_ID)//target belongs to player
     
    5959        }
    6060
    61         if (MoveType == SET_TROOPS_INITIAL)
     61        if (move_type == SET_TROOPS_INITIAL)
    6262        {
    6363            if (this->target->getOwner_ID() == 0)//target belongs to nobody
     
    8181    std::string WagnisPlayer::toString(){
    8282        std::string str = "Player ";
    83         str.append(std::to_string(Player_ID);
     83        str.append(std::to_string(Player_ID));
    8484        return str;
    8585    }
     
    8989    bool WagnisPlayer::isNeighbour(WagnisProvince*,WagnisProvince*)
    9090    {
    91         for (int i = 0; i < this->origin->neighbors.size(); ++i)
     91        for (unsigned int i = 0; i < this->origin->neighbors.size(); ++i)
    9292        {
    93             if (this->target == this->origin->neighbors(i))
     93            if (this->target == this->origin->neighbors[i])
    9494                return true;
    9595        }
     
    105105            return true;
    106106       
    107         for (int i = 0; i < this->origin->neighbors.size(); ++i)
     107        for (unsigned int i = 0; i < this->origin->neighbors.size(); ++i)
    108108        {
    109             if (this->origin->getOwner_ID() == this->origin->neighbors(i)->getOwner_ID())
    110                 return existPath(this->origin->neighbors(i), this->target);
     109            if (this->origin->getOwner_ID() == this->origin->neighbors[i]->getOwner_ID())
     110                return existPath(this->origin->neighbors[i], this->target);
    111111        }
    112112           
  • code/branches/wagnis_HS18/src/modules/wagnis/WagnisPlayer.h

    r12105 r12109  
    1414#include <vector>
    1515#include <string>
     16#include "infos/HumanPlayer.h"
    1617
    1718enum MoveType { ATTACK, MOVE, SET_TROOPS, SET_TROOPS_INITIAL };
     
    2122namespace orxonox
    2223{
    23     class WagnisPlayer : public BaseClass
     24    class WagnisPlayer : public HumanPlayer
    2425    {
    2526    public:
    26         WagnisPlayer(Context*,WagnisGameboard*);
     27        WagnisPlayer(Context*);
    2728        virtual ~WagnisPlayer();
    2829
Note: See TracChangeset for help on using the changeset viewer.