Topic: [SOLVED] [Help] Editing current tw trunk
whenever i try to add a member in gamecore.h class CCharacterCore
the serer crashes on character join in line 43 in character.cpp
this gets executed MACRO_ALLOC_POOL_ID_IMPL(CCharacter, MAX_CLIENTS)
from entities.h and at line 35 this is called dbg_assert(sizeof(POOLTYPE) == Size, "size error"); \
and the server shuts down
i need this badly i don't understand this macro definition so i can;t trace why this happened
#define MACRO_ALLOC_POOL_ID() \
public: \
void *operator new(size_t Size, int id); \
void operator delete(void *p); \
private:
#define MACRO_ALLOC_POOL_ID_IMPL(POOLTYPE, PoolSize) \
static char ms_PoolData##POOLTYPE[PoolSize][sizeof(POOLTYPE)] = {{0}}; \
static int ms_PoolUsed##POOLTYPE[PoolSize] = {0}; \
void *POOLTYPE::operator new(size_t Size, int id) \
{ \
dbg_assert(sizeof(POOLTYPE) == Size, "size error"); \
dbg_assert(!ms_PoolUsed##POOLTYPE[id], "already used"); \
/*dbg_msg("pool", "++ %s %d", #POOLTYPE, id);*/ \
ms_PoolUsed##POOLTYPE[id] = 1; \
mem_zero(ms_PoolData##POOLTYPE[id], Size); \
return ms_PoolData##POOLTYPE[id]; \
} \
void POOLTYPE::operator delete(void *p) \
{ \
int id = (POOLTYPE*)p - (POOLTYPE*)ms_PoolData##POOLTYPE; \
dbg_assert(ms_PoolUsed##POOLTYPE[id], "not used"); \
/*dbg_msg("pool", "-- %s %d", #POOLTYPE, id);*/ \
ms_PoolUsed##POOLTYPE[id] = 0; \
mem_zero(ms_PoolData##POOLTYPE[id], sizeof(POOLTYPE)); \
}
(05:35:03) (GreYFoXGTi) http://www.teeworlds.com/forum/viewtopic.php?pid=69406#p69406
(11:03:33) (Ceer) when you try to add a variable to the class?
(11:53:52) —› quit: (yemDX) (~yemDX@65.69.162.247) (Read error: Connection reset by peer)
(12:01:24) (@matricks) GreYFoXGTi: try "bam -c" and compile again
(12:40:10) (GreYFoXGTi) matricks it didn't make any difference but i will r-clone your bam repo and try again
(12:40:28) (@matricks) just thought if some file didn't compile
(12:41:04) (GreYFoXGTi) they all compiled it's just that this macro always makes a size error cause i added a memeber in the CCharacter core in gamecore.h
(12:41:10) (GreYFoXGTi) when i remove it all goes fine
(12:47:23) (GreYFoXGTi) matricks you are a genius, i never would have guessed it's bam related, thanks a lot it works well now, with the re-cloned bam from ur repo