Use (u)int64 from system.h instead of (u)int64_t from cstdint

src/game/client/prediction/gameworld.h:62:90: error: ‘int64_t’ has not been declared
   62 |  void CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage, int ActivatedTeam, int64_t Mask);
      |                                                                                          ^~~~~~~
This commit is contained in:
def 2020-07-08 16:59:32 +02:00
parent 606e284bef
commit f4344dc420
19 changed files with 52 additions and 58 deletions

View file

@ -2,6 +2,7 @@
#define BASE_HASH_CTXT_H #define BASE_HASH_CTXT_H
#include "hash.h" #include "hash.h"
#include "system.h"
#include <stdint.h> #include <stdint.h>
#if defined(CONF_OPENSSL) #if defined(CONF_OPENSSL)
@ -20,7 +21,7 @@ extern "C" {
#else #else
typedef struct typedef struct
{ {
uint64_t length; uint64 length;
uint32_t state[8]; uint32_t state[8];
uint32_t curlen; uint32_t curlen;
unsigned char buf[64]; unsigned char buf[64];

View file

@ -30,7 +30,7 @@ static const u32 K[64] =
0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL 0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL
}; };
static u32 min(u32 x, u32 y) static u32 minimum(u32 x, u32 y)
{ {
return x < y ? x : y; return x < y ? x : y;
} }
@ -133,7 +133,7 @@ static void sha_process(sha256_state* md, const void* src, u32 inlen)
} }
else else
{ {
u32 n = min(inlen, (block_size - md->curlen)); u32 n = minimum(inlen, (block_size - md->curlen));
memcpy(md->buf + md->curlen, in, n); memcpy(md->buf + md->curlen, in, n);
md->curlen += n; md->curlen += n;
in += n; in += n;

View file

@ -930,9 +930,9 @@ int64 time_get_impl(void)
#if defined(CONF_PLATFORM_MACOSX) #if defined(CONF_PLATFORM_MACOSX)
static int got_timebase = 0; static int got_timebase = 0;
mach_timebase_info_data_t timebase; mach_timebase_info_data_t timebase;
uint64_t time; uint64 time;
uint64_t q; uint64 q;
uint64_t r; uint64 r;
if(!got_timebase) if(!got_timebase)
{ {
mach_timebase_info(&timebase); mach_timebase_info(&timebase);

View file

@ -828,11 +828,11 @@ void CSound::SetVoiceTimeOffset(CVoiceHandle Voice, float offset)
{ {
int Tick = 0; int Tick = 0;
bool IsLooping = m_aVoices[VoiceID].m_Flags&ISound::FLAG_LOOP; bool IsLooping = m_aVoices[VoiceID].m_Flags&ISound::FLAG_LOOP;
uint64_t TickOffset = m_aVoices[VoiceID].m_pSample->m_Rate * offset; uint64 TickOffset = m_aVoices[VoiceID].m_pSample->m_Rate * offset;
if(m_aVoices[VoiceID].m_pSample->m_NumFrames > 0 && IsLooping) if(m_aVoices[VoiceID].m_pSample->m_NumFrames > 0 && IsLooping)
Tick = TickOffset % m_aVoices[VoiceID].m_pSample->m_NumFrames; Tick = TickOffset % m_aVoices[VoiceID].m_pSample->m_NumFrames;
else else
Tick = clamp(TickOffset, (uint64_t)0, (uint64_t)m_aVoices[VoiceID].m_pSample->m_NumFrames); Tick = clamp(TickOffset, (uint64)0, (uint64)m_aVoices[VoiceID].m_pSample->m_NumFrames);
// at least 200msec off, else depend on buffer size // at least 200msec off, else depend on buffer size
float Threshold = maximum(0.2f * m_aVoices[VoiceID].m_pSample->m_Rate, (float)m_MaxFrames); float Threshold = maximum(0.2f * m_aVoices[VoiceID].m_pSample->m_Rate, (float)m_MaxFrames);

View file

@ -220,7 +220,7 @@ void CVideo::NextVideoFrameThread()
if(m_Vseq >= 2) if(m_Vseq >= 2)
{ {
m_ProcessingVideoFrame = true; m_ProcessingVideoFrame = true;
m_VideoStream.pFrame->pts = (int64_t)m_VideoStream.pEnc->frame_number; m_VideoStream.pFrame->pts = (int64)m_VideoStream.pEnc->frame_number;
dbg_msg("video_recorder", "vframe: %d", m_VideoStream.pEnc->frame_number); dbg_msg("video_recorder", "vframe: %d", m_VideoStream.pEnc->frame_number);
ReadRGBFromGL(); ReadRGBFromGL();
@ -407,7 +407,7 @@ AVFrame* CVideo::AllocPicture(enum AVPixelFormat PixFmt, int Width, int Height)
} }
AVFrame* CVideo::AllocAudioFrame(enum AVSampleFormat SampleFmt, uint64_t ChannelLayout, int SampleRate, int NbSamples) AVFrame* CVideo::AllocAudioFrame(enum AVSampleFormat SampleFmt, uint64 ChannelLayout, int SampleRate, int NbSamples)
{ {
AVFrame *Frame = av_frame_alloc(); AVFrame *Frame = av_frame_alloc();
int Ret; int Ret;

View file

@ -41,7 +41,7 @@ typedef struct OutputStream {
AVCodecContext *pEnc; AVCodecContext *pEnc;
/* pts of the next frame that will be generated */ /* pts of the next frame that will be generated */
int64_t NextPts; int64 NextPts;
int SamplesCount; int SamplesCount;
AVFrame *pFrame; AVFrame *pFrame;
@ -83,7 +83,7 @@ private:
void OpenVideo(); void OpenVideo();
void OpenAudio(); void OpenAudio();
AVFrame *AllocPicture(enum AVPixelFormat PixFmt, int Width, int Height); AVFrame *AllocPicture(enum AVPixelFormat PixFmt, int Width, int Height);
AVFrame* AllocAudioFrame(enum AVSampleFormat SampleFmt, uint64_t ChannelLayout, int SampleRate, int NbSamples); AVFrame* AllocAudioFrame(enum AVSampleFormat SampleFmt, uint64 ChannelLayout, int SampleRate, int NbSamples);
void WriteFrame(OutputStream* pStream); void WriteFrame(OutputStream* pStream);
void FinishFrames(OutputStream* pStream); void FinishFrames(OutputStream* pStream);

View file

@ -88,7 +88,7 @@ void CProjectile::Tick()
if(m_LifeSpan > -1) if(m_LifeSpan > -1)
m_LifeSpan--; m_LifeSpan--;
int64_t TeamMask = -1LL; int64 TeamMask = -1LL;
bool isWeaponCollide = false; bool isWeaponCollide = false;
if if
( (
@ -140,7 +140,7 @@ void CProjectile::Tick()
if(m_Owner >= 0) if(m_Owner >= 0)
pOwnerChar = GameWorld()->GetCharacterByID(m_Owner); pOwnerChar = GameWorld()->GetCharacterByID(m_Owner);
int64_t TeamMask = -1LL; int64 TeamMask = -1LL;
GameWorld()->CreateExplosion(ColPos, m_Owner, m_Type, m_Owner == -1, (!pOwnerChar ? -1 : pOwnerChar->Team()), GameWorld()->CreateExplosion(ColPos, m_Owner, m_Type, m_Owner == -1, (!pOwnerChar ? -1 : pOwnerChar->Team()),
(m_Owner != -1)? TeamMask : -1LL); (m_Owner != -1)? TeamMask : -1LL);

View file

@ -294,7 +294,7 @@ CEntity *CGameWorld::GetEntity(int ID, int EntType)
return 0; return 0;
} }
void CGameWorld::CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage, int ActivatedTeam, int64_t Mask) void CGameWorld::CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage, int ActivatedTeam, int64 Mask)
{ {
if(Owner < 0 && m_WorldConfig.m_IsSolo && !(Weapon == WEAPON_SHOTGUN && m_WorldConfig.m_IsDDRace)) if(Owner < 0 && m_WorldConfig.m_IsSolo && !(Weapon == WEAPON_SHOTGUN && m_WorldConfig.m_IsDDRace))
return; return;

View file

@ -59,7 +59,7 @@ public:
class CCharacter *GetCharacterByID(int ID) { return (ID >= 0 && ID < MAX_CLIENTS) ? m_apCharacters[ID] : 0; } class CCharacter *GetCharacterByID(int ID) { return (ID >= 0 && ID < MAX_CLIENTS) ? m_apCharacters[ID] : 0; }
// from gamecontext // from gamecontext
void CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage, int ActivatedTeam, int64_t Mask); void CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage, int ActivatedTeam, int64 Mask);
// for client side prediction // for client side prediction
struct struct

View file

@ -1005,7 +1005,7 @@ bool CCharacter::TakeDamage(vec2 Force, int Dmg, int From, int Weapon)
// do damage Hit sound // do damage Hit sound
if(From >= 0 && From != m_pPlayer->GetCID() && GameServer()->m_apPlayers[From]) if(From >= 0 && From != m_pPlayer->GetCID() && GameServer()->m_apPlayers[From])
{ {
int64_t Mask = CmaskOne(From); int64 Mask = CmaskOne(From);
for(int i = 0; i < MAX_CLIENTS; i++) for(int i = 0; i < MAX_CLIENTS; i++)
{ {
if(GameServer()->m_apPlayers[i] && GameServer()->m_apPlayers[i]->GetTeam() == TEAM_SPECTATORS && GameServer()->m_apPlayers[i]->m_SpectatorID == From) if(GameServer()->m_apPlayers[i] && GameServer()->m_apPlayers[i]->GetTeam() == TEAM_SPECTATORS && GameServer()->m_apPlayers[i]->m_SpectatorID == From)

View file

@ -266,7 +266,7 @@ void CLaser::Snap(int SnappingClient)
return; return;
CCharacter *pOwnerChar = 0; CCharacter *pOwnerChar = 0;
int64_t TeamMask = -1LL; int64 TeamMask = -1LL;
if(m_Owner >= 0) if(m_Owner >= 0)
pOwnerChar = GameServer()->GetPlayerChar(m_Owner); pOwnerChar = GameServer()->GetPlayerChar(m_Owner);

View file

@ -125,7 +125,7 @@ void CProjectile::Tick()
if(m_LifeSpan > -1) if(m_LifeSpan > -1)
m_LifeSpan--; m_LifeSpan--;
int64_t TeamMask = -1LL; int64 TeamMask = -1LL;
bool IsWeaponCollide = false; bool IsWeaponCollide = false;
if if
( (
@ -254,7 +254,7 @@ void CProjectile::Tick()
if(m_Owner >= 0) if(m_Owner >= 0)
pOwnerChar = GameServer()->GetPlayerChar(m_Owner); pOwnerChar = GameServer()->GetPlayerChar(m_Owner);
int64_t TeamMask = -1LL; int64 TeamMask = -1LL;
if (pOwnerChar && pOwnerChar->IsAlive()) if (pOwnerChar && pOwnerChar->IsAlive())
{ {
TeamMask = pOwnerChar->Teams()->TeamMask(pOwnerChar->Team(), -1, m_Owner); TeamMask = pOwnerChar->Teams()->TeamMask(pOwnerChar->Team(), -1, m_Owner);
@ -312,7 +312,7 @@ void CProjectile::Snap(int SnappingClient)
return; return;
CCharacter *pOwnerChar = 0; CCharacter *pOwnerChar = 0;
int64_t TeamMask = -1LL; int64 TeamMask = -1LL;
if(m_Owner >= 0) if(m_Owner >= 0)
pOwnerChar = GameServer()->GetPlayerChar(m_Owner); pOwnerChar = GameServer()->GetPlayerChar(m_Owner);

View file

@ -17,7 +17,7 @@ void CEventHandler::SetGameServer(CGameContext *pGameServer)
m_pGameServer = pGameServer; m_pGameServer = pGameServer;
} }
void *CEventHandler::Create(int Type, int Size, int64_t Mask) void *CEventHandler::Create(int Type, int Size, int64 Mask)
{ {
if(m_NumEvents == MAX_EVENTS) if(m_NumEvents == MAX_EVENTS)
return 0; return 0;

View file

@ -3,14 +3,7 @@
#ifndef GAME_SERVER_EVENTHANDLER_H #ifndef GAME_SERVER_EVENTHANDLER_H
#define GAME_SERVER_EVENTHANDLER_H #define GAME_SERVER_EVENTHANDLER_H
#if !defined(_MSC_VER) || _MSC_VER >= 1600 #include <base/system.h>
#include <stdint.h>
#else
typedef __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#endif
// //
class CEventHandler class CEventHandler
{ {
@ -20,7 +13,7 @@ class CEventHandler
int m_aTypes[MAX_EVENTS]; // TODO: remove some of these arrays int m_aTypes[MAX_EVENTS]; // TODO: remove some of these arrays
int m_aOffsets[MAX_EVENTS]; int m_aOffsets[MAX_EVENTS];
int m_aSizes[MAX_EVENTS]; int m_aSizes[MAX_EVENTS];
int64_t m_aClientMasks[MAX_EVENTS]; int64 m_aClientMasks[MAX_EVENTS];
char m_aData[MAX_DATASIZE]; char m_aData[MAX_DATASIZE];
class CGameContext *m_pGameServer; class CGameContext *m_pGameServer;
@ -32,7 +25,7 @@ public:
void SetGameServer(CGameContext *pGameServer); void SetGameServer(CGameContext *pGameServer);
CEventHandler(); CEventHandler();
void *Create(int Type, int Size, int64_t Mask = -1LL); void *Create(int Type, int Size, int64 Mask = -1LL);
void Clear(); void Clear();
void Snap(int SnappingClient); void Snap(int SnappingClient);

View file

@ -176,7 +176,7 @@ void CGameContext::FillAntibot(CAntibotRoundData *pData)
} }
} }
void CGameContext::CreateDamageInd(vec2 Pos, float Angle, int Amount, int64_t Mask) void CGameContext::CreateDamageInd(vec2 Pos, float Angle, int Amount, int64 Mask)
{ {
float a = 3 * 3.14159f / 2 + Angle; float a = 3 * 3.14159f / 2 + Angle;
//float a = get_angle(dir); //float a = get_angle(dir);
@ -195,7 +195,7 @@ void CGameContext::CreateDamageInd(vec2 Pos, float Angle, int Amount, int64_t Ma
} }
} }
void CGameContext::CreateHammerHit(vec2 Pos, int64_t Mask) void CGameContext::CreateHammerHit(vec2 Pos, int64 Mask)
{ {
// create the event // create the event
CNetEvent_HammerHit *pEvent = (CNetEvent_HammerHit *)m_Events.Create(NETEVENTTYPE_HAMMERHIT, sizeof(CNetEvent_HammerHit), Mask); CNetEvent_HammerHit *pEvent = (CNetEvent_HammerHit *)m_Events.Create(NETEVENTTYPE_HAMMERHIT, sizeof(CNetEvent_HammerHit), Mask);
@ -206,7 +206,7 @@ void CGameContext::CreateHammerHit(vec2 Pos, int64_t Mask)
} }
} }
void CGameContext::CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage, int ActivatedTeam, int64_t Mask) void CGameContext::CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage, int ActivatedTeam, int64 Mask)
{ {
// create the event // create the event
CNetEvent_Explosion *pEvent = (CNetEvent_Explosion *)m_Events.Create(NETEVENTTYPE_EXPLOSION, sizeof(CNetEvent_Explosion), Mask); CNetEvent_Explosion *pEvent = (CNetEvent_Explosion *)m_Events.Create(NETEVENTTYPE_EXPLOSION, sizeof(CNetEvent_Explosion), Mask);
@ -221,7 +221,7 @@ void CGameContext::CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamag
float Radius = 135.0f; float Radius = 135.0f;
float InnerRadius = 48.0f; float InnerRadius = 48.0f;
int Num = m_World.FindEntities(Pos, Radius, (CEntity**)apEnts, MAX_CLIENTS, CGameWorld::ENTTYPE_CHARACTER); int Num = m_World.FindEntities(Pos, Radius, (CEntity**)apEnts, MAX_CLIENTS, CGameWorld::ENTTYPE_CHARACTER);
int64_t TeamMask = -1; int64 TeamMask = -1;
for(int i = 0; i < Num; i++) for(int i = 0; i < Num; i++)
{ {
vec2 Diff = apEnts[i]->m_Pos - Pos; vec2 Diff = apEnts[i]->m_Pos - Pos;
@ -257,7 +257,7 @@ void CGameContext::CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamag
} }
} }
void CGameContext::CreatePlayerSpawn(vec2 Pos, int64_t Mask) void CGameContext::CreatePlayerSpawn(vec2 Pos, int64 Mask)
{ {
// create the event // create the event
CNetEvent_Spawn *ev = (CNetEvent_Spawn *)m_Events.Create(NETEVENTTYPE_SPAWN, sizeof(CNetEvent_Spawn), Mask); CNetEvent_Spawn *ev = (CNetEvent_Spawn *)m_Events.Create(NETEVENTTYPE_SPAWN, sizeof(CNetEvent_Spawn), Mask);
@ -268,7 +268,7 @@ void CGameContext::CreatePlayerSpawn(vec2 Pos, int64_t Mask)
} }
} }
void CGameContext::CreateDeath(vec2 Pos, int ClientID, int64_t Mask) void CGameContext::CreateDeath(vec2 Pos, int ClientID, int64 Mask)
{ {
// create the event // create the event
CNetEvent_Death *pEvent = (CNetEvent_Death *)m_Events.Create(NETEVENTTYPE_DEATH, sizeof(CNetEvent_Death), Mask); CNetEvent_Death *pEvent = (CNetEvent_Death *)m_Events.Create(NETEVENTTYPE_DEATH, sizeof(CNetEvent_Death), Mask);
@ -280,7 +280,7 @@ void CGameContext::CreateDeath(vec2 Pos, int ClientID, int64_t Mask)
} }
} }
void CGameContext::CreateSound(vec2 Pos, int Sound, int64_t Mask) void CGameContext::CreateSound(vec2 Pos, int Sound, int64 Mask)
{ {
if (Sound < 0) if (Sound < 0)
return; return;

View file

@ -22,8 +22,8 @@
#ifdef _MSC_VER #ifdef _MSC_VER
typedef __int32 int32_t; typedef __int32 int32_t;
typedef unsigned __int32 uint32_t; typedef unsigned __int32 uint32_t;
typedef __int64 int64_t; typedef __int64 int64;
typedef unsigned __int64 uint64_t; typedef unsigned __int64 uint64;
#else #else
#include <stdint.h> #include <stdint.h>
#endif #endif
@ -178,12 +178,12 @@ public:
CVoteOptionServer *m_pVoteOptionLast; CVoteOptionServer *m_pVoteOptionLast;
// helper functions // helper functions
void CreateDamageInd(vec2 Pos, float AngleMod, int Amount, int64_t Mask=-1); void CreateDamageInd(vec2 Pos, float AngleMod, int Amount, int64 Mask=-1);
void CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage, int ActivatedTeam, int64_t Mask); void CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage, int ActivatedTeam, int64 Mask);
void CreateHammerHit(vec2 Pos, int64_t Mask=-1); void CreateHammerHit(vec2 Pos, int64 Mask=-1);
void CreatePlayerSpawn(vec2 Pos, int64_t Mask=-1); void CreatePlayerSpawn(vec2 Pos, int64 Mask=-1);
void CreateDeath(vec2 Pos, int Who, int64_t Mask=-1); void CreateDeath(vec2 Pos, int Who, int64 Mask=-1);
void CreateSound(vec2 Pos, int Sound, int64_t Mask=-1); void CreateSound(vec2 Pos, int Sound, int64 Mask=-1);
void CreateSoundGlobal(int Sound, int Target=-1); void CreateSoundGlobal(int Sound, int Target=-1);
@ -433,9 +433,9 @@ public:
int m_ChatPrintCBIndex; int m_ChatPrintCBIndex;
}; };
inline int64_t CmaskAll() { return -1LL; } inline int64 CmaskAll() { return -1LL; }
inline int64_t CmaskOne(int ClientID) { return 1LL<<ClientID; } inline int64 CmaskOne(int ClientID) { return 1LL<<ClientID; }
inline int64_t CmaskUnset(int64_t Mask, int ClientID) { return Mask^CmaskOne(ClientID); } inline int64 CmaskUnset(int64 Mask, int ClientID) { return Mask^CmaskOne(ClientID); }
inline int64_t CmaskAllExceptOne(int ClientID) { return CmaskUnset(CmaskAll(), ClientID); } inline int64 CmaskAllExceptOne(int ClientID) { return CmaskUnset(CmaskAll(), ClientID); }
inline bool CmaskIsSet(int64_t Mask, int ClientID) { return (Mask&CmaskOne(ClientID)) != 0; } inline bool CmaskIsSet(int64 Mask, int ClientID) { return (Mask&CmaskOne(ClientID)) != 0; }
#endif #endif

View file

@ -12,8 +12,8 @@ class CDoor;
#else #else
typedef __int32 int32_t; typedef __int32 int32_t;
typedef unsigned __int32 uint32_t; typedef unsigned __int32 uint32_t;
typedef __int64 int64_t; typedef __int64 int64;
typedef unsigned __int64 uint64_t; typedef unsigned __int64 uint64;
#endif #endif
/* /*

View file

@ -372,9 +372,9 @@ bool CGameTeams::TeamFinished(int Team)
return true; return true;
} }
int64_t CGameTeams::TeamMask(int Team, int ExceptID, int Asker) int64 CGameTeams::TeamMask(int Team, int ExceptID, int Asker)
{ {
int64_t Mask = 0; int64 Mask = 0;
for (int i = 0; i < MAX_CLIENTS; ++i) for (int i = 0; i < MAX_CLIENTS; ++i)
{ {

View file

@ -11,7 +11,7 @@ class CGameTeams
int m_TeamState[MAX_CLIENTS]; int m_TeamState[MAX_CLIENTS];
bool m_TeeFinished[MAX_CLIENTS]; bool m_TeeFinished[MAX_CLIENTS];
bool m_TeamLocked[MAX_CLIENTS]; bool m_TeamLocked[MAX_CLIENTS];
uint64_t m_Invited[MAX_CLIENTS]; uint64 m_Invited[MAX_CLIENTS];
bool m_Practice[MAX_CLIENTS]; bool m_Practice[MAX_CLIENTS];
std::shared_ptr<CScoreSaveResult> m_pSaveTeamResult[MAX_CLIENTS]; std::shared_ptr<CScoreSaveResult> m_pSaveTeamResult[MAX_CLIENTS];
@ -61,7 +61,7 @@ public:
void ChangeTeamState(int Team, int State); void ChangeTeamState(int Team, int State);
void onChangeTeamState(int Team, int State, int OldState); void onChangeTeamState(int Team, int State, int OldState);
int64_t TeamMask(int Team, int ExceptID = -1, int Asker = -1); int64 TeamMask(int Team, int ExceptID = -1, int Asker = -1);
int Count(int Team) const; int Count(int Team) const;