2010-11-20 10:37:14 +00:00
|
|
|
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
|
|
|
|
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
2008-08-14 18:42:47 +00:00
|
|
|
#ifndef GAME_SERVER_GAMEWORLD_H
|
|
|
|
#define GAME_SERVER_GAMEWORLD_H
|
2008-08-14 18:25:44 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
#include <game/gamecore.h>
|
2008-08-14 18:42:47 +00:00
|
|
|
|
2010-08-31 11:01:46 +00:00
|
|
|
#include <list>
|
2008-08-14 18:42:47 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
class CEntity;
|
|
|
|
class CCharacter;
|
2008-08-14 18:25:44 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
Class: Game World
|
|
|
|
Tracks all entities in the game. Propagates tick and
|
|
|
|
snap calls to all entities.
|
|
|
|
*/
|
2010-05-29 07:25:38 +00:00
|
|
|
class CGameWorld
|
2008-08-14 18:25:44 +00:00
|
|
|
{
|
2011-01-19 17:27:50 +00:00
|
|
|
public:
|
2008-08-14 18:25:44 +00:00
|
|
|
enum
|
|
|
|
{
|
2011-01-19 17:27:50 +00:00
|
|
|
ENTTYPE_PROJECTILE = 0,
|
|
|
|
ENTTYPE_LASER,
|
|
|
|
ENTTYPE_PICKUP,
|
|
|
|
ENTTYPE_FLAG,
|
|
|
|
ENTTYPE_CHARACTER,
|
|
|
|
NUM_ENTTYPES
|
2008-08-14 18:25:44 +00:00
|
|
|
};
|
|
|
|
|
2011-01-19 17:27:50 +00:00
|
|
|
private:
|
|
|
|
void Reset();
|
|
|
|
void RemoveEntities();
|
|
|
|
|
2022-02-09 14:26:50 +00:00
|
|
|
CEntity *m_pNextTraverseEntity = nullptr;
|
2011-01-19 17:27:50 +00:00
|
|
|
CEntity *m_apFirstEntityTypes[NUM_ENTTYPES];
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
class CGameContext *m_pGameServer;
|
2021-01-10 12:47:07 +00:00
|
|
|
class CConfig *m_pConfig;
|
2010-05-29 07:25:38 +00:00
|
|
|
class IServer *m_pServer;
|
2008-08-14 18:25:44 +00:00
|
|
|
|
2013-12-31 05:13:57 +00:00
|
|
|
void UpdatePlayerMaps();
|
|
|
|
|
2008-08-14 18:25:44 +00:00
|
|
|
public:
|
2010-05-29 07:25:38 +00:00
|
|
|
class CGameContext *GameServer() { return m_pGameServer; }
|
2021-01-10 12:47:07 +00:00
|
|
|
class CConfig *Config() { return m_pConfig; }
|
2010-05-29 07:25:38 +00:00
|
|
|
class IServer *Server() { return m_pServer; }
|
|
|
|
|
|
|
|
bool m_ResetRequested;
|
|
|
|
bool m_Paused;
|
|
|
|
CWorldCore m_Core;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
CGameWorld();
|
|
|
|
~CGameWorld();
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
void SetGameServer(CGameContext *pGameServer);
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
CEntity *FindFirst(int Type);
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2008-08-14 18:25:44 +00:00
|
|
|
/*
|
2021-12-14 09:35:00 +00:00
|
|
|
Function: FindEntities
|
2008-08-14 18:25:44 +00:00
|
|
|
Finds entities close to a position and returns them in a list.
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2008-08-14 18:25:44 +00:00
|
|
|
Arguments:
|
2021-12-14 09:35:00 +00:00
|
|
|
Pos - Position.
|
|
|
|
Radius - How close the entities have to be.
|
|
|
|
ppEnts - Pointer to a list that should be filled with the pointers
|
2008-08-14 18:25:44 +00:00
|
|
|
to the entities.
|
2021-12-14 09:35:00 +00:00
|
|
|
Max - Number of entities that fits into the ents array.
|
|
|
|
Type - Type of the entities to find.
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2008-08-14 18:25:44 +00:00
|
|
|
Returns:
|
|
|
|
Number of entities found and added to the ents array.
|
|
|
|
*/
|
2011-01-19 17:27:50 +00:00
|
|
|
int FindEntities(vec2 Pos, float Radius, CEntity **ppEnts, int Max, int Type);
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2008-08-14 18:25:44 +00:00
|
|
|
/*
|
2010-08-31 13:19:01 +00:00
|
|
|
Function: InterserctCharacters
|
|
|
|
Finds the CCharacters that intersects the line. // made for types lasers=1 and doors=0
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2008-08-14 18:25:44 +00:00
|
|
|
Arguments:
|
2021-12-14 09:35:00 +00:00
|
|
|
Pos0 - Start position
|
|
|
|
Pos1 - End position
|
|
|
|
Radius - How for from the line the CCharacter is allowed to be.
|
|
|
|
NewPos - Intersection position
|
|
|
|
pNotThis - Entity to ignore intersecting with
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2008-08-14 18:25:44 +00:00
|
|
|
Returns:
|
|
|
|
Returns a pointer to the closest hit or NULL of there is no intersection.
|
|
|
|
*/
|
Mark parameters as `const` when possible
According to cppchecker's `constParameter` error:
```
src\engine\gfx\image_manipulation.cpp:7:58: style: Parameter 'pSrc' can be declared as pointer to const [constParameter]
static void Dilate(int w, int h, int BPP, unsigned char *pSrc, unsigned char *pDest, unsigned char AlphaThreshold = TW_DILATE_ALPHA_THRESHOLD)
^
src\engine\gfx\image_manipulation.cpp:58:67: style: Parameter 'pSrc' can be declared as pointer to const [constParameter]
static void CopyColorValues(int w, int h, int BPP, unsigned char *pSrc, unsigned char *pDest)
^
src\engine\shared\network_conn.cpp:241:42: style: Parameter 'Addr' can be declared as reference to const [constParameter]
void CNetConnection::DirectInit(NETADDR &Addr, SECURITY_TOKEN SecurityToken, SECURITY_TOKEN Token, bool Sixup)
^
src\base\system.cpp:4060:71: style: Parameter 'random' can be declared as pointer to const [constParameter]
void generate_password(char *buffer, unsigned length, unsigned short *random, unsigned random_length)
^
src\engine\client\backend\vulkan\backend_vulkan.cpp:263:38: style: Parameter 'AllocatedMemory' can be declared as reference to const [constParameter]
void Free(SMemoryHeapQueueElement &AllocatedMemory)
^
src\engine\client\backend\vulkan\backend_vulkan.cpp:1708:47: style: Parameter 'ImgExtent' can be declared as reference to const [constParameter]
static size_t ImageMipLevelCount(VkExtent3D &ImgExtent)
^
src\engine\client\backend\vulkan\backend_vulkan.cpp:2801:29: style: Parameter 'Image' can be declared as reference to const [constParameter]
void ImageBarrier(VkImage &Image, size_t MipMapBase, size_t MipMapCount, size_t LayerBase, size_t LayerCount, VkFormat Format, VkImageLayout OldLayout, VkImageLayout NewLayout)
^
src\engine\client\backend\vulkan\backend_vulkan.cpp:6495:46: style: Parameter 'ExecBuffer' can be declared as reference to const [constParameter]
void Cmd_Clear(SRenderCommandExecuteBuffer &ExecBuffer, const CCommandBuffer::SCommand_Clear *pCommand)
^
src\game\client\components\skins.cpp:83:72: style: Parameter 'pImg' can be declared as pointer to const [constParameter]
static void CheckMetrics(CSkin::SSkinMetricVariable &Metrics, uint8_t *pImg, int ImgWidth, int ImgX, int ImgY, int CheckWidth, int CheckHeight)
^
src\game\client\prediction\entities\character.h:106:37: style: Parameter 'pNewInput' can be declared as pointer to const [constParameter]
void SetInput(CNetObj_PlayerInput *pNewInput)
^
src\game\client\prediction\gameworld.cpp:245:106: style: Parameter 'pNotThis' can be declared as pointer to const [constParameter]
CCharacter *CGameWorld::IntersectCharacter(vec2 Pos0, vec2 Pos1, float Radius, vec2 &NewPos, CCharacter *pNotThis, int CollideWith, class CCharacter *pThisOnly)
^
src\game\client\prediction\gameworld.cpp:245:151: style: Parameter 'pThisOnly' can be declared as pointer to const [constParameter]
CCharacter *CGameWorld::IntersectCharacter(vec2 Pos0, vec2 Pos1, float Radius, vec2 &NewPos, CCharacter *pNotThis, int CollideWith, class CCharacter *pThisOnly)
^
src\game\client\prediction\gameworld.cpp:283:116: style: Parameter 'pNotThis' can be declared as pointer to const [constParameter]
std::list<class CCharacter *> CGameWorld::IntersectedCharacters(vec2 Pos0, vec2 Pos1, float Radius, class CEntity *pNotThis)
^
src\game\client\ui.cpp:522:180: style: Parameter 'pReadCursor' can be declared as pointer to const [constParameter]
void CUI::DoLabel(CUIElement::SUIElementRect &RectEl, const CUIRect *pRect, const char *pText, float Size, int Align, const SLabelProperties &LabelProps, int StrLen, CTextCursor *pReadCursor)
^
src\game\client\ui_scrollregion.cpp:23:86: style: Parameter 'pParams' can be declared as pointer to const [constParameter]
void CScrollRegion::Begin(CUIRect *pClipRect, vec2 *pOutOffset, CScrollRegionParams *pParams)
^
src\game\server\scoreworker.h:239:29: style: Parameter 'aTimeCp' can be declared as const array [constParameter]
void Set(float Time, float aTimeCp[NUM_CHECKPOINTS])
^
src\game\server\score.cpp:135:80: style: Parameter 'aTimeCp' can be declared as const array [constParameter]
void CScore::SaveScore(int ClientID, float Time, const char *pTimestamp, float aTimeCp[NUM_CHECKPOINTS], bool NotEligible)
^
src\game\server\teeinfo.cpp:40:57: style: Parameter 'pUseCustomColors' can be declared as pointer to const [constParameter]
CTeeInfo::CTeeInfo(const char *apSkinPartNames[6], int *pUseCustomColors, int *pSkinPartColors)
^
src\game\server\teeinfo.cpp:40:80: style: Parameter 'pSkinPartColors' can be declared as pointer to const [constParameter]
CTeeInfo::CTeeInfo(const char *apSkinPartNames[6], int *pUseCustomColors, int *pSkinPartColors)
^
```
2022-11-13 14:32:53 +00:00
|
|
|
CCharacter *IntersectCharacter(vec2 Pos0, vec2 Pos1, float Radius, vec2 &NewPos, const CCharacter *pNotThis = nullptr, int CollideWith = -1, const CCharacter *pThisOnly = nullptr);
|
2008-08-14 18:25:44 +00:00
|
|
|
/*
|
2021-12-14 09:35:00 +00:00
|
|
|
Function: ClosestCharacter
|
2010-05-29 07:25:38 +00:00
|
|
|
Finds the closest CCharacter to a specific point.
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2008-08-14 18:25:44 +00:00
|
|
|
Arguments:
|
2021-12-14 09:35:00 +00:00
|
|
|
Pos - The center position.
|
|
|
|
Radius - How far off the CCharacter is allowed to be
|
Mark parameters as `const` when possible
According to cppchecker's `constParameter` error:
```
src\engine\gfx\image_manipulation.cpp:7:58: style: Parameter 'pSrc' can be declared as pointer to const [constParameter]
static void Dilate(int w, int h, int BPP, unsigned char *pSrc, unsigned char *pDest, unsigned char AlphaThreshold = TW_DILATE_ALPHA_THRESHOLD)
^
src\engine\gfx\image_manipulation.cpp:58:67: style: Parameter 'pSrc' can be declared as pointer to const [constParameter]
static void CopyColorValues(int w, int h, int BPP, unsigned char *pSrc, unsigned char *pDest)
^
src\engine\shared\network_conn.cpp:241:42: style: Parameter 'Addr' can be declared as reference to const [constParameter]
void CNetConnection::DirectInit(NETADDR &Addr, SECURITY_TOKEN SecurityToken, SECURITY_TOKEN Token, bool Sixup)
^
src\base\system.cpp:4060:71: style: Parameter 'random' can be declared as pointer to const [constParameter]
void generate_password(char *buffer, unsigned length, unsigned short *random, unsigned random_length)
^
src\engine\client\backend\vulkan\backend_vulkan.cpp:263:38: style: Parameter 'AllocatedMemory' can be declared as reference to const [constParameter]
void Free(SMemoryHeapQueueElement &AllocatedMemory)
^
src\engine\client\backend\vulkan\backend_vulkan.cpp:1708:47: style: Parameter 'ImgExtent' can be declared as reference to const [constParameter]
static size_t ImageMipLevelCount(VkExtent3D &ImgExtent)
^
src\engine\client\backend\vulkan\backend_vulkan.cpp:2801:29: style: Parameter 'Image' can be declared as reference to const [constParameter]
void ImageBarrier(VkImage &Image, size_t MipMapBase, size_t MipMapCount, size_t LayerBase, size_t LayerCount, VkFormat Format, VkImageLayout OldLayout, VkImageLayout NewLayout)
^
src\engine\client\backend\vulkan\backend_vulkan.cpp:6495:46: style: Parameter 'ExecBuffer' can be declared as reference to const [constParameter]
void Cmd_Clear(SRenderCommandExecuteBuffer &ExecBuffer, const CCommandBuffer::SCommand_Clear *pCommand)
^
src\game\client\components\skins.cpp:83:72: style: Parameter 'pImg' can be declared as pointer to const [constParameter]
static void CheckMetrics(CSkin::SSkinMetricVariable &Metrics, uint8_t *pImg, int ImgWidth, int ImgX, int ImgY, int CheckWidth, int CheckHeight)
^
src\game\client\prediction\entities\character.h:106:37: style: Parameter 'pNewInput' can be declared as pointer to const [constParameter]
void SetInput(CNetObj_PlayerInput *pNewInput)
^
src\game\client\prediction\gameworld.cpp:245:106: style: Parameter 'pNotThis' can be declared as pointer to const [constParameter]
CCharacter *CGameWorld::IntersectCharacter(vec2 Pos0, vec2 Pos1, float Radius, vec2 &NewPos, CCharacter *pNotThis, int CollideWith, class CCharacter *pThisOnly)
^
src\game\client\prediction\gameworld.cpp:245:151: style: Parameter 'pThisOnly' can be declared as pointer to const [constParameter]
CCharacter *CGameWorld::IntersectCharacter(vec2 Pos0, vec2 Pos1, float Radius, vec2 &NewPos, CCharacter *pNotThis, int CollideWith, class CCharacter *pThisOnly)
^
src\game\client\prediction\gameworld.cpp:283:116: style: Parameter 'pNotThis' can be declared as pointer to const [constParameter]
std::list<class CCharacter *> CGameWorld::IntersectedCharacters(vec2 Pos0, vec2 Pos1, float Radius, class CEntity *pNotThis)
^
src\game\client\ui.cpp:522:180: style: Parameter 'pReadCursor' can be declared as pointer to const [constParameter]
void CUI::DoLabel(CUIElement::SUIElementRect &RectEl, const CUIRect *pRect, const char *pText, float Size, int Align, const SLabelProperties &LabelProps, int StrLen, CTextCursor *pReadCursor)
^
src\game\client\ui_scrollregion.cpp:23:86: style: Parameter 'pParams' can be declared as pointer to const [constParameter]
void CScrollRegion::Begin(CUIRect *pClipRect, vec2 *pOutOffset, CScrollRegionParams *pParams)
^
src\game\server\scoreworker.h:239:29: style: Parameter 'aTimeCp' can be declared as const array [constParameter]
void Set(float Time, float aTimeCp[NUM_CHECKPOINTS])
^
src\game\server\score.cpp:135:80: style: Parameter 'aTimeCp' can be declared as const array [constParameter]
void CScore::SaveScore(int ClientID, float Time, const char *pTimestamp, float aTimeCp[NUM_CHECKPOINTS], bool NotEligible)
^
src\game\server\teeinfo.cpp:40:57: style: Parameter 'pUseCustomColors' can be declared as pointer to const [constParameter]
CTeeInfo::CTeeInfo(const char *apSkinPartNames[6], int *pUseCustomColors, int *pSkinPartColors)
^
src\game\server\teeinfo.cpp:40:80: style: Parameter 'pSkinPartColors' can be declared as pointer to const [constParameter]
CTeeInfo::CTeeInfo(const char *apSkinPartNames[6], int *pUseCustomColors, int *pSkinPartColors)
^
```
2022-11-13 14:32:53 +00:00
|
|
|
pNotThis - Entity to ignore
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2008-08-14 18:25:44 +00:00
|
|
|
Returns:
|
2010-05-29 07:25:38 +00:00
|
|
|
Returns a pointer to the closest CCharacter or NULL if no CCharacter is close enough.
|
2008-08-14 18:25:44 +00:00
|
|
|
*/
|
Mark parameters as `const` when possible
According to cppchecker's `constParameter` error:
```
src\engine\gfx\image_manipulation.cpp:7:58: style: Parameter 'pSrc' can be declared as pointer to const [constParameter]
static void Dilate(int w, int h, int BPP, unsigned char *pSrc, unsigned char *pDest, unsigned char AlphaThreshold = TW_DILATE_ALPHA_THRESHOLD)
^
src\engine\gfx\image_manipulation.cpp:58:67: style: Parameter 'pSrc' can be declared as pointer to const [constParameter]
static void CopyColorValues(int w, int h, int BPP, unsigned char *pSrc, unsigned char *pDest)
^
src\engine\shared\network_conn.cpp:241:42: style: Parameter 'Addr' can be declared as reference to const [constParameter]
void CNetConnection::DirectInit(NETADDR &Addr, SECURITY_TOKEN SecurityToken, SECURITY_TOKEN Token, bool Sixup)
^
src\base\system.cpp:4060:71: style: Parameter 'random' can be declared as pointer to const [constParameter]
void generate_password(char *buffer, unsigned length, unsigned short *random, unsigned random_length)
^
src\engine\client\backend\vulkan\backend_vulkan.cpp:263:38: style: Parameter 'AllocatedMemory' can be declared as reference to const [constParameter]
void Free(SMemoryHeapQueueElement &AllocatedMemory)
^
src\engine\client\backend\vulkan\backend_vulkan.cpp:1708:47: style: Parameter 'ImgExtent' can be declared as reference to const [constParameter]
static size_t ImageMipLevelCount(VkExtent3D &ImgExtent)
^
src\engine\client\backend\vulkan\backend_vulkan.cpp:2801:29: style: Parameter 'Image' can be declared as reference to const [constParameter]
void ImageBarrier(VkImage &Image, size_t MipMapBase, size_t MipMapCount, size_t LayerBase, size_t LayerCount, VkFormat Format, VkImageLayout OldLayout, VkImageLayout NewLayout)
^
src\engine\client\backend\vulkan\backend_vulkan.cpp:6495:46: style: Parameter 'ExecBuffer' can be declared as reference to const [constParameter]
void Cmd_Clear(SRenderCommandExecuteBuffer &ExecBuffer, const CCommandBuffer::SCommand_Clear *pCommand)
^
src\game\client\components\skins.cpp:83:72: style: Parameter 'pImg' can be declared as pointer to const [constParameter]
static void CheckMetrics(CSkin::SSkinMetricVariable &Metrics, uint8_t *pImg, int ImgWidth, int ImgX, int ImgY, int CheckWidth, int CheckHeight)
^
src\game\client\prediction\entities\character.h:106:37: style: Parameter 'pNewInput' can be declared as pointer to const [constParameter]
void SetInput(CNetObj_PlayerInput *pNewInput)
^
src\game\client\prediction\gameworld.cpp:245:106: style: Parameter 'pNotThis' can be declared as pointer to const [constParameter]
CCharacter *CGameWorld::IntersectCharacter(vec2 Pos0, vec2 Pos1, float Radius, vec2 &NewPos, CCharacter *pNotThis, int CollideWith, class CCharacter *pThisOnly)
^
src\game\client\prediction\gameworld.cpp:245:151: style: Parameter 'pThisOnly' can be declared as pointer to const [constParameter]
CCharacter *CGameWorld::IntersectCharacter(vec2 Pos0, vec2 Pos1, float Radius, vec2 &NewPos, CCharacter *pNotThis, int CollideWith, class CCharacter *pThisOnly)
^
src\game\client\prediction\gameworld.cpp:283:116: style: Parameter 'pNotThis' can be declared as pointer to const [constParameter]
std::list<class CCharacter *> CGameWorld::IntersectedCharacters(vec2 Pos0, vec2 Pos1, float Radius, class CEntity *pNotThis)
^
src\game\client\ui.cpp:522:180: style: Parameter 'pReadCursor' can be declared as pointer to const [constParameter]
void CUI::DoLabel(CUIElement::SUIElementRect &RectEl, const CUIRect *pRect, const char *pText, float Size, int Align, const SLabelProperties &LabelProps, int StrLen, CTextCursor *pReadCursor)
^
src\game\client\ui_scrollregion.cpp:23:86: style: Parameter 'pParams' can be declared as pointer to const [constParameter]
void CScrollRegion::Begin(CUIRect *pClipRect, vec2 *pOutOffset, CScrollRegionParams *pParams)
^
src\game\server\scoreworker.h:239:29: style: Parameter 'aTimeCp' can be declared as const array [constParameter]
void Set(float Time, float aTimeCp[NUM_CHECKPOINTS])
^
src\game\server\score.cpp:135:80: style: Parameter 'aTimeCp' can be declared as const array [constParameter]
void CScore::SaveScore(int ClientID, float Time, const char *pTimestamp, float aTimeCp[NUM_CHECKPOINTS], bool NotEligible)
^
src\game\server\teeinfo.cpp:40:57: style: Parameter 'pUseCustomColors' can be declared as pointer to const [constParameter]
CTeeInfo::CTeeInfo(const char *apSkinPartNames[6], int *pUseCustomColors, int *pSkinPartColors)
^
src\game\server\teeinfo.cpp:40:80: style: Parameter 'pSkinPartColors' can be declared as pointer to const [constParameter]
CTeeInfo::CTeeInfo(const char *apSkinPartNames[6], int *pUseCustomColors, int *pSkinPartColors)
^
```
2022-11-13 14:32:53 +00:00
|
|
|
CCharacter *ClosestCharacter(vec2 Pos, float Radius, const CEntity *pNotThis);
|
2008-08-14 18:25:44 +00:00
|
|
|
|
|
|
|
/*
|
2021-12-14 09:35:00 +00:00
|
|
|
Function: InsertEntity
|
2008-08-14 18:25:44 +00:00
|
|
|
Adds an entity to the world.
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2008-08-14 18:25:44 +00:00
|
|
|
Arguments:
|
2021-12-14 09:35:00 +00:00
|
|
|
pEntity - Entity to add
|
2008-08-14 18:25:44 +00:00
|
|
|
*/
|
2010-05-29 07:25:38 +00:00
|
|
|
void InsertEntity(CEntity *pEntity);
|
2008-08-14 18:25:44 +00:00
|
|
|
|
|
|
|
/*
|
2021-12-14 09:35:00 +00:00
|
|
|
Function: RemoveEntity
|
2008-08-14 18:25:44 +00:00
|
|
|
Removes an entity from the world.
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2008-08-14 18:25:44 +00:00
|
|
|
Arguments:
|
2021-12-14 09:35:00 +00:00
|
|
|
pEntity - Entity to remove
|
2008-08-14 18:25:44 +00:00
|
|
|
*/
|
2010-05-29 07:25:38 +00:00
|
|
|
void RemoveEntity(CEntity *pEntity);
|
2008-08-14 18:25:44 +00:00
|
|
|
|
2023-01-03 21:57:31 +00:00
|
|
|
void RemoveEntitiesFromPlayers(int PlayerIds[], int NumPlayers);
|
|
|
|
|
2008-08-14 18:25:44 +00:00
|
|
|
/*
|
2021-12-14 09:35:00 +00:00
|
|
|
Function: Snap
|
|
|
|
Calls Snap on all the entities in the world to create
|
2008-08-14 18:25:44 +00:00
|
|
|
the snapshot.
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2008-08-14 18:25:44 +00:00
|
|
|
Arguments:
|
2021-12-14 09:35:00 +00:00
|
|
|
SnappingClient - ID of the client which snapshot
|
2008-08-14 18:25:44 +00:00
|
|
|
is being created.
|
|
|
|
*/
|
2010-05-29 07:25:38 +00:00
|
|
|
void Snap(int SnappingClient);
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2008-08-14 18:25:44 +00:00
|
|
|
/*
|
2021-12-14 09:35:00 +00:00
|
|
|
Function: Tick
|
|
|
|
Calls Tick on all the entities in the world to progress
|
2008-08-14 18:25:44 +00:00
|
|
|
the world to the next tick.
|
|
|
|
*/
|
2010-05-29 07:25:38 +00:00
|
|
|
void Tick();
|
2010-09-11 09:42:35 +00:00
|
|
|
|
2021-12-14 09:35:00 +00:00
|
|
|
/*
|
|
|
|
Function: SwapClients
|
|
|
|
Calls SwapClients on all the entities in the world to ensure that /swap
|
|
|
|
command is handled safely.
|
|
|
|
*/
|
|
|
|
void SwapClients(int Client1, int Client2);
|
|
|
|
|
2011-04-09 06:41:31 +00:00
|
|
|
// DDRace
|
2011-02-13 05:35:13 +00:00
|
|
|
void ReleaseHooked(int ClientID);
|
2010-09-11 09:42:35 +00:00
|
|
|
|
2010-09-10 06:55:04 +00:00
|
|
|
/*
|
2021-12-14 09:35:00 +00:00
|
|
|
Function: IntersectedCharacters
|
2010-09-10 06:55:04 +00:00
|
|
|
Finds all CCharacters that intersect the line.
|
2011-04-09 06:41:31 +00:00
|
|
|
|
2010-09-10 06:55:04 +00:00
|
|
|
Arguments:
|
2021-12-14 09:35:00 +00:00
|
|
|
Pos0 - Start position
|
|
|
|
Pos1 - End position
|
|
|
|
Radius - How for from the line the CCharacter is allowed to be.
|
|
|
|
pNotThis - Entity to ignore intersecting with
|
2011-04-09 06:41:31 +00:00
|
|
|
|
2010-09-10 06:55:04 +00:00
|
|
|
Returns:
|
|
|
|
Returns list with all Characters on line.
|
|
|
|
*/
|
Mark parameters as `const` when possible
According to cppchecker's `constParameter` error:
```
src\engine\gfx\image_manipulation.cpp:7:58: style: Parameter 'pSrc' can be declared as pointer to const [constParameter]
static void Dilate(int w, int h, int BPP, unsigned char *pSrc, unsigned char *pDest, unsigned char AlphaThreshold = TW_DILATE_ALPHA_THRESHOLD)
^
src\engine\gfx\image_manipulation.cpp:58:67: style: Parameter 'pSrc' can be declared as pointer to const [constParameter]
static void CopyColorValues(int w, int h, int BPP, unsigned char *pSrc, unsigned char *pDest)
^
src\engine\shared\network_conn.cpp:241:42: style: Parameter 'Addr' can be declared as reference to const [constParameter]
void CNetConnection::DirectInit(NETADDR &Addr, SECURITY_TOKEN SecurityToken, SECURITY_TOKEN Token, bool Sixup)
^
src\base\system.cpp:4060:71: style: Parameter 'random' can be declared as pointer to const [constParameter]
void generate_password(char *buffer, unsigned length, unsigned short *random, unsigned random_length)
^
src\engine\client\backend\vulkan\backend_vulkan.cpp:263:38: style: Parameter 'AllocatedMemory' can be declared as reference to const [constParameter]
void Free(SMemoryHeapQueueElement &AllocatedMemory)
^
src\engine\client\backend\vulkan\backend_vulkan.cpp:1708:47: style: Parameter 'ImgExtent' can be declared as reference to const [constParameter]
static size_t ImageMipLevelCount(VkExtent3D &ImgExtent)
^
src\engine\client\backend\vulkan\backend_vulkan.cpp:2801:29: style: Parameter 'Image' can be declared as reference to const [constParameter]
void ImageBarrier(VkImage &Image, size_t MipMapBase, size_t MipMapCount, size_t LayerBase, size_t LayerCount, VkFormat Format, VkImageLayout OldLayout, VkImageLayout NewLayout)
^
src\engine\client\backend\vulkan\backend_vulkan.cpp:6495:46: style: Parameter 'ExecBuffer' can be declared as reference to const [constParameter]
void Cmd_Clear(SRenderCommandExecuteBuffer &ExecBuffer, const CCommandBuffer::SCommand_Clear *pCommand)
^
src\game\client\components\skins.cpp:83:72: style: Parameter 'pImg' can be declared as pointer to const [constParameter]
static void CheckMetrics(CSkin::SSkinMetricVariable &Metrics, uint8_t *pImg, int ImgWidth, int ImgX, int ImgY, int CheckWidth, int CheckHeight)
^
src\game\client\prediction\entities\character.h:106:37: style: Parameter 'pNewInput' can be declared as pointer to const [constParameter]
void SetInput(CNetObj_PlayerInput *pNewInput)
^
src\game\client\prediction\gameworld.cpp:245:106: style: Parameter 'pNotThis' can be declared as pointer to const [constParameter]
CCharacter *CGameWorld::IntersectCharacter(vec2 Pos0, vec2 Pos1, float Radius, vec2 &NewPos, CCharacter *pNotThis, int CollideWith, class CCharacter *pThisOnly)
^
src\game\client\prediction\gameworld.cpp:245:151: style: Parameter 'pThisOnly' can be declared as pointer to const [constParameter]
CCharacter *CGameWorld::IntersectCharacter(vec2 Pos0, vec2 Pos1, float Radius, vec2 &NewPos, CCharacter *pNotThis, int CollideWith, class CCharacter *pThisOnly)
^
src\game\client\prediction\gameworld.cpp:283:116: style: Parameter 'pNotThis' can be declared as pointer to const [constParameter]
std::list<class CCharacter *> CGameWorld::IntersectedCharacters(vec2 Pos0, vec2 Pos1, float Radius, class CEntity *pNotThis)
^
src\game\client\ui.cpp:522:180: style: Parameter 'pReadCursor' can be declared as pointer to const [constParameter]
void CUI::DoLabel(CUIElement::SUIElementRect &RectEl, const CUIRect *pRect, const char *pText, float Size, int Align, const SLabelProperties &LabelProps, int StrLen, CTextCursor *pReadCursor)
^
src\game\client\ui_scrollregion.cpp:23:86: style: Parameter 'pParams' can be declared as pointer to const [constParameter]
void CScrollRegion::Begin(CUIRect *pClipRect, vec2 *pOutOffset, CScrollRegionParams *pParams)
^
src\game\server\scoreworker.h:239:29: style: Parameter 'aTimeCp' can be declared as const array [constParameter]
void Set(float Time, float aTimeCp[NUM_CHECKPOINTS])
^
src\game\server\score.cpp:135:80: style: Parameter 'aTimeCp' can be declared as const array [constParameter]
void CScore::SaveScore(int ClientID, float Time, const char *pTimestamp, float aTimeCp[NUM_CHECKPOINTS], bool NotEligible)
^
src\game\server\teeinfo.cpp:40:57: style: Parameter 'pUseCustomColors' can be declared as pointer to const [constParameter]
CTeeInfo::CTeeInfo(const char *apSkinPartNames[6], int *pUseCustomColors, int *pSkinPartColors)
^
src\game\server\teeinfo.cpp:40:80: style: Parameter 'pSkinPartColors' can be declared as pointer to const [constParameter]
CTeeInfo::CTeeInfo(const char *apSkinPartNames[6], int *pUseCustomColors, int *pSkinPartColors)
^
```
2022-11-13 14:32:53 +00:00
|
|
|
std::list<CCharacter *> IntersectedCharacters(vec2 Pos0, vec2 Pos1, float Radius, const CEntity *pNotThis = nullptr);
|
2008-08-14 18:25:44 +00:00
|
|
|
};
|
2008-08-14 18:42:47 +00:00
|
|
|
|
|
|
|
#endif
|