UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
common.h File Reference

definitions common between client and server, but not game lib More...

#include "../shared/ufotypes.h"
#include "../shared/byte.h"
#include "../shared/shared.h"
#include "../shared/mathlib.h"
#include "../shared/defines.h"
#include "cvar.h"
#include "mem.h"
#include "../ports/system.h"
#include "cmd.h"
#include "cmodel.h"
#include "filesys.h"
#include "scripts.h"
#include "net.h"
#include "dbuffer.h"
#include "netpack.h"
#include "md4.h"

Go to the source code of this file.

Data Structures

struct  comDrop_t
 
class  comRestart_t
 
struct  date_s
 Engine-side time information in the game. More...
 
struct  scheduleEvent_t
 

Macros

#define UFO_VERSION   "2.6-dev"
 
#define GAME_TITLE   "UFO:AI"
 
#define GAME_TITLE_LONG   "UFO:Alien Invasion"
 
#define BUILDSTRING_OS   "Unknown"
 
#define CPUSTRING   "Unknown"
 
#define BUILDSTRING_VARIANT   "RELEASE"
 
#define BUILDSTRING   BUILDSTRING_OS " " BUILDSTRING_VARIANT
 
#define MASTER_SERVER   "http://ufoai.org/" /* sponsored by NineX */
 
#define PROTOCOL_VERSION   18
 
#define PORT_CLIENT   27901
 
#define PORT_SERVER   27910
 
#define MAX_SVC_STUFFTEXT   1024
 
#define MAX_SVC_PRINT   1024
 
#define MAX_SVC_RECONNECT   256
 
#define MAX_SVC_DISCONNECT   256
 
#define MAX_CLC_STRINGCMD   512
 
#define SOUND_ATTN_NONE   0.0f
 
#define SOUND_ATTN_NORM   1.0f
 
#define SOUND_ATTN_IDLE   1.2f
 
#define SOUND_ATTN_STATIC   3.0f
 
#define SOUND_ATTN_MAX   SOUND_ATTN_STATIC
 
#define ANGLE2SHORT(x)   ((int)((x)*65536/360) & 65535)
 
#define SHORT2ANGLE(x)   ((x)*(360.0/65536))
 
#define ERR_FATAL   0 /* exit the entire game with a popup window */
 
#define ERR_DROP   1 /* print to console and disconnect from game */
 
#define ERR_QUIT   2 /* not an error, just a normal exit */
 
#define Q_COLOR_ESCAPE   '^'
 
#define Q_IsColorString(p)   ((p) && *(p) == Q_COLOR_ESCAPE && *((p) + 1) && isalnum(*((p) + 1)))
 
#define S_COLOR_BLACK   "^0"
 
#define S_COLOR_RED   "^1"
 
#define S_COLOR_GREEN   "^2"
 
#define S_COLOR_YELLOW   "^3"
 
#define S_COLOR_BLUE   "^4"
 
#define S_COLOR_CYAN   "^5"
 
#define S_COLOR_MAGENTA   "^6"
 
#define S_COLOR_WHITE   "^7"
 
#define CON_COLOR_BLACK   0
 
#define CON_COLOR_RED   1
 
#define CON_COLOR_GREEN   2
 
#define CON_COLOR_YELLOW   3
 
#define CON_COLOR_BLUE   4
 
#define CON_COLOR_CYAN   5
 
#define CON_COLOR_MAGENTA   6
 
#define CON_COLOR_WHITE   7
 
#define MAX_COLORS   8
 
#define DAYS_PER_YEAR   365
 
#define DAYS_PER_YEAR_AVG   365.25
 
#define MONTHS_PER_YEAR   12
 
#define SEASONS_PER_YEAR   4
 
#define SECONDS_PER_DAY   86400
 
#define SECONDS_PER_HOUR   3600
 
#define SECONDS_PER_MINUTE   60
 
#define MINUTES_PER_HOUR   60
 
#define HOURS_PER_DAY   24
 
#define MAXCMDLINE   256
 
#define REMOVE_ELEM(array, index, n)
 
#define REMOVE_ELEM_ADJUST_IDX(array, index, n)
 
#define HASH_Add(hash, elem, index)
 
#define HASH_Delete(anchor)   (*(anchor) = (*(anchor))->hash_next)
 

Typedefs

typedef int32_t svc_ops_t
 
typedef void(* exceptionCallback_t )(void)
 
typedef struct date_s date_t
 Engine-side time information in the game. More...
 
typedef void(* vPrintfPtr_t )(const char *fmt, va_list ap)
 
typedef void event_func (int now, void *data)
 
typedef bool event_check_func (int now, void *data)
 
typedef bool event_delay_func (int now, void *data)
 
typedef void event_notify_delay_func (int now, void *data, int delay)
 
typedef bool event_filter (int when, event_func *func, event_check_func *check, void *data)
 
typedef void event_clean_func (void *data)
 
typedef SharedPtr
< scheduleEvent_t
ScheduleEventPtr
 

Enumerations

enum  svc_ops_e {
  svc_bad, svc_nop, svc_ping, svc_disconnect,
  svc_reconnect, svc_print, svc_stufftext, svc_serverdata,
  svc_configstring, svc_event, svc_oob = 0xff
}
 server to client the svc_strings[] array in cl_parse.c should mirror this More...
 
enum  clc_ops_e {
  clc_bad, clc_nop, clc_ack, clc_endround,
  clc_teaminfo, clc_initactorstates, clc_action, clc_userinfo,
  clc_stringcmd, clc_oob = svc_oob
}
 client to server More...
 

Functions

void Com_BeginRedirect (struct net_stream *stream, char *buffer, int buffersize)
 Redirect packets/output from server to client. More...
 
void Com_EndRedirect (void)
 End the redirection of packets/output. More...
 
void Com_vPrintf (const char *fmt, va_list)
 
void Com_Drop (void) __attribute__((noreturn))
 
void Com_Quit (void)
 
void Com_BreakIntoDebugger (void)
 
void Com_WriteConfigToFile (const char *filename)
 
void Cvar_WriteVariables (qFILE *f)
 appends lines containing "set variable value" for all variables with the archive flag set to true. More...
 
int Com_ServerState (void)
 Check whether we are the server or have a singleplayer tactical mission. More...
 
void Com_SetServerState (int state)
 
void Com_SetRandomSeed (unsigned int seed)
 
const char * Com_UnsignedIntToBinary (uint32_t x)
 
const char * Com_ByteToBinary (byte x)
 
const char * Com_MD5File (const char *fn, int length=0)
 Compute the md5sum of a given file. More...
 
const char * Com_MD5Buffer (const byte *buf, size_t len)
 Compute the md5sum of the given buffer. More...
 
vPrintfPtr_t Qcommon_GetPrintFunction (void)
 
void Qcommon_SetPrintFunction (vPrintfPtr_t func)
 
void Qcommon_Init (int argc, char **argv)
 Init function. More...
 
void Qcommon_Frame (void)
 This is the function that is called directly from main() More...
 
void Qcommon_Shutdown (void)
 
void Com_SetGameType (void)
 
void Com_ReadFromPipe (void)
 Read whatever is in com_pipefile, if anything, and execute it. More...
 
float Com_GrenadeTarget (const vec3_t from, const vec3_t at, float speed, bool launched, bool rolled, vec3_t v0)
 Calculates parabola-type shot. More...
 
bool Com_CheckConfigStringIndex (int index)
 
void Con_Print (const char *txt)
 Handles cursor positioning, line wrapping, etc All console printing must go through this in order to be logged to disk If no console is visible, the text will appear at the top of the game window. More...
 
ScheduleEventPtr Schedule_Event (int when, event_func *func, event_check_func *check, event_clean_func *clean, void *data)
 Schedules an event to run on or after the given time, and when its check function returns true. More...
 
int CL_FilterEventQueue (event_filter *filter)
 Filters every event in the queue using the given function. Keeps all events for which the function returns true. More...
 
void CL_Init (void)
 
void CL_Drop (void)
 Ensures the right menu cvars are set after error drop or map change. More...
 
void CL_Shutdown (void)
 Saves configuration file and shuts the client systems down. More...
 
int CL_Milliseconds (void)
 
void CL_Frame (int now, void *data)
 
void CL_SlowFrame (int now, void *data)
 
bool CL_ParseClientData (const char *type, const char *name, const char **text)
 Called at client startup. More...
 
void SCR_BeginLoadingPlaque (void)
 
void SCR_EndLoadingPlaque (void)
 
void CL_InitAfter (void)
 Init function for clients - called after menu was initialized and ufo-scripts were parsed. More...
 
void SV_Init (void)
 Only called once at startup, not for each game. More...
 
void SV_Clear (void)
 Cleanup when the whole game process is shutting down. More...
 
void SV_Shutdown (const char *finalmsg, bool reconnect)
 Called when each game quits, before Sys_Quit or Sys_Error. More...
 
void SV_ShutdownWhenEmpty (void)
 Will eventually shutdown the server once all clients have disconnected. More...
 
void SV_Frame (int now, void *)
 
mapData_tSV_GetMapData (void)
 
mapTiles_tSV_GetMapTiles (void)
 
int Com_Argc (void)
 Returns the script commandline argument count. More...
 
const char * Com_Argv (int arg)
 Returns an argument of script commandline. More...
 
void Com_ClearArgv (int arg)
 Reset com_argv entry to empty string. More...
 
const char * Com_MacroExpandString (const char *text)
 Expands strings with cvar values that are dereferenced by a '*cvar'. More...
 
void Com_UploadCrashDump (const char *crashDumpFile)
 
bool Com_ConsoleCompleteCommand (const char *s, char *target, size_t bufSize, uint32_t *pos, uint32_t offset)
 Console completion for command and variables. More...
 
void Key_Init (void)
 

Variables

cvar_thttp_proxy
 
cvar_thttp_timeout
 
cvar_tdeveloper
 
cvar_tsv_dedicated
 
cvar_tsv_maxclients
 
cvar_tsv_gametype
 
cvar_tmasterserver_url
 
cvar_tport
 
cvar_tsys_priority
 
cvar_tsys_affinity
 
cvar_tsys_os
 
cvar_thwclass
 
memPool_tcom_aliasSysPool
 
memPool_tcom_cmdSysPool
 
memPool_tcom_cmodelSysPool
 
memPool_tcom_cvarSysPool
 
memPool_tcom_fileSysPool
 
memPool_tcom_genericPool
 
memPool_tcom_networkPool
 

Detailed Description

definitions common between client and server, but not game lib

Definition in file common.h.

Macro Definition Documentation

#define ANGLE2SHORT (   x)    ((int)((x)*65536/360) & 65535)

Definition at line 207 of file common.h.

Referenced by NET_WriteAngle16().

#define BUILDSTRING   BUILDSTRING_OS " " BUILDSTRING_VARIANT

Definition at line 121 of file common.h.

Referenced by Qcommon_Init(), and Sys_Backtrace().

#define BUILDSTRING_OS   "Unknown"

Definition at line 89 of file common.h.

Referenced by Com_UploadCrashDump().

#define BUILDSTRING_VARIANT   "RELEASE"

Definition at line 115 of file common.h.

#define CON_COLOR_BLACK   0

Definition at line 226 of file common.h.

#define CON_COLOR_BLUE   4

Definition at line 230 of file common.h.

#define CON_COLOR_CYAN   5

Definition at line 231 of file common.h.

#define CON_COLOR_GREEN   2

Definition at line 228 of file common.h.

Referenced by Con_DrawConsole().

#define CON_COLOR_MAGENTA   6

Definition at line 232 of file common.h.

#define CON_COLOR_RED   1

Definition at line 227 of file common.h.

#define CON_COLOR_WHITE   7
#define CON_COLOR_YELLOW   3

Definition at line 229 of file common.h.

#define CPUSTRING   "Unknown"

Definition at line 109 of file common.h.

Referenced by GAME_LoadGame(), Qcommon_Init(), SV_LoadGame(), and Sys_Backtrace().

#define DAYS_PER_YEAR   365
#define DAYS_PER_YEAR_AVG   365.25

Definition at line 297 of file common.h.

Referenced by GEO_IsNight().

#define ERR_DROP   1 /* print to console and disconnect from game */

Definition at line 211 of file common.h.

Referenced by _LE_NotFoundError(), AII_ReloadWeapon(), AIM_AutoEquipAircraft(), AIR_AircraftSelect(), AIR_AircraftStatusToName(), AIR_DestroyAircraft(), AIR_GetAircraft(), AIR_GetDestinationFindRoot(), AIR_LoadAircraftXML(), AIR_ParseAircraft(), AIR_RemoveEmployees(), AM_CalculateTeamScores(), B_AddAntimatter(), B_AntimatterInBase(), B_AssembleMap(), B_Build(), B_BuildBase_f(), B_BuildBuilding(), B_BuildFromTemplate(), B_BuildingDestroy(), B_FireEvent(), B_ParseBaseTemplate(), B_ParseBuildings(), B_SetUpFirstBase(), B_UpdateBaseCapacities(), BATTLE_Start(), BDEF_AutoTarget(), BS_Buy_f(), BS_BuyAircraft(), BS_BuyItem(), BS_BuyUGV(), BS_SellItem(), BS_SellUGV(), CHAR_GetMaxExperiencePerMission(), CHAR_ParseData(), CIN_ROQ_DecodeInfo(), CL_ActorAppear(), CL_ActorDie(), CL_ActorDoMove(), CL_ActorDoMoveTime(), CL_ActorDoShoot(), CL_ActorDoTurn(), CL_ActorGetMuzzle(), CL_ActorRevitalised(), CL_ActorSelect(), CL_ActorStartShoot(), CL_AddActor(), CL_AddBrushModel(), CL_BattlescapeSearchAtGridPos(), CL_DoorClose(), CL_DoorOpen(), CL_DoSwapSkills(), CL_ExecuteBattlescapeEvent(), CL_FinishHTTPDownload(), CL_GetConfigString(), CL_GetEvent(), CL_GetHitProbability(), CL_HullForEntity(), CL_InvAdd(), CL_InvDel(), CL_NetReceiveItem(), CL_ParseActorSkin(), CL_ParseEvent(), CL_ParseLanguages(), CL_ParseMapParticle(), CL_ParsePtlCmds(), CL_ParseRanks(), CL_ParseResults(), CL_ParseSequence(), CL_ParseServerData(), CL_ParseServerMessage(), CL_ParticleFunction(), CL_ParticleGetArt(), CL_ParticleLoadArt(), CL_ParticleSpawnTimed(), CL_SendCommand(), CL_SetConfigString(), CL_SetHTTPServer(), CL_SpawnParseEntitystring(), CL_ViewLoadMedia(), CM_AddMapTile(), CM_EntCompleteBoxTrace(), CM_EntTestLine(), CM_EntTestLineDM(), CM_InitBoxHull(), CM_InlineModel(), CM_LoadMap(), CMod_LoadBrushSides(), CMod_LoadEntityString(), CMod_LoadLeafs(), CMod_LoadRouting(), CMod_ValidateLump(), Com_BeginRedirect(), Com_Error(), Com_GetCharacterValues(), Com_GetGender(), Com_ParseActorModels(), Com_ParseActorNames(), Com_ParseBodyPart(), Com_ParseEquipment(), Com_ParseTeam(), COMP_GetComponentsByID(), COMP_ParseComponents(), CP_AttackUFOCarrier_f(), CP_BaseAttackGoToBase(), CP_BeginRescueMission(), CP_ChooseMap(), CP_CleanupContainerWeapons(), CP_MissionChooseUFO(), CP_MissionRemove(), CP_ParseAlienTeam(), CP_ParseCampaignData(), CP_SetAlienEquipmentByInterest(), CP_SetAlienTeamByInterest(), CP_SpawnCrashSiteMission(), CP_SpawnRescueMission(), CP_TEAM_AssignSoldierByUCN_f(), CP_TEAM_DeEquipActor_f(), CP_TEAM_SelectActorByUCN_f(), CP_ToDifficultyName(), CP_XVIInit(), uiTextNode::doLayout(), E_CreateEmployee(), E_GetEmployeeString(), E_GetEmployeeTypeString(), GAME_AppendTeamMember(), GAME_ChangeEquip(), GAME_CP_TeamIsKnown(), GAME_GenerateTeam(), GAME_GetCharacter(), GAME_LoadInventory(), GAME_NetSendCharacter(), GAME_SK_MapInfo(), GEO_GetCivilianNumberByPosition(), GEO_GetColor(), GEO_Init(), HTTP_ResolvURL(), INS_FinishInstallation(), INV_GetEquipmentDefinitionByID(), LE_Add(), LE_DoEndPathMove(), LE_GetClipModel(), LE_GetDrawModel(), LE_Lock(), LE_PlaceItem(), LE_Unlock(), LET_StartIdle(), LM_AddModel(), LM_AddToSceneOrder(), LMT_Init(), M_ParseMusic(), MD2GLCmdsRemove(), MD2HeaderCheck(), MIS_GetModel(), MIS_IsSpawnedFromGround(), ModelWorker(), MSO_ParseCategory(), MSO_ParseMessageSettings(), NET_DatagramBroadcast(), NET_ReadDir(), NET_SkipFormat(), NET_vReadFormat(), NET_vWriteFormat(), uiText2Node::onLoaded(), PR_DecreaseProduction(), PR_GetName(), PR_ProductionInfo(), PR_QueueDelete(), PR_UpdateRequiredItemsInBasestorage(), PrecalcNormalsAndTangents(), R_AddEntity(), R_AliasModelState(), R_AllocModelSlot(), R_CalcTransform(), R_CreateSurfaceLightmap(), R_GetEntityLists(), R_GetFreeEntity(), R_LoadImageData(), R_LoadObjModel(), R_LoadObjModelFace(), R_LoadObjModelLine(), R_ModAddMapTile(), R_ModBeginLoading(), R_ModCalcUniqueNormalsAndTangents(), R_ModLoadAliasMD2Mesh(), R_ModLoadAliasMD2MeshIndexed(), R_ModLoadAliasMD2MeshUnindexed(), R_ModLoadAliasMD2Model(), R_ModLoadAliasMD3Model(), R_ModLoadAnims(), R_ModLoadEdges(), R_ModLoadLeafs(), R_ModLoadMDX(), R_ModLoadNodes(), R_ModLoadNormals(), R_ModLoadPlanes(), R_ModLoadSubmodels(), R_ModLoadSurfaces(), R_ModLoadSurfedges(), R_ModLoadTexinfo(), R_ModLoadVertexes(), R_PreprocessShaderR(), R_SetBlendMode(), R_SetupSubmodels(), RADAR_UpdateInstallationRadarCoverage(), RS_AssignTechLinks(), RS_GetTechForItem(), RS_GetTechForTeam(), RS_InitTree(), RS_ParseTechnologies(), SP_misc_model(), SV_AddEvent(), SV_AddMapTiles(), SV_AddTile(), SV_AssembleMap_(), SV_CreateWorldSector(), SV_error(), SV_GetCvarToken(), SV_GetServerDataForEdict(), SV_GetTileFromTileSet(), SV_GetTilesFromTileSet(), SV_InitGameProgs(), SV_LoadModelAABB(), SV_ParseAssembly(), SV_ParseMapTileSet(), SV_ParseUMP(), SV_QueueEvent(), tileMask(), TR_Add_f(), TR_BoxTrace(), TR_BuildTracingNode_r(), TR_CargoList(), TR_Fill(), TR_FillEmployees(), TR_Init_f(), TR_LoadXML(), UFO_GetByType(), UFO_IsUFOSeenOnGeoscape(), UFO_TypeToName(), UI_BuildRadarImageList(), UI_DrawModelNode(), UI_NodeAbsoluteToRelativePos(), UP_Article(), UP_DisplayTechTree(), UP_GenerateSummary(), UP_ParseChapter(), UP_SetMailHeader(), UP_TechTreeClick_f(), US_RemoveUFOsExceedingCapacity(), and US_TransferUFO().

