mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-06-08 09:32:59 +00:00
next little patch of ub, unallocated variable, s int overflow
This commit is contained in:
parent
11aa08aece
commit
63e4b9b18a
|
|
@ -119,6 +119,7 @@ bool CPlatformNetworkManagerStub::Initialise(CGameNetworkManager *pGameNetworkMa
|
|||
m_pGameNetworkManager = pGameNetworkManager;
|
||||
m_flagIndexSize = flagIndexSize;
|
||||
g_pPlatformNetworkManager = this;
|
||||
m_pIQNet = new IQNet();
|
||||
for( int i = 0; i < XUSER_MAX_COUNT; i++ )
|
||||
{
|
||||
playerChangedCallback[ i ] = NULL;
|
||||
|
|
@ -154,6 +155,7 @@ bool CPlatformNetworkManagerStub::Initialise(CGameNetworkManager *pGameNetworkMa
|
|||
|
||||
void CPlatformNetworkManagerStub::Terminate()
|
||||
{
|
||||
//TODO: 4jcraft, no release of ressources
|
||||
}
|
||||
|
||||
int CPlatformNetworkManagerStub::GetJoiningReadyPercentage()
|
||||
|
|
|
|||
|
|
@ -111,38 +111,41 @@ Layer::Layer(__int64 seedMixup)
|
|||
{
|
||||
parent = nullptr;
|
||||
|
||||
// 4jcraft added all those calls abecause of signed int overflow
|
||||
this->seedMixup = seedMixup;
|
||||
this->seedMixup *= this->seedMixup * 6364136223846793005l + 1442695040888963407l;
|
||||
this->seedMixup += seedMixup;
|
||||
this->seedMixup *= this->seedMixup * 6364136223846793005l + 1442695040888963407l;
|
||||
this->seedMixup += seedMixup;
|
||||
this->seedMixup *= this->seedMixup * 6364136223846793005l + 1442695040888963407l;
|
||||
this->seedMixup += seedMixup;
|
||||
this->seedMixup *= (uint64_t) this->seedMixup * 6364136223846793005l + 1442695040888963407l;
|
||||
this->seedMixup = (uint64_t) this->seedMixup + seedMixup;
|
||||
this->seedMixup *= (uint64_t) this->seedMixup * 6364136223846793005l + 1442695040888963407l;
|
||||
this->seedMixup = (uint64_t) this->seedMixup + seedMixup;
|
||||
this->seedMixup *= (uint64_t) this->seedMixup * 6364136223846793005l + 1442695040888963407l;
|
||||
this->seedMixup = (uint64_t) this->seedMixup + seedMixup;
|
||||
}
|
||||
|
||||
void Layer::init(__int64 seed)
|
||||
{
|
||||
this->seed = seed;
|
||||
if (parent != NULL) parent->init(seed);
|
||||
this->seed *= this->seed * 6364136223846793005l + 1442695040888963407l;
|
||||
this->seed += seedMixup;
|
||||
this->seed *= this->seed * 6364136223846793005l + 1442695040888963407l;
|
||||
this->seed += seedMixup;
|
||||
this->seed *= this->seed * 6364136223846793005l + 1442695040888963407l;
|
||||
this->seed += seedMixup;
|
||||
// 4jcraft added all those calls abecause of signed int overflow
|
||||
this->seed *= (uint64_t) this->seed * 6364136223846793005l + 1442695040888963407l;
|
||||
this->seed = (uint64_t) this->seed + seedMixup;
|
||||
this->seed *= (uint64_t) this->seed * 6364136223846793005l + 1442695040888963407l;
|
||||
this->seed = (uint64_t) this->seed + seedMixup;
|
||||
this->seed *= (uint64_t) this->seed * 6364136223846793005l + 1442695040888963407l;
|
||||
this->seed = (uint64_t) this->seed + seedMixup;
|
||||
}
|
||||
|
||||
void Layer::initRandom(__int64 x, __int64 y)
|
||||
{
|
||||
rval = seed;
|
||||
rval *= rval * 6364136223846793005l + 1442695040888963407l;
|
||||
rval += x;
|
||||
rval *= rval * 6364136223846793005l + 1442695040888963407l;
|
||||
rval += y;
|
||||
rval *= rval * 6364136223846793005l + 1442695040888963407l;
|
||||
rval += x;
|
||||
rval *= rval * 6364136223846793005l + 1442695040888963407l;
|
||||
rval += y;
|
||||
// 4jcraft added all those calls abecause of signed int overflow
|
||||
rval *= (uint64_t) rval * 6364136223846793005l + 1442695040888963407l;
|
||||
rval += (uint64_t) x;
|
||||
rval *= (uint64_t) rval * 6364136223846793005l + 1442695040888963407l;
|
||||
rval += (uint64_t) y;
|
||||
rval *= (uint64_t) rval * 6364136223846793005l + 1442695040888963407l;
|
||||
rval += (uint64_t) x;
|
||||
rval *= (uint64_t) rval * 6364136223846793005l + 1442695040888963407l;
|
||||
rval += (uint64_t) y;
|
||||
}
|
||||
|
||||
int Layer::nextRandom(int max)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
class LevelType;
|
||||
|
||||
#ifndef _CONTENT_PACAKGE
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
#define _BIOME_OVERRIDE
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue