58typedef struct ipfilter_s {
63#define MAX_IPFILTERS 1024
77 for (
int i = 0;
i < 4;
i++) {
78 if (*s <
'0' || *s >
'9') {
98 f->mask = *(
unsigned* )
m;
99 f->compare = *(
unsigned* ) b;
108 const char* p = from;
110 while (*p &&
i < 4) {
112 while (*p >=
'0' && *p <=
'9') {
113 m[
i] =
m[
i] * 10 + (*p -
'0');
116 if (!*p || *p ==
':')
121 const unsigned in = *(
unsigned* )
m;
136 if (
gi.Cmd_Argc() < 3) {
137 gi.DPrintf(
"Usage: %s <ip-mask>\n",
gi.Cmd_Argv(1));
147 gi.DPrintf(
"IP filter list is full\n");
162 if (
gi.Cmd_Argc() < 3) {
163 gi.DPrintf(
"Usage: %s <ip-mask>\n",
gi.Cmd_Argv(1));
176 gi.DPrintf(
"Removed.\n");
179 gi.DPrintf(
"Didn't find %s.\n",
gi.Cmd_Argv(2));
187 gi.DPrintf(
"Filter list:\n");
191 gi.DPrintf(
"%3i.%3i.%3i.%3i\n", b[0], b[1], b[2], b[3]);
204 gi.DPrintf(
"Writing %s.\n",
name);
208 gi.DPrintf(
"Couldn't open %s\n",
name);
217 fprintf(
f,
"sv addip %i.%i.%i.%i\n", b[0], b[1], b[2], b[3]);
230 if (
gi.Cmd_Argc() < 3) {
231 gi.DPrintf(
"Usage: %s <teamnum>\n",
gi.Cmd_Argv(1));
234 const int team = atoi(
gi.Cmd_Argv(2));
237 gi.DPrintf(
"Couldn't create AI player.\n");
239 gi.DPrintf(
"Bad team number.\n");
250 if (
gi.Cmd_Argc() < 3) {
251 gi.DPrintf(
"Usage: %s <teamnum>\n",
gi.Cmd_Argv(1));
254 const int team = atoi(
gi.Cmd_Argv(2));
258 gi.DPrintf(
"Bad team number.\n");
262static void SVCmd_ShowAll_f (
void)
264 Edict* ent =
nullptr;
271 gi.DPrintf(
"All items and creatures revealed to all sides\n");
274static void SVCmd_AddItem_f (
void)
279 if (
gi.Cmd_Argc() < 3) {
280 gi.DPrintf(
"Usage: %s <item-id>\n",
gi.Cmd_Argv(1));
285 gi.DPrintf(
"Could not add item, no living members of team %i left\n", team);
295static void SVCmd_ActorInvList_f (
void)
301 for (
i = 0, player =
game.players;
i <
game.sv_maxplayersperteam * 2;
i++, player++) {
302 if (!player->isInUse())
304 G_InvList_f(*player);
308static void SVCmd_ListEdicts_f (
void)
310 Edict* ent =
nullptr;
312 Com_Printf(
"number | entnum | mapnum | type | inuse | pnum | team | size | HP | state | classname | model/ptl | pos\n");
322 Com_sprintf(
buf,
sizeof(
buf),
"#%5i | #%5i | #%5i | %4i | %5i | %4i | %4i | %4i | %3i | %5i | %14s | %21s | %i:%i:%i",
341 cmd =
gi.Cmd_Argv(1);
360 SVCmd_ActorInvList_f();
362 SVCmd_ListEdicts_f();
365 gi.DPrintf(
"Unknown server command \"%s\"\n", cmd);
actorSizeEnum_t fieldSize
void Com_Printf(const char *const fmt,...)
Player * AI_CreatePlayer(int team)
Spawn civilians and aliens.
Artificial Intelligence functions.
void G_AppearPerishEvent(playermask_t playerMask, bool appear, Edict &check, const Edict *ent)
Send the appear or perish event to the affected clients.
playermask_t G_VisToPM(teammask_t teamMask)
Converts vis mask to player mask.
Interface for g_client.cpp.
Actor * G_EdictsGetNextLivingActorOfTeam(Actor *lastEnt, const int team)
Iterate through the living actor entities of the given team.
Edict * G_EdictsGetNext(Edict *lastEnt)
Iterate through the list of entities.
Edict * G_EdictsGetNextInUse(Edict *lastEnt)
Iterate through the entities that are in use.
functions to handle the storage and lifecycle of all edicts in the game module.
bool G_AddItemToFloor(const pos3_t pos, const char *itemID)
Adds a new item to an existing or new floor container edict at the given grid location.
Local definitions for game module.
void G_MatchEndTrigger(int team, int timeGap)
Triggers the end of the game. Will be executed in the next server (or game) frame.
static void SVCmd_RemoveIP_f(void)
static void SVCmd_Win_f(void)
Call the end game function with the given team used to e.g. abort singleplayer games and let the alie...
static void SVCmd_AI_Add_f(void)
Used to add ai opponents to a game.
bool SV_FilterPacket(const char *from)
void G_ServerCommand(void)
ServerCommand will be called when an "sv" command is issued. The game can issue gi....
static void SVCmd_AddIP_f(void)
static void SVCmd_WriteIP_f(void)
Store all ips in the current filter list in.
static bool StringToFilter(const char *s, ipfilter_t *f)
static void SVCmd_ListIP_f(void)
Shows the current ip in the filter list.
static ipfilter_t ipfilters[MAX_IPFILTERS]
void G_VisFlagsAdd(Edict &ent, teammask_t teamMask)
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
#define Q_strcasecmp(a, b)
bool Com_sprintf(char *dest, size_t size, const char *fmt,...)
copies formatted string with buffer-size checking