proto/p2/GameState.hh
changeset 5 617813994ab1
parent 4 e28b28b8817c
child 6 faa4e777cc6e
equal deleted inserted replaced
4:e28b28b8817c 5:617813994ab1
     1 #ifndef GAMESTATE_HH
       
     2 #define GAMESTATE_HH
       
     3 
       
     4 #include "Dimension.hh"
       
     5 
       
     6 class GameState {
       
     7 	public:
       
     8 		Dimension map_dimensions;
       
     9 		std::list<Player> player_list;
       
    10 
       
    11 		LocalPlayer &getLocalPlayer (void) {
       
    12 			// XXX: jotain
       
    13 		}
       
    14 };
       
    15 
       
    16 enum PlayerType {
       
    17 	PLAYER_LOCAL = 0x01;
       
    18 	PLAYER_REMOTE = 0x02;
       
    19 };
       
    20 
       
    21 class Player {
       
    22 	private:
       
    23 		Coordinate position;
       
    24 
       
    25 	public:
       
    26 
       
    27 		Player(Coordinate c) : position(c) {}
       
    28 
       
    29 		PlayerType type;
       
    30 		Dimensions dimensions;
       
    31 
       
    32 		Coordinate getPosition (void) const {
       
    33 			return this->position;
       
    34 		}
       
    35 };
       
    36 
       
    37 class LocalPlayer : public Player {
       
    38 	public:
       
    39 		void doMovement (PositionDelta d) {
       
    40 			this->position += d;
       
    41 
       
    42 			// XXX: notify server
       
    43 		}
       
    44 };
       
    45 
       
    46 class RemotePlayer : public Player {
       
    47 	public:
       
    48 		void updatePosition (Position p) {
       
    49 			this->position = p;
       
    50 		}
       
    51 }
       
    52 
       
    53 #endif