Move alloc.h to game/ and use it in client/prediction/entity.h

This commit is contained in:
Alexander Akulich 2023-09-06 01:22:44 +03:00
parent 7dab9e430d
commit a1b7e0c37c
5 changed files with 10 additions and 20 deletions

View file

@ -1968,6 +1968,7 @@ set_src(ENGINE_GFX GLOB src/engine/gfx
image_manipulation.h image_manipulation.h
) )
set_src(GAME_SHARED GLOB src/game set_src(GAME_SHARED GLOB src/game
alloc.h
collision.cpp collision.cpp
collision.h collision.h
ddracechat.h ddracechat.h
@ -2470,7 +2471,6 @@ if(SERVER)
upnp.h upnp.h
) )
set_src(GAME_SERVER GLOB_RECURSE src/game/server set_src(GAME_SERVER GLOB_RECURSE src/game/server
alloc.h
ddracechat.cpp ddracechat.cpp
ddracecommands.cpp ddracecommands.cpp
entities/character.cpp entities/character.cpp

View file

@ -1,7 +1,7 @@
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ /* (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. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */
#ifndef GAME_SERVER_ALLOC_H #ifndef GAME_ALLOC_H
#define GAME_SERVER_ALLOC_H #define GAME_ALLOC_H
#include <new> #include <new>

View file

@ -3,23 +3,11 @@
#ifndef GAME_CLIENT_PREDICTION_ENTITY_H #ifndef GAME_CLIENT_PREDICTION_ENTITY_H
#define GAME_CLIENT_PREDICTION_ENTITY_H #define GAME_CLIENT_PREDICTION_ENTITY_H
#include "gameworld.h"
#include <base/vmath.h> #include <base/vmath.h>
#define MACRO_ALLOC_HEAP() \ #include <game/alloc.h>
public: \
void *operator new(size_t Size) \ #include "gameworld.h"
{ \
void *p = malloc(Size); \
mem_zero(p, Size); \
return p; \
} \
void operator delete(void *pPtr) \
{ \
free(pPtr); \
} \
\
private:
class CEntity class CEntity
{ {

View file

@ -5,7 +5,8 @@
#include <base/vmath.h> #include <base/vmath.h>
#include "alloc.h" #include <game/alloc.h>
#include "gameworld.h" #include "gameworld.h"
class CCollision; class CCollision;

View file

@ -7,7 +7,8 @@
#include <engine/shared/protocol.h> #include <engine/shared/protocol.h>
#include "alloc.h" #include <game/alloc.h>
#include "teeinfo.h" #include "teeinfo.h"
#include <memory> #include <memory>