Inexor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
gamemode_server.hpp
Go to the documentation of this file.
1 #pragma once
7 
8 // TODO: make vector<players> extendable by mode
9 
10 namespace server {
11 
12 extern void startintermission();
13 
14 // true when map has changed and waiting for clients to send item
15 extern bool notgotitems;
16 
17 extern int interm;
18 
19 extern int gamelimit;
20 
21 extern vector<entity> ments;
23 
24 struct servmode
25 {
26  virtual ~servmode() {}
27 
28  virtual void entergame(clientinfo *ci) {}
29  virtual void leavegame(clientinfo *ci, bool disconnecting = false) {}
30  virtual void connected(clientinfo *ci) {}
31 
32  virtual void moved(clientinfo *ci, const vec &oldpos, bool oldclip, const vec &newpos, bool newclip) {}
33  virtual bool canspawn(clientinfo *ci, bool connecting = false) { return true; }
34  virtual void spawned(clientinfo *ci) {}
35  virtual int fragvalue(clientinfo *victim, clientinfo *actor)
36  {
37  if(victim==actor || isteam(victim->team, actor->team)) return -1;
38  return 1;
39  }
40  virtual bool canhit(clientinfo *victim, clientinfo *actor) { return true; }
41  virtual void died(clientinfo *victim, clientinfo *actor) {}
42  virtual bool canchangeteam(clientinfo *ci, const char *oldteam, const char *newteam) { return true; }
43  virtual void changeteam(clientinfo *ci, const char *oldteam, const char *newteam) {}
44  virtual void initclient(clientinfo *ci, packetbuf &p, bool connecting) {}
45  virtual void update() {}
46  virtual void updatelimbo() {}
47  virtual void cleanup() {}
48  virtual void setup() {}
49  virtual void newmap() {}
50  virtual void intermission() {}
51  virtual bool hidefrags() { return false; }
52  virtual int getteamscore(const char *team) { return 0; }
54  virtual bool extinfoteam(const char *team, ucharbuf &p) { return false; }
55 
62  virtual bool parse_network_message(int type, clientinfo *ci, clientinfo *cq, packetbuf &p) = 0;
63 };
64 extern servmode *smode;
65 } // ns server
virtual void cleanup()
Definition: gamemode_server.hpp:47
vector< entity > ments
Definition: server.cpp:265
Definition: client_management.hpp:217
Vector template.
Definition: cube_vector.hpp:22
vector< savedscore > scores
Definition: client_management.cpp:367
virtual void changeteam(clientinfo *ci, const char *oldteam, const char *newteam)
Definition: gamemode_server.hpp:43
template implementation of buffers (networking e.g.).
Definition: buffer_types.hpp:14
virtual void spawned(clientinfo *ci)
Definition: gamemode_server.hpp:34
virtual void newmap()
Definition: gamemode_server.hpp:49
int gamelimit
Definition: server.cpp:55
virtual bool canhit(clientinfo *victim, clientinfo *actor)
Definition: gamemode_server.hpp:40
virtual int getteamscore(const char *team)
Definition: gamemode_server.hpp:52
virtual bool parse_network_message(int type, clientinfo *ci, clientinfo *cq, packetbuf &p)=0
process gamemode specific network messages.
virtual void entergame(clientinfo *ci)
Definition: gamemode_server.hpp:28
virtual void updatelimbo()
Definition: gamemode_server.hpp:46
virtual bool hidefrags()
Definition: gamemode_server.hpp:51
#define isteam(a, b)
Definition: gamemode.hpp:105
virtual void setup()
Definition: gamemode_server.hpp:48
virtual void intermission()
Definition: gamemode_server.hpp:50
string team
Definition: client_management.hpp:220
virtual ~servmode()
Definition: gamemode_server.hpp:26
virtual bool canspawn(clientinfo *ci, bool connecting=false)
Definition: gamemode_server.hpp:33
vector with 3 floats and some useful methods.
Definition: geom.hpp:110
virtual void died(clientinfo *victim, clientinfo *actor)
Definition: gamemode_server.hpp:41
virtual void initclient(clientinfo *ci, packetbuf &p, bool connecting)
Definition: gamemode_server.hpp:44
virtual void moved(clientinfo *ci, const vec &oldpos, bool oldclip, const vec &newpos, bool newclip)
Definition: gamemode_server.hpp:32
virtual void leavegame(clientinfo *ci, bool disconnecting=false)
Definition: gamemode_server.hpp:29
int interm
Definition: server.cpp:57
servmode * smode
Definition: server.cpp:292
virtual void update()
Definition: gamemode_server.hpp:45
virtual bool canchangeteam(clientinfo *ci, const char *oldteam, const char *newteam)
Definition: gamemode_server.hpp:42
virtual void getteamscores(vector< teamscore > &scores)
Definition: gamemode_server.hpp:53
void startintermission()
Definition: server.cpp:1156
vector< server_entity > sents
Definition: server.cpp:266
network packet buffer
Definition: buffer_types.hpp:132
virtual void connected(clientinfo *ci)
Definition: gamemode_server.hpp:30
Definition: gamemode_server.hpp:24
bool notgotitems
Definition: server.cpp:67
virtual int fragvalue(clientinfo *victim, clientinfo *actor)
Definition: gamemode_server.hpp:35
virtual bool extinfoteam(const char *team, ucharbuf &p)
Definition: gamemode_server.hpp:54