-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGameClient.h
More file actions
62 lines (50 loc) · 1.24 KB
/
GameClient.h
File metadata and controls
62 lines (50 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
* GameClient.h
*
* Created on: 05.05.2013
* Author: urandon
*/
#ifndef GAMECLIENT_H_
#define GAMECLIENT_H_
#include "TypedClient.h"
#include "Task.h"
class GameClient: public TypedClient {
public:
GameClient(const char * ip, int port, struct timeval default_timeval);
virtual ~GameClient();
void perform(int subtype, int quantity, int price);
int getInfo(int gtype, int subtype, int player_id, int quantity, int price);
private:
void getGlobals();
int check(struct timeval timeout);
int checkForFeedback(struct timeval timeout);
int getSpace(const char * s);
int getGeneralInfo(int subtype);
int getMarketInfo(int subtype);
int getPlayerInfo(int subtype, int id);
int getAuctionInfo(int subtype, int id);
void wait4turn();
struct timeval default_timeval;
static const int SENDBUFFER_SIZE;
char * send_buffer;
struct globals_t {
bool can_perform;
bool game_started;
int myid;
int month_no;
int players; // active_players;
struct market_t {
int state;
int supply, raw_price;
int demand, production_price;
} market;
} globals;
struct player_auct_t {
int produced;
int bought_quan, bought_price;
int sold_quan, sold_price;
player_auct_t();
};
player_auct_t * aucts;
};
#endif /* GAMECLIENT_H_ */