1 /////////////////////////////////////////
2 //
3 //             OpenLieroX
4 //
5 // code under LGPL, based on JasonBs work,
6 // enhanced by Dark Charlie and Albert Zeyer
7 //
8 //
9 /////////////////////////////////////////
10 
11 
12 // Client class
13 // Created 28/6/02
14 // Jason Boettcher
15 
16 
17 #ifndef __CCLIENT_H__
18 #define __CCLIENT_H__
19 
20 #include <string>
21 #include <vector>
22 #include <map>
23 #include <set>
24 #include "FastVector.h"
25 #include "CChatBox.h"
26 #include "Networking.h"
27 #include "CBytestream.h"
28 #include "CShootList.h"
29 #include "Version.h"
30 #include "FileDownload.h"
31 #include "Frame.h"
32 #include "CProjectile.h"
33 #include "CWpnRest.h"
34 #include "Consts.h"
35 #include "LieroX.h"
36 #include "CViewport.h"
37 #include "SafeVector.h"
38 
39 
40 namespace DeprecatedGUI {
41 	class CBrowser;
42 	class CListview;
43 	class CBar;
44 }
45 
46 class CHttpDownloadManager;
47 class CChannel;
48 class CClientNetEngine;
49 class CBonus;
50 class CMap;
51 class profile_t;
52 class FlagInfo;
53 
54 // TODO: this is just a small helper for now; some of these parts should just move into CClient::Connect
55 bool JoinServer(const std::string& addr, const std::string& name, const std::string& player);
56 
57 
58 // Chatbox line
59 class chat_line_t { public:
60 	std::string	sText;
61 	float	fTime;
62 	float	fScroll;
63 	int		iType;
64 };
65 
66 // Structure for logging worms
67 class log_worm_t { public:
68 	std::string	sName;
69 	std::string	sSkin;
70 	int			iLives;
71 	int			iKills;
72 	int			iID;
73 	int			iSuicides;
74 	int			iTeamKills;
75 	int			iTeamDeaths;
76 	int			iTeam;
77 	bool		bTagIT;
78 	TimeDiff	fTagTime;
79 	bool		bLeft;
80 	TimeDiff	fTimeLeft;
81 	int			iType;
82 };
83 
84 // Game log structure
85 class game_log_t { public:
86 	log_worm_t	*tWorms;
87 	int			iNumWorms;
88 	int			iWinner;
89 	AbsTime		fGameStart;
90 	std::string	sGameStart;
91 	std::string sServerName;
92 	std::string sServerIP;
93 };
94 
95 
96 class interface_sett { public:
97 	int		ChatterX;
98 	int		ChatterY;
99 	int		ChatBoxX;
100 	int		ChatBoxY;
101 	int		ChatBoxW;
102 	int		ChatBoxH;
103 	int		MiniMapX;
104 	int		MiniMapY;
105 	int		MiniMapW;
106 	int		MiniMapH;
107 	int		FpsX;
108 	int		FpsY;
109 	int		FpsW;
110 	int		PingX;
111 	int		PingY;
112 	int		PingW;
113 	int		LocalChatX;
114 	int		LocalChatY;
115 	int		CurrentSettingsX;
116 	int		CurrentSettingsY;
117 	int		ScoreboardX;
118 	int		ScoreboardY;
119 	int		CurrentSettingsTwoPlayersX;
120 	int		CurrentSettingsTwoPlayersY;
121 	int		ScoreboardOtherPosX;  // In local it's for two players, in net when selecting weapons
122 	int		ScoreboardOtherPosY;
123 	int		ChatboxScrollbarX;
124 	int		ChatboxScrollbarY;
125 	int		ChatboxScrollbarH;
126 	bool	ChatboxScrollbarAlwaysVisible;
127 	int		TimeLeftX;
128 	int		TimeLeftY;
129 	int		TimeLeftW;
130 
131 	// Player 1
132 	int		Lives1X;
133 	int		Lives1Y;
134 	int		Lives1W;
135 	int		Kills1X;
136 	int		Kills1Y;
137 	int		Kills1W;
138 	int		Team1X;
139 	int		Team1Y;
140 	int		Team1W;
141 	int		SpecMsg1X;
142 	int		SpecMsg1Y;
143 	int		SpecMsg1W;
144 	int		HealthLabel1X;
145 	int		HealthLabel1Y;
146 	int		WeaponLabel1X;
147 	int		WeaponLabel1Y;
148 
149 	// Player 2
150 	int		Lives2X;
151 	int		Lives2Y;
152 	int		Lives2W;
153 	int		Kills2X;
154 	int		Kills2Y;
155 	int		Kills2W;
156 	int		Team2X;
157 	int		Team2Y;
158 	int		Team2W;
159 	int		SpecMsg2X;
160 	int		SpecMsg2Y;
161 	int		SpecMsg2W;
162 	int		HealthLabel2X;
163 	int		HealthLabel2Y;
164 	int		WeaponLabel2X;
165 	int		WeaponLabel2Y;
166 	// NOTE: bars are handled in CBar class
167 };
168 
169 enum {
170 	DL_HTTP = 0,
171 	DL_UDP
172 };
173 
174 enum  {
175 	NAT_RESOLVING_DNS = 0,
176 	NAT_WAIT_TRAVERSE_REPLY,
177 	NAT_SEND_CHALLENGE,
178 	NAT_WAIT_CHALLENGE_REPLY
179 };
180 
181 
182 class CClient {
183 public:
184 	CClient();
185 	~CClient();
186 
187 	friend class CClientNetEngine;
188 	friend class CClientNetEngineBeta7;
189 	friend class CClientNetEngineBeta9;
190 
191 	typedef void (*DownloadFinishedCB) ();
192 
193 private:
194 	// Attributes
195 
196 	// Local Worms (pointers to the remote worms)
197 	uint		iNumWorms;
198 	CWorm		*cLocalWorms[MAX_PLAYERS];
199 	//int			iDrawingViews[2];
200     CViewport   cViewports[NUM_VIEWPORTS];
201 
202 	profile_t	*tProfiles[MAX_PLAYERS];
203 
204 	// Remote worms
205 	CWorm		*cRemoteWorms;
206 
207 	// Logging
208 	game_log_t	*tGameLog;
209 	int			iLastVictim;
210 	int			iLastKiller;
211 
212 
213 	// Map
214 	CMap		*cMap;
215 	bool		bMapGrabbed;
216 
217 	// Projectiles
218 	typedef FastVector<CProjectile,MAX_PROJECTILES> Projectiles;
219 	Projectiles	cProjectiles;
220 
221 public:
222 	struct MapPosIndex {
223 		static const int GRIDW = 20, GRIDH = 20;
224 		int x, y;
xMapPosIndex225 		MapPosIndex(int _x = 0, int _y = 0) : x(_x), y(_y) {}
MapPosIndexMapPosIndex226 		MapPosIndex(const VectorD2<int>& v) { x = v.x / GRIDW; y = v.y / GRIDH; }
227 
228 		bool operator==(const MapPosIndex& i) const { return x == i.x && y == i.y; }
229 		bool operator!=(const MapPosIndex& i) const { return !(*this == i); }
230 		bool operator<(const MapPosIndex& i) const { return y < i.y || (y == i.y && x < i.x); }
231 
232 		long index(const CMap* m) const;
233 	};
234 	typedef std::set<CProjectile*> ProjectileSet;
235 	typedef SafeVector<ProjectileSet> ProjectilePosMap;
236 	ProjectilePosMap projPosMap;
237 
238 private:
239 	// Frames
240 	frame_t		tFrames[NUM_FRAMES];
241 
242 	// Game
243 	SmartPointer<CGameScript> cGameScript;
244     CWpnRest    cWeaponRestrictions;
245 	GameOptions::GameInfo tGameInfo;	// Also game lobby
246 	FeatureCompatibleSettingList otherGameInfo;
247 	bool	bServerChoosesWeapons; // the clients will not get the weapon selection screen and the server sets it; if true, only >=Beta7 is supported
248 	FlagInfo*	m_flagInfo;
249 
250 	// Ping below FPS
251 	AbsTime		fMyPingSent;
252 	AbsTime		fMyPingRefreshed;
253 	int			iMyPing;
254 	TimeDiff	fServertime; // only in >=Beta8 correctly synchronised
255 
256 	int			iScoreboard[MAX_WORMS];
257 	int			iScorePlayers;
258 	int			iTeamScores[4];
259 	int			iTeamList[4];
260 
261 	// Interface
262 	interface_sett tInterfaceSettings;
263 	DeprecatedGUI::CBar		*cHealthBar1;
264 	DeprecatedGUI::CBar		*cHealthBar2;
265 	DeprecatedGUI::CBar		*cWeaponBar1;
266 	DeprecatedGUI::CBar		*cWeaponBar2;
267 	DeprecatedGUI::CBar		*cDownloadBar;
268 	SmartPointer<SDL_Surface> bmpBoxBuffer;
269 	SmartPointer<SDL_Surface> bmpBoxLeft;
270 	SmartPointer<SDL_Surface> bmpBoxRight;
271 	bool		bShouldRepaintInfo;
272 	bool		bCurrentSettings;
273 
274 
275 	// Game menu && score
276 	bool		bUpdateScore;
277 	AbsTime		fLastScoreUpdate;
278 
279 	// Ingame scoreboard
280 	SmartPointer<SDL_Surface> bmpIngameScoreBg;
281 
282 	// Bonus's
283 	CBonus		*cBonuses;
284 
285 	// Chatbox
286 	int			iChat_Numlines;
287 	chat_line_t	tChatLines[MAX_CHATLINES];
288 
289 	CChatBox	cChatbox;		// Our chatbox
290 	DeprecatedGUI::CBrowser	*cChatList;		// Ingame chatlist
291 	bool		bRepaintChatbox;
292 
293 	// Send chat
294 	bool		bChat_Typing;
295 	UnicodeChar	iChat_Lastchar;
296 	bool		bChat_Holding;
297 	size_t		iChat_Pos;
298 	AbsTime		fChat_TimePushed;
299 	CInput		cChat_Input;
300 	CInput		cTeamChat_Input;
301 	bool		bTeamChat;
302 	std::string	sChat_Text;
303 	TimeDiff	fChat_BlinkTime;
304 	bool		bChat_CursorVisible;
305 
306     CInput      cShowScore;
307 	CInput		cShowHealth;
308 	CInput		cShowSettings;
309 	CInput		cViewportMgr;
310 	CInput		cToggleTopBar;
311 
312 	bool		bMuted;
313 
314     // Viewport manager
315     bool        bViewportMgr;
316 
317 	// Network
318 	CClientNetEngine * cNetEngine;	// Should never be NULL, to skip some checks
319 	int			iNetSpeed;
320 	int			iNetStatus;
321 	int			reconnectingAmount;
322 	std::string	strServerAddr;
323 	std::string	strServerAddr_HumanReadable;
324 	NetworkAddr	cServerAddr;
325 	int			iNumConnects;
326 	AbsTime		fConnectTime;
327 	int			iChallenge;
328 	AbsTime		fLastReceived;
329 	SmartPointer<NetworkSocket>	tSocket;
330 	CChannel	* cNetChan;
331 	CBytestream	bsUnreliable;
332 	CShootList	cShootList;
333     AbsTime      fZombieTime;
334 	TimeDiff	fSendWait;
335 	AbsTime		fLastUpdateSent;
336 	std::string	szServerName;
337 	bool		bHostAllowsStrafing;
338 	Version		cClientVersion;
339 	Version		cServerVersion;
340 	bool		bLocalClient;
341 
342 	// Map downloading
343 	bool		bDownloadingMap;
344 	CHttpDownloadManager *cHttpDownloader;
345 	std::string	sMapDownloadName;
346 	bool		bDlError;
347 	std::string	sDlError;
348 	int			iDlProgress;
349 	int			iDownloadMethod;  // HTTP or UDP
350 	bool		bWaitingForMap;  // In game and waiting for the map to finish downloading
351 	DownloadFinishedCB tMapDlCallback;
352 
353 	// Mod downloading
354 	bool		bDownloadingMod;
355 	std::string	sModDownloadName;
356 	bool		bWaitingForMod;
357 	DownloadFinishedCB tModDlCallback;
358 
359 	CUdpFileDownloader	cUdpFileDownloader;
360 	AbsTime		fLastFileRequest;
361 	AbsTime		fLastFileRequestPacketReceived;
362 	size_t		iModDownloadingSize;	// For progress bar, UDP only
363 
364 	bool		bReadySent;
365 
366 	bool		bGameOver;
367 	bool		bGameMenu;
368 	int			iMatchWinner;
369 	int			iMatchWinnerTeam;
370 	AbsTime		fGameOverTime;
371 
372 	bool		bLobbyReady;
373 	bool		bGameReady; // bGameReady says if the game (including cMap) has been initialized
374 	bool		bGameRunning; // game was started and is running (implies bGameReady, but our own worm could be in weapon selection)
375 	bool		bHaveMap;
376 	bool		bHaveMod;
377 
378 	bool		bBadConnection;
379 	std::string	strBadConnectMsg;
380 
381 	bool		bServerError;
382 	std::string	strServerErrorMsg;
383 
384     bool		bClientError;
385 
386 	std::string	strDebug;	// This is only a debug string which is reset after each frame and which is printed on the screen.
387 
388 	struct		cSpectatorViewportKeys_t {
389 				CInput Up, Down, Left, Right, V1Type, V2Type, V2Toggle;
390 	} cSpectatorViewportKeys;
391 	std::string	sSpectatorViewportMsg;
392 	AbsTime		fSpectatorViewportMsgTimeout;
393 	int			iNatTraverseState;
394 	bool		bConnectingBehindNat;
395 	AbsTime		fLastChallengeSent;
396 	AbsTime		fLastTraverseSent;
397 	int			iNatTryPort;
398 	std::string sUdpMasterserverAddress;
399 
400 public:
401 	// HINT: saves the current time of the simulation
402 	// TODO: should be moved later to PhysicsEngine
403 	// but it's not possible in a clean way until we have no simulateWorld()
404 	// there which simulates everything together
405 	// HINT: this is currently used for simulating the projectiles
406 	// if you are going to use this also for something else,
407 	// then be sure that is is run together with simulateProjectiles() !
408 	AbsTime	fLastSimulationTime;
409 
410 // IRC callbacks
411 private:
412 	static void IRC_OnNewMessage(const std::string& msg, int type);
413 	static void IRC_OnDisconnect();
414 
415 public:
416 	// Methods
417 
418 	void		Clear();
419 	void		MinorClear();
420 	int			Initialize();
421 	void		Shutdown();
422 	void		FinishGame();
423 	void		ReinitLocalWorms();
424 
425 	// Logging
426 	void		StartLogging(int num_players);
427 	void		ShutdownLog();
428 	log_worm_t	*GetLogWorm(int id);
429 	void		GetLogData(std::string& data);
430 
431 	std::list<int> AddRandomBots(int amount = 1, bool outOfGame = false); // returns list of added worms
432 	int			AddWorm(profile_t* p, bool outOfGame = false); // returns -1 if failed, worm id otherwise
433 	void		RemoveWorm(int id);
434 
435 	// Game
436 	void		Simulation();
437 	void		SetupViewports();
438 	void		SetupViewports(CWorm *w1, CWorm *w2, int type1, int type2);
439 	void		SendCarve(CVec pos);
440 	void		PlayerShoot(CWorm *w);
441 	void		ShootSpecial(CWorm *w);
442 	void		DrawBeam(CWorm *w);
443 	void		ProcessServerShotList();
444 	void		DoLocalShot( float fTime, float fSpeed, int nAngle, CWorm *pcWorm );
445 	void		ProcessShot(shoot_t *shot, AbsTime fSpawnTime);
446 	void		ProcessShot_Beam(shoot_t *shot);
447 
448 	void		BotSelectWeapons();
449 
450 	void		SpawnProjectile(CVec pos, CVec vel, int rot, int owner, proj_t *_proj, int _random, AbsTime time, AbsTime ignoreWormCollBeforeTime);
451     void        disableProjectile(CProjectile *prj);
452 	void		Explosion(CVec pos, float damage, int shake, int owner);
453 	void		InjureWorm(CWorm *w, float damage, int owner);
454 	void		UpdateScoreboard();
455 	void		LaserSight(CWorm *w, float Angle, bool highlightCrosshair = true);
456 
457 	void		processChatter();
458     void        processChatCharacter(const KeyboardEvent& input);
459 
460 	void		DestroyBonus(int id, bool local, int wormid);
461 
462 	CVec		FindNearestSpot(CWorm *w);
463 
464 	// Main
465 	void		Frame();
466 
467 	// Drawing
468 	bool		InitializeDrawing();
469 	bool		InitializeBar(int number);
470 	void		DrawPlayerWaitingColumn(SDL_Surface * bmpDest, int x, int y, std::list<CWorm *>::iterator& it, const std::list<CWorm *>::iterator& last, int num);
471 	void		DrawPlayerWaiting(SDL_Surface * bmpDest);
472 	void		DrawBox(SDL_Surface * dst, int x, int y, int w);
473 	void		Draw(SDL_Surface * bmpDest);
474 	void		DrawViewport(SDL_Surface * bmpDest, int viewport_index);
475 	void		DrawViewport_Game(SDL_Surface* bmpDest, CViewport* v);
476 	void		DrawProjectiles(SDL_Surface * bmpDest, CViewport *v);
477     void        DrawProjectileShadows(SDL_Surface * bmpDest, CViewport *v);
478 	void		InitializeGameMenu();
479 	void		DrawGameMenu(SDL_Surface * bmpDest);
480 	void		DrawBonuses(SDL_Surface * bmpDest, CViewport *v);
481 	void		UpdateScore(DeprecatedGUI::CListview *Left, DeprecatedGUI::CListview *Right);
482 	void		UpdateIngameScore(DeprecatedGUI::CListview *Left, DeprecatedGUI::CListview *Right, bool WaitForPlayers);
483 	void		InitializeIngameScore(bool WaitForPlayers);
484 	void		DrawTime(SDL_Surface * bmpDest, int x, int y, float t);
485 	void		DrawReadyOverlay(SDL_Surface * bmpDest);
486 	void		DrawText(SDL_Surface * bmpDest, bool centre, int x, int y, Color fgcol, const std::string& buf);
487 	void		DrawLocalChat(SDL_Surface * bmpDest);
488 	void		DrawRemoteChat(SDL_Surface * bmpDest);
489     void        DrawScoreboard(SDL_Surface * bmpDest);
490 	void        DrawCurrentSettings(SDL_Surface * bmpDest);
491 
492     void        InitializeViewportManager();
493     void        DrawViewportManager(SDL_Surface * bmpDest);
494 	void		InitializeSpectatorViewportKeys();
495 	void		ProcessSpectatorViewportKeys();	// Fast camera mode switching when local worm is dead
496 	void		SimulateHud();
497 	int			getTopBarBottom();
498 	int			getBottomBarTop();
499 	void		DrawChatter(SDL_Surface * bmpDest);
500 	void		SetupGameInputs(); // Re-setup inputs for worms, viewports and all game actions
501 
getNetEngine()502 	CClientNetEngine * getNetEngine() { return cNetEngine; };
503 	void		setNetEngineFromServerVersion();
504 
505 	void		Connect(const std::string& address);
506 	void		Reconnect();
507 	void		Connecting(bool force = false);
508 	void		ConnectingBehindNAT();
509 	void		SetSocketWithEvents(bool v);
510 	void		Disconnect();
511 
512 	bool		ReadPackets();
513 	void		SendPackets(bool sendPendingOnly = false);
514 
515 	void		InitializeDownloads();
516 	void		DownloadMap(const std::string& mapname);
517 	void		ProcessMapDownloads();
518 	void		AbortDownloads();
519 	void		ShutdownDownloads();
520 	void		FinishMapDownloads();
521 	void		DownloadMod(const std::string& modname);
522 	void		ProcessModDownloads();
523 	void		FinishModDownloads();
524 	void		ProcessUdpUploads();
525 
526 	// Variables
getChannel()527 	CChannel	*getChannel()			{ return cNetChan; }
528 	CChannel	*createChannel(const Version& v);
getStatus()529 	int			getStatus()				{ return iNetStatus; }
setStatus(int _s)530 	void		setStatus(int _s)			{ iNetStatus = _s; }
getUnreliable()531 	CBytestream	*getUnreliable()		{ return &bsUnreliable; }
532 	bool		RebindSocket();	// If client has taken the port on which server should start - free it
533 
getMap()534 	CMap*		getMap() const				{ return cMap; }
535 	bool		isMapReady() const;
resetMap()536 	void		resetMap()					{ cMap = NULL; }
537 
canSimulate()538 	bool		canSimulate() const			{ return bGameReady && !bGameOver && isMapReady(); }
539 
540 	int			OwnsWorm(int id);
getNumWorms()541 	int			getNumWorms()			{ return iNumWorms; }
setNumWorms(int _w)542 	void		setNumWorms(int _w)			{ iNumWorms = _w; }
543 	bool		canAddWorm(std::string* noReason = NULL);
544 
getWorm(int w)545 	CWorm		*getWorm(int w)				{ return cLocalWorms[w]; }
setWorm(int i,CWorm * w)546 	void		setWorm(int i, CWorm *w)	{ cLocalWorms[i] = w; }
547 
serverChoosesWeapons()548 	bool		serverChoosesWeapons()		{ return bServerChoosesWeapons; }
549 
550 	void		clearHumanWormInputs();
551 	void		clearLocalWormInputs();
552 
getRemoteWorms()553 	CWorm		*getRemoteWorms()		{ return cRemoteWorms; }
554 	int			getTeamWormCount(int t) const;
getGameReady()555 	bool		getGameReady()			{ return bGameReady; }
setGameReady(bool _g)556 	void		setGameReady(bool _g)		{ bGameReady = _g; }
557 
getChatbox()558     CChatBox    *getChatbox()           { return &cChatbox; }
setRepaintChatbox(bool _r)559 	void		setRepaintChatbox(bool _r)  { bRepaintChatbox = true; }
560 
getGameLobby()561 	GameOptions::GameInfo *getGameLobby()		{ return &tGameInfo; }
562 
getBadConnection()563 	bool		getBadConnection()		{ return bBadConnection; }
getBadConnectionMsg()564 	std::string	getBadConnectionMsg()	{ return strBadConnectMsg; }
565 
getServerError()566 	bool		getServerError()		{ return bServerError; }
getServerErrorMsg()567 	std::string	getServerErrorMsg()		{ return strServerErrorMsg; }
568 
getClientError()569     bool		getClientError()        { return bClientError; }
570 
getLastReceived()571 	AbsTime		getLastReceived()		{ return fLastReceived; }
setLastReceived(const AbsTime & _l)572 	void		setLastReceived(const AbsTime& _l)	{ fLastReceived = _l; }
573 
getNetSpeed()574 	int			getNetSpeed()			{ return iNetSpeed; }
setNetSpeed(int _n)575 	void		setNetSpeed(int _n)			{ iNetSpeed = _n; }
576 
getShootList()577 	CShootList	*getShootList()			{ return &cShootList; }
getBonusList()578     CBonus      *getBonusList()         { return cBonuses; }
getWeaponRestrictions()579 	CWpnRest*	getWeaponRestrictions()		{ return &cWeaponRestrictions; }
getGameScript()580 	SmartPointer<CGameScript>& getGameScript() { return cGameScript; }
581 
setZombieTime(const AbsTime & z)582     void        setZombieTime(const AbsTime& z)      { fZombieTime = z; }
getZombieTime()583     AbsTime       getZombieTime()         { return fZombieTime; }
584 
getFrame(int FrameID)585 	frame_t		*getFrame(int FrameID)		{ return &tFrames[ FrameID ]; }
586 
getTeamScore(int team)587 	int			getTeamScore(int team)		{ if(team >= 0 && team < 4) return iTeamScores[team]; else return 0; }
588 
isTyping()589 	bool		isTyping()				{ return bChat_Typing; }
setChatPos(size_t v)590 	void		setChatPos(size_t v)		{ iChat_Pos = v; }
chatterText()591 	std::string& chatterText()		{ return sChat_Text; }
592 	std::string	getChatterCommand();
593 
getMuted()594 	bool		getMuted()				{ return bMuted; }
setMuted(bool _m)595 	void		setMuted(bool _m)			{ bMuted = _m; }
596 
597 	int	getPing();
598 	void setPing(int _p);
599 
getMyPing()600 	int getMyPing()							{ return iMyPing; } // Use only when iGameType == GME_JOIN
601 
serverTime()602 	TimeDiff serverTime()						{ return fServertime; }
603 
getServerAddress()604 	const std::string& getServerAddress()		{ return strServerAddr; }
getServerAddr_HumanReadable()605 	std::string getServerAddr_HumanReadable()		{ return strServerAddr_HumanReadable; }
606 
setServerName(const std::string & _n)607 	void setServerName(const std::string& _n)		{ szServerName = _n; }
getServerName()608 	const std::string& getServerName()			{ return szServerName; }
609 
getGeneralGameType()610 	int getGeneralGameType() const				{ return tGameInfo.iGeneralGameType; }
isTeamGame()611 	bool isTeamGame() const						{ return tGameInfo.iGeneralGameType == GMT_TEAMS; }
612 
getClientVersion()613 	const Version& getClientVersion()				{ return cClientVersion; }
614 	void setClientVersion(const Version& v);
getServerVersion()615 	const Version& getServerVersion()				{ return cServerVersion; }
616 	void setServerVersion(const std::string & _s);
617 
getUnknownFeatures()618 	FeatureCompatibleSettingList& getUnknownFeatures() { return otherGameInfo; } // Both unknown and server-side features here
619 
isHostAllowingStrafing()620 	bool isHostAllowingStrafing()				{ return bHostAllowsStrafing; }
621 
getGamePaused()622 	bool		getGamePaused()					{ return (bViewportMgr || bGameMenu) && tLX->iGameType == GME_LOCAL; }
623 
getDlProgress()624 	int			getDlProgress()					{ return iDlProgress; }
getDownloadingMap()625 	bool		getDownloadingMap()				{ return bDownloadingMap; }
getDownloadingMod()626 	bool		getDownloadingMod()				{ return bDownloadingMod; }
getDownloadMethod()627 	int			getDownloadMethod()				{ return iDownloadMethod; }
getDownloadingError()628 	bool		getDownloadingError()			{ return bDlError; }
clearDownloadingError()629 	void		clearDownloadingError()			{ bDlError = false; }
getDownloadingErrorMessage()630 	std::string	getDownloadingErrorMessage()	{ return sDlError; }
631 
getViewports()632 	CViewport * getViewports()					{ return cViewports; }
633 	bool		isWormVisibleOnAnyViewport(int worm) const;
634 
getUdpFileDownloader()635 	CUdpFileDownloader * getUdpFileDownloader()	{ return &cUdpFileDownloader; };
getLastFileRequest()636 	AbsTime		getLastFileRequest()					{ return fLastFileRequest; };
setLastFileRequest(const AbsTime & _f)637 	void		setLastFileRequest( const AbsTime& _f ) 			{ fLastFileRequest = _f; };
getLastFileRequestPacketReceived()638 	AbsTime		getLastFileRequestPacketReceived()		{ return fLastFileRequestPacketReceived; };
setLastFileRequestPacketReceived(const AbsTime & _f)639 	void		setLastFileRequestPacketReceived( const AbsTime& _f ) { fLastFileRequestPacketReceived = _f; };
640 
isGameMenu()641 	bool		isGameMenu()			{ return bGameMenu; }
isChatTyping()642 	bool		isChatTyping()			{ return bChat_Typing; }
isGameOver()643 	bool		isGameOver()			{ return bGameOver; }
shouldRepaintInfo()644 	bool&		shouldRepaintInfo()		{ return bShouldRepaintInfo; }
645 
setReadySent(bool b)646 	void		setReadySent(bool b)	{ bReadySent = b; }
647 	bool		shouldDoProjectileSimulation();
648 
isLocalClient()649 	bool		isLocalClient()			{ return bLocalClient; }
setLocalClient(bool _l)650 	void		setLocalClient(bool _l)	{ bLocalClient = _l; }
651 
652 	std::string	debugName();
653 
getHaveMap()654 	bool		getHaveMap()			{ return bHaveMap; }
getHaveMod()655 	bool		getHaveMod()			{ return bHaveMod; }
setHaveMap(bool _b)656 	void		setHaveMap( bool _b )	{ bHaveMap = _b; }
setHaveMod(bool _b)657 	void		setHaveMod( bool _b )	{ bHaveMod = _b; }
658 	int			getNumRemoteWorms();
getLocalWormProfiles()659 	profile_t	**getLocalWormProfiles()	{ return tProfiles; }
flagInfo()660 	FlagInfo*	flagInfo()			{ return m_flagInfo; }
661 
isTeamGame()662 	bool		isTeamGame() { return getGameLobby()->iGeneralGameType == GMT_TEAMS; }
isTagGame()663 	bool		isTagGame() { return getGameLobby()->iGeneralGameType == GMT_TIME; }
664 
setOnMapDlFinished(DownloadFinishedCB f)665 	void		setOnMapDlFinished(DownloadFinishedCB f)  { tMapDlCallback = f; }
setOnModDlFinished(DownloadFinishedCB f)666 	void		setOnModDlFinished(DownloadFinishedCB f)  { tModDlCallback = f; }
667 
getProjectiles()668 	Projectiles & getProjectiles()		{ return cProjectiles; }
669 
670 	void		DumpGameState(CmdLineIntf* caller);
671 
addDebugStr(const std::string & str)672 	void		addDebugStr(const std::string& str) { if(strDebug != "") strDebug += "\n" + str; else strDebug = str; }
resetDebugStr()673 	void		resetDebugStr() { strDebug = ""; }
674 };
675 
676 extern	CClient			*cClient;
677 
678 
679 
680 #endif  //  __CCLIENT_H__
681