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
|
// server.cpp: little more than enhanced multicaster
// runs dedicated or as client coroutine
#include "cube.h"
#import "Client.h"
enum { ST_EMPTY, ST_LOCAL, ST_TCPIP };
static OFMutableArray<Client *> *clients;
int maxclients = 8;
static OFString *smapname;
// server side version of "entity" type
struct server_entity {
bool spawned;
int spawnsecs;
};
vector<server_entity> sents;
// true when map has changed and waiting for clients to send item
bool notgotitems = true;
int mode = 0;
void
restoreserverstate(
vector<entity> &ents) // hack: called from savegame code, only works in SP
{
loopv(sents)
{
sents[i].spawned = ents[i].spawned;
sents[i].spawnsecs = 0;
}
}
|
>
>
|
<
|
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
|
// server.cpp: little more than enhanced multicaster
// runs dedicated or as client coroutine
#include "cube.h"
#import "Client.h"
#import "Entity.h"
enum { ST_EMPTY, ST_LOCAL, ST_TCPIP };
static OFMutableArray<Client *> *clients;
int maxclients = 8;
static OFString *smapname;
// server side version of "entity" type
struct server_entity {
bool spawned;
int spawnsecs;
};
vector<server_entity> sents;
// true when map has changed and waiting for clients to send item
bool notgotitems = true;
int mode = 0;
// hack: called from savegame code, only works in SP
void
restoreserverstate(OFArray<Entity *> *ents)
{
loopv(sents)
{
sents[i].spawned = ents[i].spawned;
sents[i].spawnsecs = 0;
}
}
|