mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Fix MSVS warnings
``` warning C4291: no matching operator delete found; memory will not be freed if initialization throws an exception warning C4305: truncation from 'double' to 'float' warning C4805: unsafe mix of type 'bool' and type 'int' in operation ```
This commit is contained in:
parent
a20db6ec56
commit
4d96090770
|
@ -480,7 +480,7 @@ void CClient::SendInput()
|
|||
if(m_PredTick[g_Config.m_ClDummy] <= 0)
|
||||
return;
|
||||
|
||||
if(m_LastDummy != g_Config.m_ClDummy)
|
||||
if(m_LastDummy != (bool)g_Config.m_ClDummy)
|
||||
{
|
||||
m_LastDummy = g_Config.m_ClDummy;
|
||||
GameClient()->OnDummySwap();
|
||||
|
|
|
@ -2273,10 +2273,11 @@ void CGameClient::FindWeaker(bool IsWeaker[2][MAX_CLIENTS])
|
|||
}
|
||||
PredictErr[dir] = distance(OtherChar.m_Vel, OtherCharCur.m_Vel);
|
||||
}
|
||||
const float Low = 0.0001, High = 0.07;
|
||||
if(PredictErr[1] < Low && PredictErr[0] > High)
|
||||
static const float LOW = 0.0001f;
|
||||
static const float HIGH = 0.07f;
|
||||
if(PredictErr[1] < LOW && PredictErr[0] > HIGH)
|
||||
DirAccumulated[g_Config.m_ClDummy][HookedPlayer] = SaturatedAdd(-1, 2, DirAccumulated[g_Config.m_ClDummy][HookedPlayer], 1);
|
||||
else if(PredictErr[0] < Low && PredictErr[1] > High)
|
||||
else if(PredictErr[0] < LOW && PredictErr[1] > HIGH)
|
||||
DirAccumulated[g_Config.m_ClDummy][HookedPlayer] = SaturatedAdd(-1, 2, DirAccumulated[g_Config.m_ClDummy][HookedPlayer], -1);
|
||||
IsWeaker[g_Config.m_ClDummy][HookedPlayer] = (DirAccumulated[g_Config.m_ClDummy][HookedPlayer] > 0);
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#define MACRO_ALLOC_POOL_ID() \
|
||||
public: \
|
||||
void *operator new(size_t Size, int id); \
|
||||
void operator delete(void *p, int id); \
|
||||
void operator delete(void *p); \
|
||||
private:
|
||||
|
||||
|
@ -41,6 +42,14 @@
|
|||
mem_zero(ms_PoolData##POOLTYPE[id], Size); \
|
||||
return ms_PoolData##POOLTYPE[id]; \
|
||||
} \
|
||||
void POOLTYPE::operator delete(void *p, int id) \
|
||||
{ \
|
||||
dbg_assert(ms_PoolUsed##POOLTYPE[id], "not used"); \
|
||||
dbg_assert(id == (POOLTYPE*)p - (POOLTYPE*)ms_PoolData##POOLTYPE, "invalid id"); \
|
||||
/*dbg_msg("pool", "-- %s %d", #POOLTYPE, id);*/ \
|
||||
ms_PoolUsed##POOLTYPE[id] = 0; \
|
||||
mem_zero(ms_PoolData##POOLTYPE[id], sizeof(POOLTYPE)); \
|
||||
} \
|
||||
void POOLTYPE::operator delete(void *p) \
|
||||
{ \
|
||||
int id = (POOLTYPE*)p - (POOLTYPE*)ms_PoolData##POOLTYPE; \
|
||||
|
|
Loading…
Reference in a new issue