#define ERR_FATAL   0 /* exit the entire game with a popup window */

Definition at line 210 of file common.h.

Referenced by AIR_IsAircraftOnGeoscape(), uiBox_t::alignBox(), BEP_Evaluate(), CL_ParseLanguages(), CL_ParseSequence(), CL_SetClientState(), CL_SetRatioFilter_f(), CM_AddMapTile(), Com_InitArgv(), CP_SpawnAlienBaseMission(), GAME_GetCGameAPI(), Key_Event(), LoadModel(), ModelWorker(), NET_Init(), R_Draw3DGlobe(), R_DrawFlatGeoscape(), R_DrawInitLocal(), R_EnforceVersion(), R_FindImage(), R_FindModel(), R_FontAnalyze(), R_FontInit(), R_GetFont(), R_GetFreeFBOTexture(), R_GetModel(), R_GetSpriteVectors(), R_InitExtensions(), R_InitializeShader(), R_InitImages(), R_LoadImage(), R_LoadModel(), R_LoadModelAsync(), R_ModLoadAnims(), R_ModLoadTags(), R_PreprocessShaderR(), R_SoftenTexture(), R_SortSurfacesArrays_(), R_UploadData(), R_VerifyDriver(), Rimp_Init(), RS_InitTree(), SEQ_ExecuteModel(), SEQ_ExecuteObj2D(), SV_GetConfigString(), SV_GetConfigStringLength(), SV_GetGameAPI(), SV_HullForEntity(), SV_SetConfigString(), SZ_GetSpace(), UI_AllocNodeWithoutNew(), UI_AllocStaticAction(), UI_AllocStaticColor(), UI_AllocStaticFloat(), UI_AllocStaticKeyBinding(), UI_AllocStaticSprite(), UI_AllocStaticString(), UI_AllocTimer(), UI_CreateWindow(), UI_DrawString(), UI_ExecuteAction(), UI_ExecuteSetAction(), UI_GetBooleanFromExpression(), UI_GetFloatFromExpression(), UI_GetNodeAbsPos(), UI_GetNodeScreenPos(), UI_GetStringFromExpression(), UI_ImageAlignBoxInBox(), UI_InitializeNodeBehaviour(), UI_InitNodes(), UI_InsertComponent(), UI_InsertWindow(), UI_NodeSetPropertyFromRAW(), UI_ParseComponent(), UI_ParseValueExpression(), UI_ParseWindow(), UI_PoolAllocAction(), UI_PopupButton(), UI_PopupList(), UI_RegisterFont(), UI_RegisterNodePropertyPosSize_(), UI_ReleaseVariable(), UI_SetKeyBindingEx(), and UI_SetOneButton().

#define ERR_QUIT   2 /* not an error, just a normal exit */

Definition at line 212 of file common.h.

#define GAME_TITLE   "UFO:AI"
#define GAME_TITLE_LONG   "UFO:Alien Invasion"

Definition at line 38 of file common.h.

Referenced by R_InitGraphics(), Rimp_Init(), and S_MumbleLink().

#define HASH_Add (   hash,
  elem,
  index 
)
Value:
do { \
const int hashIndex = (index); \
assert(hashIndex >= 0); \
assert(hashIndex < lengthof(hash)); \
(elem)->hash_next = (hash)[hashIndex]; \
(hash)[hashIndex] = (elem); \
} while (0)
static wrapCache_t * hash[MAX_WRAP_HASH]
Definition: r_font.cpp:86
QGL_EXTERN GLuint index
Definition: r_gl.h:110
#define lengthof(x)
Definition: shared.h:105

Definition at line 430 of file common.h.

Referenced by CL_ParseMessageID(), Cmd_AddCommand(), Cvar_Get(), and R_LoadImageData().

#define HASH_Delete (   anchor)    (*(anchor) = (*(anchor))->hash_next)

Definition at line 439 of file common.h.

Referenced by Cvar_Delete(), and R_DeleteImage().

#define HOURS_PER_DAY   24

Definition at line 305 of file common.h.

#define MASTER_SERVER   "http://ufoai.org/" /* sponsored by NineX */

Definition at line 124 of file common.h.

Referenced by CL_InitLocal(), Qcommon_Init(), and GameTest::SetUpTestCase().

#define MAX_CLC_STRINGCMD   512

Definition at line 163 of file common.h.

Referenced by SV_ExecuteClientMessage().

#define MAX_COLORS   8

Definition at line 234 of file common.h.

#define MAX_SVC_DISCONNECT   256

Definition at line 162 of file common.h.

Referenced by CL_ParseServerMessage().

#define MAX_SVC_PRINT   1024

Definition at line 160 of file common.h.

Referenced by CL_ParseServerMessage(), SV_BroadcastPrintf(), and SV_ClientPrintf().

#define MAX_SVC_RECONNECT   256

Definition at line 161 of file common.h.

Referenced by CL_ParseServerMessage().

#define MAX_SVC_STUFFTEXT   1024

Definition at line 159 of file common.h.

Referenced by CL_ParseServerMessage(), and SV_ClientCommand().

#define MINUTES_PER_HOUR   60

(60)

Definition at line 304 of file common.h.

Referenced by PR_CalculateTotalFrames(), PR_GetProductionHours(), and PR_GetRemainingHours().

#define MONTHS_PER_YEAR   12

DAYS_PER_MONTH ->

See also
monthLength[] array in campaign.c

Definition at line 299 of file common.h.

Referenced by CP_DateConvertLong(), NAT_BackupMonthlyData(), NAT_DrawCharts_f(), NAT_GetFunding(), NAT_ListStats_f(), NAT_LoadXML(), and NAT_SaveXML().

#define PORT_CLIENT   27901

Definition at line 136 of file common.h.

Referenced by GAME_MP_PingServers_f().

#define PORT_SERVER   27910
#define Q_COLOR_ESCAPE   '^'

Definition at line 214 of file common.h.

#define Q_IsColorString (   p)    ((p) && *(p) == Q_COLOR_ESCAPE && *((p) + 1) && isalnum(*((p) + 1)))

Definition at line 215 of file common.h.

Referenced by Con_DrawString(), and Con_Print().

