-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathFlagInfo.h
82 lines (66 loc) · 1.8 KB
/
FlagInfo.h
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
* FlagInfo.h
* OpenLieroX
*
* Created by Albert Zeyer on 20.03.09.
* code under LGPL
*
*/
#ifndef __OLX__FLAGINFO_H__
#define __OLX__FLAGINFO_H__
#include "CVec.h"
#include "olx-types.h"
class CBytestream;
class CWorm;
class CServerConnection;
struct SDL_Surface;
class CViewport;
class CGameSkin;
class CMap;
struct FlagSpawnPoint {
CVec pos;
};
struct Flag {
Flag(int i = 0); ~Flag();
Flag(const Flag& f) : id(0), skin(NULL) { operator=(f); }
Flag& operator=(const Flag& f);
int id;
CVec pos; // only relevant if no holder worm
int holderWorm;
FlagSpawnPoint spawnPoint;
bool atSpawnPoint;
CGameSkin* skin;
CVec getPos();
void setCustomPos(const CVec& p) { pos = p; atSpawnPoint = false; holderWorm = -1; }
void setHolderWorm(int w) { atSpawnPoint = false; holderWorm = w; }
void setBack() { atSpawnPoint = true; holderWorm = -1; }
bool operator<(const Flag& f) const { return id < f.id; }
};
struct FlagInfoData;
class FlagInfo {
private:
FlagInfoData* data;
public:
FlagInfo(); ~FlagInfo();
void reset();
void readUpdate(CBytestream* bs);
static void skipUpdate(CBytestream* bs);
Flag* initFlag(int id);
Flag* getFlag(int id);
Flag* getFlagOfWorm(int worm);
bool removeFlag(int id);
int getWidth() const;
int getHeight() const;
Flag* applyInitFlag(int id, const CVec& spawnPos);
void applyRemoveFlag(int id);
void applyCustomPos(Flag* flag, const CVec& pos);
void applySpawnPos(Flag* flag, const CVec& spawnPos);
void applyHolderWorm(Flag* flag, int w);
void applySetBack(Flag* flag);
void sendCurrentState(CServerConnection* cl);
void checkWorm(CWorm* worm);
void draw(SDL_Surface* bmpDest, CViewport* v);
void drawWormAttachedFlag(CWorm* worm, SDL_Surface* bmpDest, CViewport* v);
void drawOnMiniMap(CMap* cMap, SDL_Surface* bmpDest, uint miniX, uint miniY);
};
#endif