63 #define MAX_IPFILTERS 1024
77 for (
int i = 0;
i < 4;
i++) {
78 if (*s < '0' || *s >
'9') {
98 f->
mask = *(
unsigned* ) m;
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;
124 if ((in & ipfilters[i].mask) == ipfilters[
i].
compare)
136 if (
gi.Cmd_Argc() < 3) {
143 if (ipfilters[i].compare == ~0x0)
145 if (i == numipfilters) {
147 gi.DPrintf(
"IP filter list is full\n");
162 if (
gi.Cmd_Argc() < 3) {
174 ipfilters[j - 1] = ipfilters[j];
176 gi.DPrintf(
"Removed.\n");
187 gi.DPrintf(
"Filter list:\n");
190 *(
unsigned* ) b = ipfilters[
i].compare;
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);
216 *(
unsigned* ) b = ipfilters[
i].compare;
217 fprintf(f,
"sv addip %i.%i.%i.%i\n", b[0], b[1], b[2], b[3]);
230 if (
gi.Cmd_Argc() < 3) {
237 gi.DPrintf(
"Couldn't create AI player.\n");
239 gi.DPrintf(
"Bad team number.\n");
250 if (
gi.Cmd_Argc() < 3) {
258 gi.DPrintf(
"Bad team number.\n");
262 static void SVCmd_ShowAll_f (
void)
264 Edict* ent =
nullptr;
271 gi.DPrintf(
"All items and creatures revealed to all sides\n");
274 static void SVCmd_AddItem_f (
void)
279 if (
gi.Cmd_Argc() < 3) {
285 gi.DPrintf(
"Could not add item, no living members of team %i left\n", team);
295 static void SVCmd_ActorInvList_f (
void)
302 if (!player->isInUse())
304 G_InvList_f(*player);
308 static 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",
360 SVCmd_ActorInvList_f();
362 SVCmd_ListEdicts_f();
365 gi.DPrintf(
"Unknown server command \"%s\"\n", cmd);
Edict * G_EdictsGetNextInUse(Edict *lastEnt)
Iterate through the entities that are in use.
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_AI_Add_f(void)
Used to add ai opponents to a game.
Artificial Intelligence functions.
bool Com_sprintf(char *dest, size_t size, const char *fmt,...)
copies formatted string with buffer-size checking
void Com_Printf(const char *const fmt,...)
void G_AppearPerishEvent(playermask_t playerMask, bool appear, Edict &check, const Edict *ent)
Send the appear or perish event to the affected clients.
static bool StringToFilter(const char *s, ipfilter_t *f)
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 ipfilter_t ipfilters[MAX_IPFILTERS]
const char *IMPORT * FS_Gamedir(void)
static void SVCmd_RemoveIP_f(void)
static void SVCmd_WriteIP_f(void)
Store all ips in the current filter list in.
playermask_t G_VisToPM(teammask_t teamMask)
Converts vis mask to player mask.
#define Q_strcasecmp(a, b)
bool SV_FilterPacket(const char *from)
struct ipfilter_s ipfilter_t
PACKET FILTERING.
actorSizeEnum_t fieldSize
static void SVCmd_ListIP_f(void)
Shows the current ip in the filter list.
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.
Actor * G_EdictsGetNextLivingActorOfTeam(Actor *lastEnt, const int team)
Iterate through the living actor entities of the given team.
void G_ServerCommand(void)
ServerCommand will be called when an "sv" command is issued. The game can issue gi.Cmd_Argc() / gi.Cmd_Argv() commands to get the rest of the parameters.
Local definitions for game module.
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
static void SVCmd_AddIP_f(void)
functions to handle the storage and lifecycle of all edicts in the game module.
FILE *IMPORT * Sys_Fopen(const char *filename, const char *mode)
Player * AI_CreatePlayer(int team)
Spawn civilians and aliens.
void G_VisFlagsAdd(Edict &ent, teammask_t teamMask)
const char *IMPORT * Cmd_Argv(int n)
Interface for g_client.cpp.
Edict * G_EdictsGetNext(Edict *lastEnt)
Iterate through the list of entities.