#define REMOVE_ELEM (   array,
  index,
 
)
Value:
do { \
size_t idx__ = (index); \
size_t n__ = --(n); \
assert(idx__ <= n__); \
memmove((array) + idx__, (array) + idx__ + 1, (n__ - idx__) * sizeof(*(array))); \
OBJZERO((array)[n__]); \
} while (0)
#define OBJZERO(obj)
Definition: shared.h:178
QGL_EXTERN GLuint index
Definition: r_gl.h:110

Remove element at index from array of size n. n gets adjusted to the new array size, so must be an lvalue

Definition at line 408 of file common.h.

Referenced by B_BuildingDestroy(), BDEF_RemoveBattery(), NAT_ScriptSanityCheck(), RADAR_RemoveUFO(), and UI_RemoveWindow().

#define REMOVE_ELEM_ADJUST_IDX (   array,
  index,
 
)
Value:
do { \
size_t idx__ = (index); \
size_t n__; \
size_t i__; \
REMOVE_ELEM(array, index, n); \
n__ = (n); \
for (i__ = idx__; i__ < n__; ++i__) \
--(array)[i__].idx; \
} while (0)
#define REMOVE_ELEM(array, index, n)
Definition: common.h:408
QGL_EXTERN GLuint index
Definition: r_gl.h:110

Same as REMOVE_ELEM() and also updates the idx attribute of every moved element

Definition at line 419 of file common.h.

Referenced by AIRFIGHT_RemoveProjectile(), PR_QueueDelete(), and UFO_RemoveFromGeoscape().

#define S_COLOR_BLACK   "^0"

Definition at line 217 of file common.h.

#define S_COLOR_BLUE   "^4"

Definition at line 221 of file common.h.

#define S_COLOR_CYAN   "^5"

Definition at line 222 of file common.h.

#define S_COLOR_MAGENTA   "^6"

Definition at line 223 of file common.h.

#define S_COLOR_RED   "^1"

Definition at line 218 of file common.h.

#define S_COLOR_WHITE   "^7"

Definition at line 224 of file common.h.

#define S_COLOR_YELLOW   "^3"

Definition at line 220 of file common.h.

Referenced by CL_RunMapParticles().

#define SEASONS_PER_YEAR   4

Definition at line 300 of file common.h.

Referenced by R_Draw3DGlobe().

#define SECONDS_PER_MINUTE   60

(60)

Definition at line 303 of file common.h.

Referenced by CP_CampaignRun().

#define SHORT2ANGLE (   x)    ((x)*(360.0/65536))

Definition at line 208 of file common.h.

Referenced by NET_ReadAngle16().

#define SOUND_ATTN_IDLE   1.2f
#define SOUND_ATTN_MAX   SOUND_ATTN_STATIC

Definition at line 189 of file common.h.

Referenced by Com_ParseFire(), and Com_ParseItem().

#define SOUND_ATTN_NONE   0.0f

full volume the entire level

Definition at line 185 of file common.h.

Referenced by Com_ParseFire(), and Com_ParseItem().

#define SOUND_ATTN_NORM   1.0f
#define SOUND_ATTN_STATIC   3.0f

dimish very rapidly with distance

Definition at line 188 of file common.h.

Referenced by LE_PlaySoundFileAndParticleForSurface().

Typedef Documentation

typedef struct date_s date_t

Engine-side time information in the game.

Note
Use this in your custom structs that need to get saved or sent over the network.
See also
dateLong_t For runtime use (human readable).
CP_DateConvertLong
typedef bool event_check_func(int now, void *data)

Definition at line 325 of file common.h.

typedef void event_clean_func(void *data)

Definition at line 332 of file common.h.

typedef bool event_delay_func(int now, void *data)

Definition at line 326 of file common.h.

typedef bool event_filter(int when, event_func *func, event_check_func *check, void *data)
Returns
true to keep the event, false to remove it from the queue

Definition at line 331 of file common.h.

typedef void event_func(int now, void *data)

Definition at line 324 of file common.h.

typedef void event_notify_delay_func(int now, void *data, int delay)

Definition at line 327 of file common.h.

typedef void(* exceptionCallback_t)(void)

Definition at line 240 of file common.h.

Definition at line 353 of file common.h.

typedef int32_t svc_ops_t

Definition at line 165 of file common.h.

typedef void(* vPrintfPtr_t)(const char *fmt, va_list ap)

Definition at line 309 of file common.h.

Enumeration Type Documentation

enum clc_ops_e

client to server

Enumerator
clc_bad 
clc_nop 
clc_ack 

answer on a ping

clc_endround 
clc_teaminfo 
clc_initactorstates 
clc_action 
clc_userinfo 

