src/proto2/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 #include <list>
       
     7 
       
     8 class GameState {
       
     9 	public:
       
    10 		Dimension map_dimensions;
       
    11 		std::list<Player> player_list;
       
    12 
       
    13 		LocalPlayer &getLocalPlayer (void) {
       
    14 			// XXX: jotain
       
    15 		}
       
    16 };
       
    17 
       
    18 enum PlayerType {
       
    19 	PLAYER_LOCAL = 0x01;
       
    20 	PLAYER_REMOTE = 0x02;
       
    21 };
       
    22 
       
    23 class Player {
       
    24 	private:
       
    25 		Coordinate position;
       
    26 
       
    27 	public:
       
    28 
       
    29 		Player(Coordinate c) : position(c) {}
       
    30 
       
    31 		PlayerType type;
       
    32 		Dimensions dimensions;
       
    33 
       
    34 		Coordinate getPosition (void) const {
       
    35 			return this->position;
       
    36 		}
       
    37 };
       
    38 
       
    39 class LocalPlayer : public Player {
       
    40 	public:
       
    41 		void doMovement (PositionDelta d) {
       
    42 			this->position += d;
       
    43 
       
    44 			// XXX: notify server
       
    45 		}
       
    46 };
       
    47 
       
    48 class RemotePlayer : public Player {
       
    49 	public:
       
    50 		void updatePosition (Position p) {
       
    51 			this->position = p;
       
    52 		}
       
    53 }
       
    54 
       
    55 #endif