[[userinfo string]

clc_stringcmd 

[string] message

clc_oob 

out of band - connectionless

Definition at line 172 of file common.h.

enum svc_ops_e

server to client the svc_strings[] array in cl_parse.c should mirror this

Enumerator
svc_bad 
svc_nop 

the rest are private to the client and server

svc_ping 
svc_disconnect 
svc_reconnect 
svc_print 

[byte] id [string] null terminated string

svc_stufftext 

[string] stuffed into client's console buffer, should be
terminated

svc_serverdata 

[long] protocol, spawncount, playernum, mapname, ...

svc_configstring 

[short] [string]

svc_event 

event like move or inventory usage - see EV_* and

See also
CL_ParseEvent
svc_oob 

Definition at line 143 of file common.h.

Function Documentation

void CL_Drop ( void  )

Ensures the right menu cvars are set after error drop or map change.

Note
E.g. called after an ERR_DROP was thrown
See also
CL_Disconnect
SV_Map

Definition at line 167 of file cl_main.cpp.

References CL_Disconnect(), GAME_Drop(), and SCR_EndLoadingPlaque().

Referenced by CL_ConnectionlessPacket(), CL_ParseServerMessage(), Com_Error(), GAME_GetImportData(), and GAME_HandleResults().

int CL_FilterEventQueue ( event_filter filter)

Filters every event in the queue using the given function. Keeps all events for which the function returns true.

Parameters
filterPointer to the filter function. When called with event info, it should return true if the event is to be kept.

Definition at line 1446 of file common.cpp.

References eventQueue, and i.

Referenced by CL_ClearBattlescapeEvents(), and Qcommon_Frame().

void CL_InitAfter ( void  )

Init function for clients - called after menu was initialized and ufo-scripts were parsed.

See also
Qcommon_Init

Definition at line 738 of file cl_main.cpp.

References CL_LanguageInit(), CL_ViewPrecacheModels(), CLMN_Init(), Com_MapDefSort(), csi, cvar_s::integer, csi_s::mds, csi_s::numMDs, S_Frame(), S_LoadSamples(), and sv_dedicated.

Referenced by Qcommon_Init().

bool CL_ParseClientData ( const char *  type,
const char *  name,
const char **  text 
)

Called at client startup.

Note
not called for dedicated servers parses all *.ufos that are needed for single- and multiplayer
See also
Com_ParseScripts
CL_ParseScriptSecond
CL_ParseScriptFirst
Note
Nothing here should depends on items, equipments, actors and all other entities that are parsed in Com_ParseScripts (because maybe items are not parsed but e.g. techs would need those parsed items - thus we have to parse e.g. techs at a later stage)
This data is persistent until you shutdown the game
Returns
True if the parsing function succeeded.

Definition at line 771 of file cl_main.cpp.

References CL_ParseActorSkin(), CL_ParseLanguages(), CL_ParseParticle(), CL_ParseSequence(), CL_ParseTipOfTheDay(), GAME_ParseModes(), M_ParseMusic(), Q_streq, SCR_DrawLoadingScreen(), TUT_ParseTutorials(), UI_ParseAndLoadLuaScript(), UI_ParseComponent(), UI_ParseFont(), UI_ParseSprite(), UI_ParseUIModel(), and UI_ParseWindow().

Referenced by Com_ParseScripts(), and TEST_ParseScript().

void CL_Shutdown ( void  )

Saves configuration file and shuts the client systems down.

Todo:
this is a callback from Sys_Quit and Com_Error. It would be better to run quit through here before the final handoff to the sys code.
See also
Sys_Quit
CL_Init

Definition at line 1220 of file cl_main.cpp.

References CIN_Shutdown(), CL_HTTP_Cleanup(), CL_LanguageShutdown(), CL_RContextCvarChange(), CL_RImagesCvarChange(), CL_ShutdownLua(), CLMN_Shutdown(), Con_SaveConsoleHistory(), Cvar_GetFirst(), CVAR_R_CONTEXT, CVAR_R_IMAGES, Cvar_UnRegisterChangeListener(), GAME_SetMode(), GAME_Shutdown(), GAME_UnloadGame(), Irc_Shutdown(), isdown, Key_WriteBindings(), cvar_s::next, R_Shutdown(), S_Shutdown(), SCR_Shutdown(), SEQ_Shutdown(), TOTD_Shutdown(), and UI_Shutdown().

Referenced by Com_Error(), Com_Quit(), Qcommon_Frame(), and Sys_Quit().

void CL_SlowFrame ( int  now,
void data 
)
int Com_Argc ( void  )

Returns the script commandline argument count.

Definition at line 560 of file common.cpp.

References com_argc.

Referenced by Cbuf_AddEarlyCommands(), and Cbuf_AddLateCommands().

const char* Com_Argv ( int  arg)

Returns an argument of script commandline.

Definition at line 568 of file common.cpp.

References com_argc, and com_argv.

Referenced by Cbuf_AddEarlyCommands(), and Cbuf_AddLateCommands().

void Com_BeginRedirect ( struct net_stream stream,
char *  buffer,
int  buffersize 
)

Redirect packets/output from server to client.

See also
Com_EndRedirect

This is used to redirect printf outputs for rcon commands

Definition at line 308 of file common.cpp.

References Com_Error(), ERR_DROP, MAXPRINTMSG, rd_buffer, and rd_buffersize.

Referenced by SVC_RemoteCommand().

void Com_BreakIntoDebugger ( void  )

Definition at line 470 of file common.cpp.

References buttons, lengthof, OBJZERO, and Sys_Breakpoint().

Referenced by Sys_Backtrace(), and Sys_Error().

const char* Com_ByteToBinary ( byte  x)

Definition at line 1005 of file common.cpp.

Referenced by NET_WriteByte(), NET_WriteChar(), and TEST_F().

bool Com_CheckConfigStringIndex ( int  index)
Parameters
[in]indexThe index of the config string array
Note
Some config strings are using one value over multiple config string slots. These may not be accessed directly.

Definition at line 860 of file common.cpp.

References CS_MODELS, CS_POSITIONS, CS_TILES, and MAX_CONFIGSTRINGS.

Referenced by CL_GetConfigString(), CL_SetConfigString(), SV_Configstring(), SV_GetConfigString(), SV_GetConfigStringLength(), and SV_SetConfigString().

void Com_ClearArgv ( int  arg)

Reset com_argv entry to empty string.

Parameters
[in]argWhich argument in com_argv
See also
Com_InitArgv

Definition at line 580 of file common.cpp.

References com_argc, and com_argv.

Referenced by Cbuf_AddEarlyCommands().

bool Com_ConsoleCompleteCommand ( const char *  s,
char *  target,
size_t  bufSize,
uint32_t *  pos,
uint32_t  offset 
)

Console completion for command and variables.

See also
Key_CompleteCommand
Cmd_CompleteCommand
Cvar_CompleteVariable
Parameters
[in]sThe string to complete
[out]targetThe target buffer of the completed command/cvar
[in]bufSizethe target buffer size - might not be bigger than MAXCMDLINE
[out]posThe position in the buffer after command completion
[in]offsetThe input buffer position to put the completed command to

Definition at line 717 of file common.cpp.

References Cmd_CompleteCommand(), Cmd_CompleteCommandParameters(), Com_Printf(), Cvar_CompleteVariable(), MAX_QPATH, MAXCMDLINE, Q_strcat(), and Q_strncpyz().

Referenced by Key_Console(), Sys_ConsoleEditProc(), and Sys_ConsoleInput().

void Com_Drop ( void  )

Definition at line 465 of file common.cpp.

Referenced by Com_Error(), and GAME_GetImportData().

void Com_EndRedirect ( void  )

End the redirection of packets/output.

See also
Com_BeginRedirect

Definition at line 325 of file common.cpp.

References NET_OOB_Printf(), rd_buffer, rd_buffersize, and SV_CMD_PRINT.

Referenced by SVC_RemoteCommand().

float Com_GrenadeTarget ( const vec3_t  from,
const vec3_t  at,
float  speed,
bool  launched,
bool  rolled,
vec3_t  v0 
)

Calculates parabola-type shot.

Grenade Aiming Maths

There are two possibilities when aiming: either we can reach the target at maximum speed or we can't. If we can reach it we would like to reach it with as flat a trajectory as possible. To do this we calculate the angle to hit the target with the projectile traveling at the maximum allowed velocity.

However, if we can't reach it then we'd like the aiming curve to use the smallest possible velocity that would have reached the target.

let d = horizontal distance to target h = vertical distance to target g = gravity v = launch velocity vx = horizontal component of launch velocity vy = vertical component of launch velocity alpha = launch angle t = time

Then using the laws of linear motion and some trig

d = vx * t h = vy * t - 1/2 * g * t^2 vx = v * cos(alpha) vy = v * sin(alpha)

and some trig identities

2*cos^2(x) = 1 + cos(2*x) 2*sin(x)*cos(x) = sin(2*x) a*cos(x) + b*sin(x) = sqrt(a^2 + b^2) * cos(x - atan2(b, a))

it is possible to show that:

alpha = 0.5 * (atan2(d, -h) - theta)

where / 2 2 \ | v h + g d | | -----------— | theta = acos | ________ | | 2 / 2 2 | \ v \/ h + d /

Thus we can calculate the desired aiming angle for any given velocity.

With some more rearrangement we can show:

          ________________________
         /           2
        /         g d

v = / ---------------------— / ________ / / 2 2 \/ \/ h + d cos(theta) - h

Which we can also write as:


/ a f(theta) = / -------------— \/ b cos(theta) - c

where a = g*d^2 b = sqrt(h*h+d*d) c = h

We can imagine a graph of launch velocity versus launch angle. When the angle is near 0 degrees (i.e. totally flat) more and more velocity is needed. Similarly as the angle gets closer and closer to 90 degrees.

Somewhere in the middle is the minimum velocity that we could possibly hit the target with and the 'optimum' angle to fire at. Note that when h = 0 the optimum angle is 45 degrees. We want to find the minimum velocity so we need to take the derivative of f (which I suggest doing with an algebra system!).

f'(theta) = a * b * sin(theta) / junk

the junk is unimportant because we're just going to set f'(theta) = 0 and multiply it out anyway.

0 = a * b * sin(theta)

Neither a nor b can be 0 as long as d does not equal 0 (which is a degenerate case). Thus if we solve for theta we get 'sin(theta) = 0', thus 'theta = 0'. If we recall that:

alpha = 0.5 * (atan2(d, -h) - theta)

then we get our 'optimum' firing angle alpha as

alpha = 1/2 * atan2(d, -h)

and if we substitute back into our equation for v and we get

          _______________
         /        2
        /      g d

vmin = / ------------— / ________ / / 2 2 \/ \/ h + d - h

as the minimum launch velocity for that angle.

Parameters
[in]fromStarting position for calculations.
[in]atEnding position for calculations.
[in]speedLaunch velocity.
[in]launchedSet to true for grenade launchers.
[in]rolledSet to true for "roll" type shoot.
[in,out]v0The velocity vector
Todo:

refactor and move me

Com_GrenadeTarget() is called from CL_TargetingGrenade() with speed param as (fireDef_s) fd->range (gi.GrenadeTarget, too), while it is being used here for speed calculations - a bug or just misleading documentation?

See also
CL_TargetingGrenade

Definition at line 231 of file common.cpp.

References DIST_EPSILON, GRAVITY, len, torad, v, VectorLength(), VectorNormalizeFast(), VectorScale, and VectorSubtract.

Referenced by CL_TargetingGrenade(), and SV_InitGameProgs().

const char* Com_MacroExpandString ( const char *  text)

Expands strings with cvar values that are dereferenced by a '*cvar'.

Note
There is an overflow check for cvars that also contain a '*cvar'
See also
Cmd_TokenizeString
UI_GetReferenceString

Definition at line 607 of file common.cpp.

References Com_Parse(), Com_Printf(), count, Cvar_GetString(), i, len, MACRO_CVAR_ID_LENGTH, MAX_STRING_CHARS, OBJZERO, and Q_strncpyz().

Referenced by Cmd_TokenizeString(), and UI_GetReferenceString().

const char* Com_MD5Buffer ( const byte buf,
size_t  len 
)

Compute the md5sum of the given buffer.

Parameters
[in]bufData to compute the md5 of
[in]lenBuffer length in bytes
Returns
the md5 sum buffer (char*)

Definition at line 300 of file md5.cpp.

References i, MD5Final(), MD5Init(), MD5Update(), and Q_strcat().

Referenced by TEST_F().

const char* Com_MD5File ( const char *  fn,
int  length 
)

Compute the md5sum of a given file.

Parameters
[in]fnFilename to compute the md5 of
[in]lengthCompute the md5 of the first 'length' bytes (if 0 - complete file)
Returns
the md5 sum buffer (char*)

Definition at line 257 of file md5.cpp.

References f, FILE_READ, FS_OpenFile(), FS_Read(), i, MD5Final(), MD5Init(), MD5Update(), and Q_strcat().

Referenced by TEST_F().

void Com_Quit ( void  )

Both client and server can use this, and it will do the appropriate things.

Definition at line 511 of file common.cpp.

References CL_Shutdown(), Com_WriteConfigToFile(), qFILE_s::f, FS_CloseFile(), FS_Gamedir(), FS_RemoveFile(), qFILE_s::name, NET_Wait(), SV_Clear(), SV_Shutdown(), Sys_Quit(), and va().

Referenced by CL_Quit_f(), and Qcommon_Init().

void Com_ReadFromPipe ( void  )

Read whatever is in com_pipefile, if anything, and execute it.

Definition at line 1260 of file common.cpp.

References Cmd_ExecuteString(), qFILE_s::f, FS_Read2(), and MAX_STRING_CHARS.

Referenced by SV_Frame().

int Com_ServerState ( void  )
void Com_SetRandomSeed ( unsigned int  seed)

Definition at line 999 of file common.cpp.

Referenced by Qcommon_Init(), SV_AssemblyThread(), and SV_DoMapAssemble().

void Com_SetServerState ( int  state)
const char* Com_UnsignedIntToBinary ( uint32_t  x)

Definition at line 1021 of file common.cpp.

Referenced by SV_AddEvent(), SV_QueueEvent(), and TEST_F().

void Com_UploadCrashDump ( const char *  crashDumpFile)
void Com_vPrintf ( const char *  fmt,
va_list  ap 
)
Note
Both client and server can use this, and it will output to the appropriate place.

Definition at line 338 of file common.cpp.

References Com_MakeTimestamp(), Con_Print(), consoleLogName, qFILE_s::f, FILE_APPEND, FILE_WRITE, FS_OpenFile(), FS_Write(), cvar_s::integer, MAXPRINTMSG, NET_OOB_Printf(), Q_strcat(), Q_vsnprintf(), rd_buffer, rd_buffersize, SV_CMD_PRINT, and Sys_ConsoleOutput().

void Com_WriteConfigToFile ( const char *  filename)
void Con_Print ( const char *  txt)

Handles cursor positioning, line wrapping, etc All console printing must go through this in order to be logged to disk If no console is visible, the text will appear at the top of the game window.

See also
Sys_ConsoleOutput

Definition at line 318 of file cl_console.cpp.

References ColorIndex, CON_COLOR_WHITE, Con_Linefeed(), console_t::currentLine, console_t::initialized, len, console_t::lineWidth, console_t::pos, Q_IsColorString, console_t::text, console_t::totalLines, and UTF8_char_len().

Referenced by Com_vPrintf().

void Cvar_WriteVariables ( qFILE f)

appends lines containing "set variable value" for all variables with the archive flag set to true.

Note
Stores the archive cvars

Definition at line 868 of file cvar.cpp.

References CVAR_ARCHIVE, FS_Printf(), qFILE_s::name, and cvar_s::next.

Referenced by Com_WriteConfigToFile().

vPrintfPtr_t Qcommon_GetPrintFunction ( void  )

Definition at line 1066 of file common.cpp.

References vPrintfPtr.

void Qcommon_SetPrintFunction ( vPrintfPtr_t  func)

Definition at line 1061 of file common.cpp.

References vPrintfPtr.

Referenced by main().

void Qcommon_Shutdown ( void  )
See also
Qcommon_Init
Sys_Quit
Note
Don't call anything that depends on cvars, command system, or any other subsystem that is allocated in the mem pools and maybe already freed

Definition at line 1537 of file common.cpp.

References Cmd_Shutdown(), Com_Shutdown(), Cvar_Shutdown(), FS_Shutdown(), HTTP_Cleanup(), Mem_Shutdown(), and NET_Shutdown().

Referenced by Com_Error(), Qcommon_Frame(), and Sys_Quit().

ScheduleEventPtr Schedule_Event ( int  when,
event_func func,
event_check_func check,
event_clean_func clean,
void data 
)

Schedules an event to run on or after the given time, and when its check function returns true.

Parameters
whenThe earliest time the event can run
funcThe function to call when running the event
checkA function that should return true when the event is safe to run. It should have no side-effects, as it might be called many times.
cleanA function that should cleanup any memory allocated for the event in the case that it is not executed. Either this function or func will be called, but never both.
dataArbitrary data to be passed to the check and event functions. This is needed e.g. for battlescape events to not play events too fast because the beginning of the event queue was blocked.

Definition at line 1362 of file common.cpp.

References eventQueue, and timer::func.

Referenced by CL_ParseEvent(), Schedule_Timer(), TEST_F(), and tick_timer().

void SCR_BeginLoadingPlaque ( void  )
void SCR_EndLoadingPlaque ( void  )
See also
SCR_BeginLoadingPlaque

Definition at line 277 of file cl_screen.cpp.

References cls, and client_static_s::disableScreen.

Referenced by CL_Drop(), CL_ViewLoadMedia(), and Qcommon_Init().

void SV_Clear ( void  )

Cleanup when the whole game process is shutting down.

See also
SV_Shutdown
Com_Quit

Definition at line 1030 of file sv_main.cpp.

References SV_LogShutdown(), and SV_MapcycleClear().

Referenced by Com_Quit().

mapData_t* SV_GetMapData ( void  )

Definition at line 947 of file sv_main.cpp.

References serverInstanceGame_s::mapData, and sv.

Referenced by CL_RequestNextDownload().

mapTiles_t* SV_GetMapTiles ( void  )

Definition at line 952 of file sv_main.cpp.

References serverInstanceGame_s::mapTiles, and sv.

Referenced by CL_RequestNextDownload().

void SV_Shutdown ( const char *  finalmsg,
bool  reconnect 
)

Called when each game quits, before Sys_Quit or Sys_Error.

Parameters
[in]finalmsgThe message all clients get as server shutdown message
[in]reconnectTrue if this is only a restart (new map or map restart), false if the server shutdown completely and you also want to disconnect all clients

Definition at line 1042 of file sv_main.cpp.

References serverInstanceStatic_s::clients, Com_Printf(), CVAR_LATCH, CVAR_NOSET, cvar_s::flags, i, serverInstanceStatic_s::initialized, Master_Shutdown(), Mem_Free, sv_model_s::name, NET_DatagramSocketClose(), serverInstanceStatic_s::netDatagramSocket, serverInstanceGame_s::numSVModels, OBJZERO, serverInstanceStatic_s::serverMutex, sv, SV_FinalMessage(), SV_ShutdownGameProgs(), SV_Stop(), serverInstanceGame_s::svModels, and svs.

Referenced by Com_Error(), Com_Quit(), Com_SetServerState(), GAME_Drop(), GAME_GetImportData(), Qcommon_Frame(), SV_Frame(), SV_KillServer_f(), and TEST_Shutdown().

void SV_ShutdownWhenEmpty ( void  )

Will eventually shutdown the server once all clients have disconnected.

See also
SV_CountPlayers

Definition at line 1085 of file sv_main.cpp.

References serverInstanceStatic_s::abandon, Com_SetServerState(), ss_dead, and svs.

Referenced by GAME_GetImportData().

Variable Documentation

memPool_t* com_aliasSysPool

Definition at line 68 of file common.cpp.

Referenced by Cmd_Alias_f(), Com_RegisterConstInt(), TEST_Init(), and TEST_Shutdown().

memPool_t* com_cmdSysPool

Definition at line 69 of file common.cpp.

Referenced by Cmd_AddCommand(), Cmd_Shutdown(), Cmd_TokenizeString(), TEST_Init(), and TEST_Shutdown().

memPool_t* com_fileSysPool

Definition at line 72 of file common.cpp.

memPool_t* com_genericPool

Definition at line 73 of file common.cpp.

cvar_t* developer

Definition at line 46 of file common.cpp.

cvar_t* http_proxy

Definition at line 47 of file common.cpp.

Referenced by CL_StartHTTPDownload(), HTTP_GetURLInternal(), and TEST_Init().

cvar_t* http_timeout

Definition at line 48 of file common.cpp.

Referenced by CL_StartHTTPDownload(), HTTP_GetURLInternal(), HTTP_PutFile(), and TEST_Init().

cvar_t* hwclass

Definition at line 62 of file common.cpp.

Referenced by Com_ParseMapDefinition(), and TEST_Init().

cvar_t* sv_dedicated

Definition at line 51 of file common.cpp.

cvar_t* sv_gametype

Definition at line 56 of file common.cpp.

Referenced by SV_Frame(), SV_NextMapcycle(), and SVC_Info().

cvar_t* sys_affinity

Definition at line 60 of file common.cpp.

Referenced by CL_Frame(), and Sys_Init().

cvar_t* sys_os

Definition at line 61 of file common.cpp.

Referenced by Sys_Init().

cvar_t* sys_priority

Definition at line 59 of file common.cpp.

Referenced by CL_Frame(), and Sys_Init().