Get rid of MSVC's __int64

Use either int64_t, uint64_t or long long and unsigned long long, defined as per C++11 standard
This commit is contained in:
void_17
2026-03-02 15:53:32 +07:00
parent d6ec138710
commit d63f79325f
308 changed files with 5371 additions and 5379 deletions

View File

@@ -2,7 +2,7 @@
#include "net.minecraft.world.level.newbiome.layer.h"
#include "net.minecraft.world.level.biome.h"
AddIslandLayer::AddIslandLayer(__int64 seedMixup, shared_ptr<Layer>parent) : Layer(seedMixup)
AddIslandLayer::AddIslandLayer(int64_t seedMixup, shared_ptr<Layer>parent) : Layer(seedMixup)
{
this->parent = parent;
}

View File

@@ -5,7 +5,7 @@
class AddIslandLayer : public Layer
{
public:
AddIslandLayer(__int64 seedMixup, shared_ptr<Layer>parent);
AddIslandLayer(int64_t seedMixup, shared_ptr<Layer>parent);
intArray getArea(int xo, int yo, int w, int h);
};

View File

@@ -3,7 +3,7 @@
#include "net.minecraft.world.level.biome.h"
AddMushroomIslandLayer::AddMushroomIslandLayer(__int64 seedMixup, shared_ptr<Layer> parent) : Layer(seedMixup)
AddMushroomIslandLayer::AddMushroomIslandLayer(int64_t seedMixup, shared_ptr<Layer> parent) : Layer(seedMixup)
{
this->parent = parent;
}

View File

@@ -4,6 +4,6 @@
class AddMushroomIslandLayer : public Layer
{
public:
AddMushroomIslandLayer(__int64 seedMixup, shared_ptr<Layer> parent);
AddMushroomIslandLayer(int64_t seedMixup, shared_ptr<Layer> parent);
virtual intArray getArea(int xo, int yo, int w, int h);
};

View File

@@ -2,7 +2,7 @@
#include "net.minecraft.world.level.newbiome.layer.h"
#include "net.minecraft.world.level.biome.h"
AddSnowLayer::AddSnowLayer(__int64 seedMixup, shared_ptr<Layer> parent) : Layer(seedMixup)
AddSnowLayer::AddSnowLayer(int64_t seedMixup, shared_ptr<Layer> parent) : Layer(seedMixup)
{
this->parent = parent;
}

View File

@@ -4,6 +4,6 @@
class AddSnowLayer : public Layer
{
public:
AddSnowLayer(__int64 seedMixup, shared_ptr<Layer> parent);
AddSnowLayer(int64_t seedMixup, shared_ptr<Layer> parent);
virtual intArray getArea(int xo, int yo, int w, int h);
};

View File

@@ -524,7 +524,7 @@ bool BasicTree::place(Level *level, Random *random, int x, int y, int z)
// Initialize the instance fields for the level and the seed.
thisLevel = level;
__int64 seed = random->nextLong();
int64_t seed = random->nextLong();
rnd->setSeed(seed);
// Initialize the origin of the tree trunk
origin[0] = x;

View File

@@ -57,14 +57,14 @@ public:
}
static bool isInfinite( double a ) { return false; /*4J TODO*/ }
static double longBitsToDouble( __int64 bits )
static double longBitsToDouble( int64_t bits )
{
return *(double *)&bits;
}
static __int64 doubleToLongBits( double d )
static int64_t doubleToLongBits( double d )
{
return *(__int64 *)&d;
return *(int64_t *)&d;
}
};

View File

@@ -85,7 +85,7 @@ BiomeCache::Block *BiomeCache::getBlockAt(int x, int z)
EnterCriticalSection(&m_CS);
x >>= ZONE_SIZE_BITS;
z >>= ZONE_SIZE_BITS;
__int64 slot = (((__int64) x) & 0xffffffffl) | ((((__int64) z) & 0xffffffffl) << 32l);
int64_t slot = (((int64_t) x) & 0xffffffffl) | ((((int64_t) z) & 0xffffffffl) << 32l);
AUTO_VAR(it, cached.find(slot));
Block *block = NULL;
if (it == cached.end())
@@ -124,8 +124,8 @@ float BiomeCache::getDownfall(int x, int z)
void BiomeCache::update()
{
EnterCriticalSection(&m_CS);
__int64 now = app.getAppTime();
__int64 utime = now - lastUpdateTime;
int64_t now = app.getAppTime();
int64_t utime = now - lastUpdateTime;
if (utime > DECAY_TIME / 4 || utime < 0)
{
lastUpdateTime = now;
@@ -133,11 +133,11 @@ void BiomeCache::update()
for (AUTO_VAR(it, all.begin()); it != all.end();)
{
Block *block = *it;
__int64 time = now - block->lastUse;
int64_t time = now - block->lastUse;
if (time > DECAY_TIME || time < 0)
{
it = all.erase(it);
__int64 slot = (((__int64) block->x) & 0xffffffffl) | ((((__int64) block->z) & 0xffffffffl) << 32l);
int64_t slot = (((int64_t) block->x) & 0xffffffffl) | ((((int64_t) block->z) & 0xffffffffl) << 32l);
cached.erase(slot);
delete block;
}

View File

@@ -10,7 +10,7 @@ private:
static const int ZONE_SIZE_MASK = ZONE_SIZE - 1;
const BiomeSource *source;
__int64 lastUpdateTime;
int64_t lastUpdateTime;
public:
class Block
@@ -22,7 +22,7 @@ public:
// BiomeArray biomes;
byteArray biomeIndices;
int x, z;
__int64 lastUse;
int64_t lastUse;
Block(int x, int z, BiomeCache *parent);
~Block();
@@ -32,7 +32,7 @@ public:
};
private:
unordered_map<__int64,Block *,LongKeyHash,LongKeyEq> cached; // 4J - was LongHashMap
unordered_map<int64_t,Block *,LongKeyHash,LongKeyEq> cached; // 4J - was LongHashMap
vector<Block *> all; // was ArrayList<Block>
public:

View File

@@ -4,7 +4,7 @@
#include "net.minecraft.world.level.h"
#include "BiomeInitLayer.h"
BiomeInitLayer::BiomeInitLayer(__int64 seed, shared_ptr<Layer>parent, LevelType *levelType) : Layer(seed)
BiomeInitLayer::BiomeInitLayer(int64_t seed, shared_ptr<Layer>parent, LevelType *levelType) : Layer(seed)
{
this->parent = parent;

View File

@@ -10,7 +10,7 @@ private:
BiomeArray startBiomes;
public:
BiomeInitLayer(__int64 seed, shared_ptr<Layer> parent, LevelType *levelType);
BiomeInitLayer(int64_t seed, shared_ptr<Layer> parent, LevelType *levelType);
virtual ~BiomeInitLayer();
intArray getArea(int xo, int yo, int w, int h);
};

View File

@@ -10,10 +10,10 @@
// 4J - removal of separate temperature & downfall layers brought forward from 1.2.3
void BiomeSource::_init()
{
{
layer = nullptr;
zoomedLayer = nullptr;
cache = new BiomeCache(this);
playerSpawnBiomes.push_back(Biome::forest);
@@ -26,7 +26,7 @@ void BiomeSource::_init()
playerSpawnBiomes.push_back(Biome::jungleHills);
}
void BiomeSource::_init(__int64 seed, LevelType *generator)
void BiomeSource::_init(int64_t seed, LevelType *generator)
{
_init();
@@ -43,7 +43,7 @@ BiomeSource::BiomeSource()
}
// 4J added
BiomeSource::BiomeSource(__int64 seed, LevelType *generator)
BiomeSource::BiomeSource(int64_t seed, LevelType *generator)
{
_init(seed, generator);
}
@@ -271,7 +271,7 @@ void BiomeSource::getBiomeIndexBlock(byteArray& biomeIndices, int x, int z, int
/**
* Checks if an area around a block contains only the specified biomes.
* Useful for placing elements like towns.
*
*
* This is a bit of a rough check, to make it as fast as possible. To ensure
* NO other biomes, add a margin of at least four blocks to the radius
*/
@@ -298,7 +298,7 @@ bool BiomeSource::containsOnly(int x, int z, int r, vector<Biome *> allowed)
/**
* Checks if an area around a block contains only the specified biome.
* Useful for placing elements like towns.
*
*
* This is a bit of a rough check, to make it as fast as possible. To ensure
* NO other biomes, add a margin of at least four blocks to the radius
*/
@@ -308,7 +308,7 @@ bool BiomeSource::containsOnly(int x, int z, int r, Biome *allowed)
int z0 = ((z - r) >> 2);
int x1 = ((x + r) >> 2);
int z1 = ((z + r) >> 2);
int w = x1 - x0;
int h = z1 - z0;
int biomesCount = w*h;
@@ -325,7 +325,7 @@ bool BiomeSource::containsOnly(int x, int z, int r, Biome *allowed)
/**
* Finds the specified biome within the radius. This will return a random
* position if several are found. This test is fairly rough.
*
*
* Returns null if the biome wasn't found
*/
TilePos *BiomeSource::findBiome(int x, int z, int r, Biome *toFind, Random *random)
@@ -362,7 +362,7 @@ TilePos *BiomeSource::findBiome(int x, int z, int r, Biome *toFind, Random *rand
/**
* Finds one of the specified biomes within the radius. This will return a
* random position if several are found. This test is fairly rough.
*
*
* Returns null if the biome wasn't found
*/
TilePos *BiomeSource::findBiome(int x, int z, int r, vector<Biome *> allowed, Random *random)
@@ -408,13 +408,13 @@ void BiomeSource::update()
// 4J added - find a seed for this biomesource that matches certain criteria
#ifdef __PSVITA__
__int64 BiomeSource::findSeed(LevelType *generator, bool* pServerRunning) // MGH - added pRunning, so we can early out of this on Vita as it can take up to 60 secs
int64_t BiomeSource::findSeed(LevelType *generator, bool* pServerRunning) // MGH - added pRunning, so we can early out of this on Vita as it can take up to 60 secs
#else
__int64 BiomeSource::findSeed(LevelType *generator)
int64_t BiomeSource::findSeed(LevelType *generator)
#endif
{
__int64 bestSeed = 0;
int64_t bestSeed = 0;
ProgressRenderer *mcprogress = Minecraft::GetInstance()->progressRenderer;
mcprogress->progressStage(IDS_PROGRESS_NEW_WORLD_SEED);
@@ -452,7 +452,7 @@ __int64 BiomeSource::findSeed(LevelType *generator)
// Just keeping trying to generate seeds until we find one that matches our criteria
do
{
__int64 seed = pr->nextLong();
int64_t seed = pr->nextLong();
BiomeSource *biomeSource = new BiomeSource(seed,generator);
biomeSource->getRawBiomeIndices(indices, biomeOffset, biomeOffset, biomeWidth, biomeWidth);
@@ -484,7 +484,7 @@ __int64 BiomeSource::findSeed(LevelType *generator)
unsigned int *pixels = new unsigned int[54 * 16 * 54 * 16];
for(int i = 0; i < 54 * 16 * 54 * 16; i++ )
{
{
int id = biomes[i]->id;
// Create following colours:
@@ -560,7 +560,7 @@ void BiomeSource::getFracs(intArray indices, float *fracs)
bool BiomeSource::getIsMatch(float *frac)
{
// A true for a particular biome type here marks it as one that *has* to be present
static const bool critical[Biome::BIOME_COUNT] = {
static const bool critical[Biome::BIOME_COUNT] = {
true, // ocean
true, // plains
true, // desert

View File

@@ -25,20 +25,20 @@ private:
protected:
void _init();
void _init(__int64 seed, LevelType *generator);
void _init(int64_t seed, LevelType *generator);
BiomeSource();
public:
BiomeSource(__int64 seed, LevelType *generator);
BiomeSource(int64_t seed, LevelType *generator);
BiomeSource(Level *level);
private:
static bool getIsMatch(float *frac); // 4J added
static void getFracs(intArray indices, float *fracs); // 4J added
public:
#ifdef __PSVITA__
static __int64 findSeed(LevelType *generator, bool* pServerRunning); // MGH - added pRunning, so we can early out of this on Vita as it can take up to 60 secs // 4J added
static int64_t findSeed(LevelType *generator, bool* pServerRunning); // MGH - added pRunning, so we can early out of this on Vita as it can take up to 60 secs // 4J added
#else
static __int64 findSeed(LevelType *generator); // 4J added
static int64_t findSeed(LevelType *generator); // 4J added
#endif
~BiomeSource();
@@ -71,7 +71,7 @@ public:
/**
* Checks if an area around a block contains only the specified biomes.
* Useful for placing elements like towns.
*
*
* This is a bit of a rough check, to make it as fast as possible. To ensure
* NO other biomes, add a margin of at least four blocks to the radius
*/
@@ -80,7 +80,7 @@ public:
/**
* Checks if an area around a block contains only the specified biome.
* Useful for placing elements like towns.
*
*
* This is a bit of a rough check, to make it as fast as possible. To ensure
* NO other biomes, add a margin of at least four blocks to the radius
*/
@@ -89,7 +89,7 @@ public:
/**
* Finds the specified biome within the radius. This will return a random
* position if several are found. This test is fairly rough.
*
*
* Returns null if the biome wasn't found
*/
virtual TilePos *findBiome(int x, int z, int r, Biome *toFind, Random *random);
@@ -97,7 +97,7 @@ public:
/**
* Finds one of the specified biomes within the radius. This will return a
* random position if several are found. This test is fairly rough.
*
*
* Returns null if the biome wasn't found
*/
virtual TilePos *findBiome(int x, int z, int r, vector<Biome *> allowed, Random *random);

View File

@@ -51,7 +51,7 @@ int ByteArrayInputStream::read()
//
//The read(b) method for class InputStream has the same effect as:
//
// read(b, 0, b.length)
// read(b, 0, b.length)
//Parameters:
//b - the buffer into which the data is read.
//Returns:
@@ -100,7 +100,7 @@ void ByteArrayInputStream::close()
//n - the number of bytes to be skipped.
//Returns:
//the actual number of bytes skipped.
__int64 ByteArrayInputStream::skip(__int64 n)
int64_t ByteArrayInputStream::skip(int64_t n)
{
int newPos = pos + n;

View File

@@ -19,7 +19,7 @@ public:
virtual int read(byteArray b);
virtual int read(byteArray b, unsigned int offset, unsigned int length);
virtual void close();
virtual __int64 skip(__int64 n);
virtual int64_t skip(int64_t n);
// 4J Stu Added - Sometimes we don't want to delete the data on destroying this
void reset() { buf = byteArray(); count = 0; mark = 0; pos = 0; }

View File

@@ -176,20 +176,20 @@ int ByteBuffer::getInt(unsigned int index)
//
//Returns:
//The long value at the buffer's current position
__int64 ByteBuffer::getLong()
int64_t ByteBuffer::getLong()
{
assert( m_position+8 < m_limit );
__int64 value = 0;
int64_t value = 0;
__int64 b1 = buffer[ m_position ];
__int64 b2 = buffer[ m_position+1 ];
__int64 b3 = buffer[ m_position+2 ];
__int64 b4 = buffer[ m_position+3 ];
__int64 b5 = buffer[ m_position+4 ];
__int64 b6 = buffer[ m_position+5 ];
__int64 b7 = buffer[ m_position+6 ];
__int64 b8 = buffer[ m_position+7 ];
int64_t b1 = buffer[ m_position ];
int64_t b2 = buffer[ m_position+1 ];
int64_t b3 = buffer[ m_position+2 ];
int64_t b4 = buffer[ m_position+3 ];
int64_t b5 = buffer[ m_position+4 ];
int64_t b6 = buffer[ m_position+5 ];
int64_t b7 = buffer[ m_position+6 ];
int64_t b8 = buffer[ m_position+7 ];
m_position += 8;
@@ -358,7 +358,7 @@ ByteBuffer *ByteBuffer::putShortArray(shortArray &s)
// TODO 4J Stu - Should this function be writing from the start of the buffer, or from position?
// And should it update position?
assert( s.length*2 <= m_limit);
// 4J Stu - Assumes big endian
memcpy( buffer, s.data, s.length*2 );
@@ -373,7 +373,7 @@ ByteBuffer *ByteBuffer::putShortArray(shortArray &s)
//value - The long value to be written
//Returns:
//This buffer
ByteBuffer *ByteBuffer::putLong(__int64 value)
ByteBuffer *ByteBuffer::putLong(int64_t value)
{
assert( m_position+7 < m_limit );
@@ -407,7 +407,7 @@ ByteBuffer *ByteBuffer::putLong(__int64 value)
//This method transfers the entire content of the given source byte array into this buffer.
//An invocation of this method of the form dst.put(a) behaves in exactly the same way as the invocation
//
// dst.put(a, 0, a.length)
// dst.put(a, 0, a.length)
//Returns:
//This buffer
ByteBuffer *ByteBuffer::put(byteArray inputArray)
@@ -436,7 +436,7 @@ byteArray ByteBuffer::array()
//it will be read-only if, and only if, this buffer is read-only.
//
//Returns:
//A new int buffer
//A new int buffer
IntBuffer *ByteBuffer::asIntBuffer()
{
// TODO 4J Stu - Is it safe to just cast our byte array pointer to another type?
@@ -463,7 +463,7 @@ FloatBuffer *ByteBuffer::asFloatBuffer()
#ifdef __PS3__
// we're using the RSX now to upload textures to vram, so we need th main ram textures allocated from io space
ByteBuffer_IO::ByteBuffer_IO( unsigned int capacity )
ByteBuffer_IO::ByteBuffer_IO( unsigned int capacity )
: ByteBuffer(capacity, (byte*)RenderManager.allocIOMem(capacity, 64))
{
memset( buffer,0,sizeof(byte)*capacity);

View File

@@ -28,7 +28,7 @@ public:
int getInt(unsigned int index);
void get(byteArray) {} // 4J - TODO
byte get(int index);
__int64 getLong();
int64_t getLong();
short getShort();
void getShortArray(shortArray &s);
ByteBuffer *put(int index, byte b);
@@ -36,7 +36,7 @@ public:
ByteBuffer *putInt(unsigned int index, int value);
ByteBuffer *putShort(short value);
ByteBuffer *putShortArray(shortArray &s);
ByteBuffer *putLong(__int64 value);
ByteBuffer *putLong(int64_t value);
ByteBuffer *put(byteArray inputArray);
byteArray array();
IntBuffer *asIntBuffer();

View File

@@ -66,7 +66,7 @@ public:
e_modeAutoClear,
e_modeManualClear
};
Event(EMode mode = e_modeAutoClear);
Event(EMode mode = e_modeAutoClear);
~Event();
void Set();
void Clear();
@@ -75,7 +75,7 @@ public:
private:
EMode m_mode;
#ifdef __PS3__
sys_event_flag_t m_event;
sys_event_flag_t m_event;
#elif defined __ORBIS__
SceKernelEventFlag m_event;
#elif defined __PSVITA__
@@ -111,7 +111,7 @@ public:
int m_size;
EMode m_mode;
#ifdef __PS3__
sys_event_flag_t m_events;
sys_event_flag_t m_events;
#elif defined __ORBIS__
SceKernelEventFlag m_events;
#elif defined __PSVITA__
@@ -129,7 +129,7 @@ public:
typedef void (ThreadInitFunc)();
C4JThread* m_thread;
std::queue<void*> m_queue;
std::queue<void*> m_queue;
C4JThread::EventArray* m_startEvent;
C4JThread::Event* m_finishedEvent;
CRITICAL_SECTION m_critSect;
@@ -187,7 +187,7 @@ private:
bool m_isRunning;
bool m_hasStarted;
int m_exitCode;
__int64 m_lastSleepTime;
int64_t m_lastSleepTime;
static std::vector<C4JThread*> ms_threadList;
static CRITICAL_SECTION ms_threadListCS;

View File

@@ -4,7 +4,7 @@
#include "net.minecraft.world.level.tile.h"
#include "net.minecraft.world.level.biome.h"
void CanyonFeature::addTunnel(__int64 seed, int xOffs, int zOffs, byteArray blocks, double xCave, double yCave, double zCave, float thickness, float yRot, float xRot, int step, int dist, double yScale)
void CanyonFeature::addTunnel(int64_t seed, int xOffs, int zOffs, byteArray blocks, double xCave, double yCave, double zCave, float thickness, float yRot, float xRot, int step, int dist, double yScale)
{
MemSect(49);
Random *random = new Random(seed);

View File

@@ -9,6 +9,6 @@ private:
float rs[1024];
protected:
void addTunnel(__int64 seed, int xOffs, int zOffs, byteArray blocks, double xCave, double yCave, double zCave, float thickness, float yRot, float xRot, int step, int dist, double yScale);
void addTunnel(int64_t seed, int xOffs, int zOffs, byteArray blocks, double xCave, double yCave, double zCave, float thickness, float yRot, float xRot, int step, int dist, double yScale);
virtual void addFeature(Level *level, int x, int z, int xOffs, int zOffs, byteArray blocks);
};

View File

@@ -20,7 +20,7 @@ using namespace std;
double radius = random->nextDouble() * 4 + 2;
double fuss = random->nextDouble() * 0.6;
__int64 seed = random->nextLong();
int64_t seed = random->nextLong();
random->setSeed(seed);
vector<TilePos *> toRemove;
@@ -69,14 +69,14 @@ using namespace std;
}
}
}
AUTO_VAR(itEnd, toRemove.end());
for (AUTO_VAR(it, toRemove.begin()); it != itEnd; it++)
{
TilePos *p = *it; //toRemove[i];
level->setTileNoUpdate(p->x, p->y, p->z, 0);
}
itEnd = toRemove.end();
for (AUTO_VAR(it, toRemove.begin()); it != itEnd; it++)
{

View File

@@ -6,16 +6,16 @@ ChunkPos::ChunkPos(int x, int z) : x( x ), z( z )
{
}
__int64 ChunkPos::hashCode(int x, int z)
int64_t ChunkPos::hashCode(int x, int z)
{
__int64 xx = x;
__int64 zz = z;
int64_t xx = x;
int64_t zz = z;
return (xx & 0xffffffffl) | ((zz & 0xffffffffl) << 32l);
}
int ChunkPos::hashCode()
{
__int64 hash = hashCode(x, z);
int64_t hash = hashCode(x, z);
int h1 = (int) (hash);
int h2 = (int) (hash >> 32l);
return h1 ^ h2;
@@ -53,7 +53,7 @@ int ChunkPos::getMiddleBlockZ()
return ( z << 4 ) + 8;
}
TilePos ChunkPos::getMiddleBlockPosition(int y)
TilePos ChunkPos::getMiddleBlockPosition(int y)
{
return TilePos(getMiddleBlockX(), y, getMiddleBlockZ());
}
@@ -63,7 +63,7 @@ wstring ChunkPos::toString()
return L"[" + _toString<int>(x) + L", " + _toString<int>(z) + L"]";
}
__int64 ChunkPos::hash_fnct(const ChunkPos &k)
int64_t ChunkPos::hash_fnct(const ChunkPos &k)
{
return k.hashCode(k.x,k.z);
}

View File

@@ -10,7 +10,7 @@ public:
ChunkPos(int x, int z);
static __int64 hashCode(int x, int z);
static int64_t hashCode(int x, int z);
int hashCode();
double distanceToSqr(shared_ptr<Entity> e);
@@ -22,7 +22,7 @@ public:
TilePos getMiddleBlockPosition(int y);
wstring toString();
static __int64 hash_fnct(const ChunkPos &k);
static int64_t hash_fnct(const ChunkPos &k);
static bool eq_test(const ChunkPos &x, const ChunkPos &y);
bool operator == (const ChunkPos &k) const { return (this->x == k.x) && ( this->z == k.z); }
ChunkPos & operator= (const ChunkPos & other) { x = other.x; z = other.z; return *this; }
@@ -30,12 +30,12 @@ public:
struct ChunkPosKeyHash
{
inline __int64 operator()(const ChunkPos &k) const
inline int64_t operator()(const ChunkPos &k) const
{ return ChunkPos::hash_fnct(k); }
};
struct ChunkPosKeyEq
{
inline bool operator()(const ChunkPos &x, const ChunkPos &y) const
inline bool operator()(const ChunkPos &x, const ChunkPos &y) const
{ return ChunkPos::eq_test(x, y); }
};

View File

@@ -10,7 +10,7 @@ ChunkStorageProfilerDecorator::ChunkStorageProfilerDecorator(ChunkStorage *capsu
LevelChunk *ChunkStorageProfilerDecorator::load(Level *level, int x, int z)
{
__int64 nanoTime = System::nanoTime();
int64_t nanoTime = System::nanoTime();
LevelChunk *chunk = capsulated->load(level, x, z);
timeSpentLoading += System::nanoTime() - nanoTime;
loadCount++;
@@ -20,7 +20,7 @@ LevelChunk *ChunkStorageProfilerDecorator::load(Level *level, int x, int z)
void ChunkStorageProfilerDecorator::save(Level *level, LevelChunk *levelChunk)
{
__int64 nanoTime = System::nanoTime();
int64_t nanoTime = System::nanoTime();
capsulated->save(level, levelChunk);
timeSpentSaving += System::nanoTime() - nanoTime;
saveCount++;
@@ -59,7 +59,7 @@ void ChunkStorageProfilerDecorator::tick()
sprintf(buf,"Average save time: %f (%I64d)",0.000001 * (double) timeSpentSaving / (double) loadCount, loadCount);
#endif
app.DebugPrintf(buf);
#endif
#endif
}
counter = 0;
}

View File

@@ -8,10 +8,10 @@ class ChunkStorageProfilerDecorator : public ChunkStorage
private:
ChunkStorage *capsulated;
__int64 timeSpentLoading;
__int64 loadCount;
__int64 timeSpentSaving;
__int64 saveCount;
int64_t timeSpentLoading;
int64_t loadCount;
int64_t timeSpentSaving;
int64_t saveCount;
int counter;

View File

@@ -11,7 +11,7 @@
#include "ByteArrayTag.h"
#include "IntArrayTag.h"
class CompoundTag : public Tag
class CompoundTag : public Tag
{
private:
unordered_map<wstring, Tag *> tags;
@@ -46,7 +46,7 @@ public:
{
// 4J - was return tags.values();
vector<Tag *> *ret = new vector<Tag *>;
AUTO_VAR(itEnd, tags.end());
for( unordered_map<wstring, Tag *>::iterator it = tags.begin(); it != itEnd; it++ )
{
@@ -80,7 +80,7 @@ public:
tags[name] = (new IntTag(name,value));
}
void putLong(wchar_t * name, __int64 value)
void putLong(wchar_t * name, int64_t value)
{
tags[name] = (new LongTag(name,value));
}
@@ -126,7 +126,7 @@ public:
if(it != tags.end()) return it->second;
return NULL;
}
bool contains(wchar_t * name)
{
return tags.find(name) != tags.end();
@@ -150,9 +150,9 @@ public:
return ((IntTag *) tags[name])->data;
}
__int64 getLong(wchar_t * name)
int64_t getLong(wchar_t * name)
{
if (tags.find(name) == tags.end()) return (__int64)0;
if (tags.find(name) == tags.end()) return (int64_t)0;
return ((LongTag *) tags[name])->data;
}
@@ -227,7 +227,7 @@ public:
char *newPrefix = new char[ strlen(prefix) + 4 ];
strcpy( newPrefix, prefix);
strcat( newPrefix, " ");
AUTO_VAR(itEnd, tags.end());
for( unordered_map<string, Tag *>::iterator it = tags.begin(); it != itEnd; it++ )
{
@@ -255,10 +255,10 @@ public:
Tag *copy()
{
CompoundTag *tag = new CompoundTag(getName());
AUTO_VAR(itEnd, tags.end());
for( AUTO_VAR(it, tags.begin()); it != itEnd; it++ )
{
{
tag->put((wchar_t *)it->first.c_str(), it->second->copy());
}
return tag;

View File

@@ -142,7 +142,7 @@ CompressedTileStorage::CompressedTileStorage(bool isEmpty)
#endif
}
bool CompressedTileStorage::isRenderChunkEmpty(int y) // y == 0, 16, 32... 112 (representing a 16 byte range)
bool CompressedTileStorage::isRenderChunkEmpty(int y) // y == 0, 16, 32... 112 (representing a 16 byte range)
{
int block;
unsigned short *blockIndices = (unsigned short *)indicesAndData;
@@ -151,7 +151,7 @@ bool CompressedTileStorage::isRenderChunkEmpty(int y) // y == 0, 16, 32... 112 (
for( int z = 0; z < 16; z += 4 )
{
getBlock(&block, x, y, z);
__uint64 *comp = (__uint64 *)&blockIndices[block];
uint64_t *comp = (uint64_t *)&blockIndices[block];
// Are the 4 y regions stored here all zero? (INDEX_TYPE_0_OR_8_BIT | INDEX_TYPE_0_BIT_FLAG )
if( ( *comp ) != 0x0007000700070007L ) return false;
}
@@ -169,18 +169,18 @@ bool CompressedTileStorage::isSameAs(CompressedTileStorage *other)
// Attempt to compare as much as we can in 64-byte chunks (8 groups of 8 bytes)
int quickCount = allocatedSize / 64;
__int64 *pOld = (__int64 *)indicesAndData;
__int64 *pNew = (__int64 *)other->indicesAndData;
int64_t *pOld = (int64_t *)indicesAndData;
int64_t *pNew = (int64_t *)other->indicesAndData;
for( int i = 0; i < quickCount; i++ )
{
__int64 d0 = pOld[0] ^ pNew[0];
__int64 d1 = pOld[1] ^ pNew[1];
__int64 d2 = pOld[2] ^ pNew[2];
__int64 d3 = pOld[3] ^ pNew[3];
__int64 d4 = pOld[4] ^ pNew[4];
__int64 d5 = pOld[5] ^ pNew[5];
__int64 d6 = pOld[6] ^ pNew[6];
__int64 d7 = pOld[7] ^ pNew[7];
int64_t d0 = pOld[0] ^ pNew[0];
int64_t d1 = pOld[1] ^ pNew[1];
int64_t d2 = pOld[2] ^ pNew[2];
int64_t d3 = pOld[3] ^ pNew[3];
int64_t d4 = pOld[4] ^ pNew[4];
int64_t d5 = pOld[5] ^ pNew[5];
int64_t d6 = pOld[6] ^ pNew[6];
int64_t d7 = pOld[7] ^ pNew[7];
d0 |= d1;
d2 |= d3;
d4 |= d5;
@@ -194,7 +194,7 @@ bool CompressedTileStorage::isSameAs(CompressedTileStorage *other)
}
pOld += 8;
pNew += 8;
}
}
// Now test anything remaining just byte at a time
unsigned char *pucOld = (unsigned char *)pOld;
@@ -261,7 +261,7 @@ inline int CompressedTileStorage::getIndex(int block, int tile)
// and z is: ___________zzzz
// and maps to this bit of b ________bb_____
// and this bit of t ___________tt__
//
//
inline void CompressedTileStorage::getBlockAndTile(int *block, int *tile, int x, int y, int z)
{
@@ -302,7 +302,7 @@ void CompressedTileStorage::setData(byteArray dataIn, unsigned int inOffset)
int offsets[512];
int memToAlloc = 0;
// static int type0 = 0, type1 = 0, type2 = 0, type4 = 0, type8 = 0, chunkTotal = 0;
// Loop round all blocks
for( int i = 0; i < 512; i++ )
{
@@ -332,8 +332,8 @@ void CompressedTileStorage::setData(byteArray dataIn, unsigned int inOffset)
}
}
#else
__uint64 usedFlags[4] = {0,0,0,0};
__int64 i64_1 = 1; // MGH - instead of 1i64, which is MS specific
uint64_t usedFlags[4] = {0,0,0,0};
int64_t i64_1 = 1; // MGH - instead of 1i64, which is MS specific
for( int j = 0; j < 64; j++ ) // This loop of 64 is to go round the 4 x 4 tiles in the block
{
int tile = data[getIndex(i,j)];
@@ -889,7 +889,7 @@ void CompressedTileStorage::compress(int upgradeBlock/*=-1*/)
unsigned char *unpacked_data = NULL;
unsigned char *packed_data;
// First task is to find out what type of storage each block needs. Need to unpack each where required.
// First task is to find out what type of storage each block needs. Need to unpack each where required.
// Note that we don't need to fully unpack the data at this stage since we are only interested in working out how many unique types of tiles are in each block, not
// what those actual tile ids are.
if( upgradeBlock == -1 )
@@ -950,8 +950,8 @@ void CompressedTileStorage::compress(int upgradeBlock/*=-1*/)
}
#else
__uint64 usedFlags[4] = {0,0,0,0};
__int64 i64_1 = 1; // MGH - instead of 1i64, which is MS specific
uint64_t usedFlags[4] = {0,0,0,0};
int64_t i64_1 = 1; // MGH - instead of 1i64, which is MS specific
for( int j = 0; j < 64; j++ ) // This loop of 64 is to go round the 4x4x4 tiles in the block
{
int tiletype = unpacked_data[j];
@@ -1025,7 +1025,7 @@ void CompressedTileStorage::compress(int upgradeBlock/*=-1*/)
}
}
switch(_blockIndices[i])
{
{
case INDEX_TYPE_1_BIT:
memToAlloc += 10;
break;
@@ -1096,7 +1096,7 @@ void CompressedTileStorage::compress(int upgradeBlock/*=-1*/)
else
{
packed_data = data + ( ( blockIndices[i] >> INDEX_OFFSET_SHIFT ) & INDEX_OFFSET_MASK);
int dataSize = 8 << indexTypeOld; // 8, 16 or 32 bytes of per-tile storage
dataSize += 1 << ( 1 << indexTypeOld ); // 2, 4 or 16 bytes to store each tile type
newIndices[i] |= ( usDataOffset & INDEX_OFFSET_MASK) << INDEX_OFFSET_SHIFT;
@@ -1289,7 +1289,7 @@ int CompressedTileStorage::getHighestNonEmptyY()
if(found) break;
}
int highestNonEmptyY = -1;
if(found)
{

View File

@@ -17,7 +17,7 @@ public:
virtual int read(byteArray b);
virtual int read(byteArray b, unsigned int offset, unsigned int length);
virtual void close();
virtual __int64 skip(__int64 n) { return n; }
virtual int64_t skip(int64_t n) { return n; }
private:
ConsoleSaveFile *m_saveFile;

View File

@@ -35,7 +35,7 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal(const wstring &fileName, LPVOID
// We'll only be committing these as required to grow the storage we need, which will
// the storage to grow without having to use realloc.
// AP - The Vita doesn't have virtual memory so a pretend system has been implemented in PSVitaStubs.cpp.
// AP - The Vita doesn't have virtual memory so a pretend system has been implemented in PSVitaStubs.cpp.
// All access to the memory must be done via the access function as the pointer returned from VirtualAlloc
// can't be used directly.
pvHeap = VirtualAlloc(NULL, MAX_PAGE_COUNT * CSF_PAGE_SIZE, RESERVE_ALLOCATION, PAGE_READWRITE );
@@ -116,7 +116,7 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal(const wstring &fileName, LPVOID
#endif
app.DebugPrintf("Filesize - %d, Adjusted size - %d\n",fileSize,storageLength);
fileSize = storageLength;
}
}
#ifdef __PSVITA__
if(plat == SAVE_FILE_PLATFORM_PSVITA)
@@ -202,7 +202,7 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal(const wstring &fileName, LPVOID
}
else
{
{
// Clear the first 8 bytes that reference the header
header.WriteHeader( pvSaveMem );
}
@@ -213,7 +213,7 @@ ConsoleSaveFileOriginal::~ConsoleSaveFileOriginal()
VirtualFree( pvHeap, MAX_PAGE_COUNT * CSF_PAGE_SIZE, MEM_DECOMMIT );
pagesCommitted = 0;
// Make sure we don't have any thumbnail data still waiting round - we can't need it now we've destroyed the save file anyway
#if defined _XBOX
#if defined _XBOX
app.GetSaveThumbnail(NULL,NULL);
#elif defined __PS3__
app.GetSaveThumbnail(NULL,NULL, NULL,NULL);
@@ -548,7 +548,7 @@ void ConsoleSaveFileOriginal::MoveDataBeyond(FileEntry *file, DWORD nNumberOfByt
if ( uiCopyEnd > uiFromEnd )
{
// Needs to be clamped to the end of our region
uiCopyEnd = uiFromEnd;
uiCopyEnd = uiFromEnd;
}
#ifdef __PSVITA__
// AP - use this to access the virtual memory
@@ -749,7 +749,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail )
BYTE bTextMetadata[88];
ZeroMemory(bTextMetadata,88);
__int64 seed = 0;
int64_t seed = 0;
bool hasSeed = false;
if(MinecraftServer::getInstance()!= NULL && MinecraftServer::getInstance()->levels[0]!=NULL)
{
@@ -765,7 +765,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail )
#ifdef _XBOX
StorageManager.SaveSaveData( compLength+8,pbThumbnailData,dwThumbnailDataSize,bTextMetadata,iTextMetadataBytes );
delete [] pbThumbnailData;
delete [] pbThumbnailData;
#ifndef _CONTENT_PACKAGE
if( app.DebugSettingsOn())
{

View File

@@ -41,7 +41,7 @@ ConsoleSaveFileSplit::RegionFileReference::~RegionFileReference()
// Compress from data to dataCompressed. Uses a special compression method that is designed just to efficiently store runs of zeros, with little overhead on other stuff.
// Compresed format is a 4 byte uncompressed size, followed by data as follows:
//
//
// Byte value Meaning
//
// 1 - 255 Normal data
@@ -375,7 +375,7 @@ FileEntry *ConsoleSaveFileSplit::GetRegionFileEntry(unsigned int regionIndex)
int index = StorageManager.AddSubfile(regionIndex);
RegionFileReference *newRef = new RegionFileReference(index, regionIndex);
regionFiles[regionIndex] = newRef;
return newRef->fileEntry;
}
@@ -513,7 +513,7 @@ void ConsoleSaveFileSplit::_init(const wstring &fileName, LPVOID pvSaveData, DWO
StorageManager.GetSaveData( pvSaveMem, &storageLength );
app.DebugPrintf("Filesize - %d, Adjusted size - %d\n",fileSize,storageLength);
fileSize = storageLength;
}
}
int compressed = *(int*)pvSaveMem;
if( compressed == 0 )
@@ -532,7 +532,7 @@ void ConsoleSaveFileSplit::_init(const wstring &fileName, LPVOID pvSaveData, DWO
else
{
unsigned char *buf = new unsigned char[decompSize];
if( Compression::getCompression()->Decompress(buf, &decompSize, (unsigned char *)pvSaveMem+8, fileSize-8 ) == S_OK)
{
@@ -575,7 +575,7 @@ void ConsoleSaveFileSplit::_init(const wstring &fileName, LPVOID pvSaveData, DWO
}
else
{
{
// Clear the first 8 bytes that reference the header
header.WriteHeader( pvSaveMem );
}
@@ -586,7 +586,7 @@ ConsoleSaveFileSplit::~ConsoleSaveFileSplit()
VirtualFree( pvHeap, MAX_PAGE_COUNT * CSF_PAGE_SIZE, MEM_DECOMMIT );
pagesCommitted = 0;
// Make sure we don't have any thumbnail data still waiting round - we can't need it now we've destroyed the save file anyway
#if defined _XBOX
#if defined _XBOX
app.GetSaveThumbnail(NULL,NULL);
#elif defined __PS3__
app.GetSaveThumbnail(NULL,NULL, NULL,NULL);
@@ -606,7 +606,7 @@ ConsoleSaveFileSplit::~ConsoleSaveFileSplit()
FileEntry *ConsoleSaveFileSplit::createFile( const ConsoleSavePath &fileName )
{
LockSaveAccess();
// Determine if the file is a region file that should be split off into its own file
unsigned int regionFileIndex;
bool isRegionFile = GetNumericIdentifierFromName(fileName.getName(), &regionFileIndex);
@@ -942,7 +942,7 @@ void ConsoleSaveFileSplit::tick()
}
}
// Compile a vector of dirty regions.
// Compile a vector of dirty regions.
vector<DirtyRegionFile> dirtyRegions;
for( AUTO_VAR(it, regionFiles.begin()); it != regionFiles.end(); it++ )
{
@@ -999,7 +999,7 @@ void ConsoleSaveFileSplit::tick()
{
unsigned int totalDirty = 0;
unsigned int totalDirtyBytes = 0;
__int64 oldestDirty = currentTime;
int64_t oldestDirty = currentTime;
for( AUTO_VAR(it, regionFiles.begin()); it != regionFiles.end(); it++ )
{
if( it->second->dirty )
@@ -1051,7 +1051,7 @@ void ConsoleSaveFileSplit::MoveDataBeyond(FileEntry *file, DWORD nNumberOfBytesT
// Only ReAlloc if we need to (we might already have enough) and align to 512 byte boundaries
DWORD currentHeapSize = pagesCommitted * CSF_PAGE_SIZE;
DWORD desiredSize = header.GetFileSize() + nNumberOfBytesToWrite;
if( desiredSize > currentHeapSize )
@@ -1117,7 +1117,7 @@ void ConsoleSaveFileSplit::MoveDataBeyond(FileEntry *file, DWORD nNumberOfBytesT
if ( uiCopyEnd > uiFromEnd )
{
// Needs to be clamped to the end of our region
uiCopyEnd = uiFromEnd;
uiCopyEnd = uiFromEnd;
}
XMemCpy( (void *)(uiCopyStart + nNumberOfBytesToWrite), ( void *)uiCopyStart, uiCopyEnd - uiCopyStart );
}
@@ -1381,7 +1381,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail)
// Attempt to allocate the required memory
compData = (byte *)StorageManager.AllocateSaveData( compLength );
}
if(compData != NULL)
{
// Re-compress all save data before we save it to disk
@@ -1421,7 +1421,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail)
BYTE bTextMetadata[88];
ZeroMemory(bTextMetadata,88);
__int64 seed = 0;
int64_t seed = 0;
bool hasSeed = false;
if(MinecraftServer::getInstance()!= NULL && MinecraftServer::getInstance()->levels[0]!=NULL)
{
@@ -1436,7 +1436,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail)
app.DebugPrintf("Save thumbnail size %d\n",dwThumbnailDataSize);
}
INT saveOrCheckpointId = 0;
bool validSave = StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId);
TelemetryManager->RecordLevelSaveOrCheckpoint(ProfileManager.GetPrimaryPad(), saveOrCheckpointId, compLength+8);
@@ -1459,7 +1459,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail)
int ConsoleSaveFileSplit::SaveSaveDataCallback(LPVOID lpParam,bool bRes)
{
ConsoleSaveFileSplit *pClass=(ConsoleSaveFileSplit *)lpParam;
// Don't save sub files on autosave (their always being saved anyway)
if (!pClass->m_autosave)
{
@@ -1472,7 +1472,7 @@ int ConsoleSaveFileSplit::SaveSaveDataCallback(LPVOID lpParam,bool bRes)
int ConsoleSaveFileSplit::SaveRegionFilesCallback(LPVOID lpParam,bool bRes)
{
ConsoleSaveFileSplit *pClass=(ConsoleSaveFileSplit *)lpParam;
// This is called from the StorageManager.Tick() which should always be on the main thread
pClass->processSubfilesAfterWrite();

View File

@@ -12,7 +12,7 @@
const double CustomLevelSource::SNOW_SCALE = 0.3;
const double CustomLevelSource::SNOW_CUTOFF = 0.5;
CustomLevelSource::CustomLevelSource(Level *level, __int64 seed, bool generateStructures) : generateStructures( generateStructures )
CustomLevelSource::CustomLevelSource(Level *level, int64_t seed, bool generateStructures) : generateStructures( generateStructures )
{
#ifdef _OVERRIDE_HEIGHTMAP
m_XZSize = level->getLevelData()->getXZSize();
@@ -326,7 +326,7 @@ void CustomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi
run = runDepth;
if (y >= waterHeight - 1) blocks[offs] = top;
else blocks[offs] = material;
}
}
else if (run > 0)
{
run--;
@@ -399,7 +399,7 @@ LevelChunk *CustomLevelSource::getChunk(int xOffs, int zOffs)
// addCaves(xOffs, zOffs, blocks);
// addTowns(xOffs, zOffs, blocks);
// levelChunk->recalcHeightmap(); // 4J - removed & moved into its own method
// levelChunk->recalcHeightmap(); // 4J - removed & moved into its own method
// 4J - this now creates compressed block data from the blocks array passed in, so moved it until after the blocks are actually finalised. We also
// now need to free the passed in blocks as the LevelChunk doesn't use the passed in allocation anymore.
@@ -504,8 +504,8 @@ void CustomLevelSource::postProcess(ChunkSource *parent, int xt, int zt)
}
pprandom->setSeed(level->getSeed());
__int64 xScale = pprandom->nextLong() / 2 * 2 + 1;
__int64 zScale = pprandom->nextLong() / 2 * 2 + 1;
int64_t xScale = pprandom->nextLong() / 2 * 2 + 1;
int64_t zScale = pprandom->nextLong() / 2 * 2 + 1;
pprandom->setSeed(((xt * xScale) + (zt * zScale)) ^ level->getSeed());
bool hasVillage = false;

View File

@@ -44,7 +44,7 @@ private:
const bool generateStructures;
public:
CustomLevelSource(Level *level, __int64 seed, bool generateStructures);
CustomLevelSource(Level *level, int64_t seed, bool generateStructures);
~CustomLevelSource();
public:
@@ -75,5 +75,5 @@ public:
public:
virtual vector<Biome::MobSpawnerData *> *getMobsAt(MobCategory *mobCategory, int x, int y, int z);
virtual TilePos *findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z);
virtual TilePos *findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z);
};

View File

@@ -13,7 +13,7 @@ public:
virtual double readDouble() = 0;
virtual float readFloat() = 0;
virtual int readInt() = 0;
virtual __int64 readLong() = 0;
virtual int64_t readLong() = 0;
virtual short readShort() = 0;
virtual wchar_t readChar() = 0;
virtual wstring readUTF() = 0;

View File

@@ -32,8 +32,8 @@ int DataInputStream::read()
//
//The read(b) method has the same effect as:
//
// read(b, 0, b.length)
//
// read(b, 0, b.length)
//
//Overrides:
//read in class FilterInputStream
//Parameters:
@@ -102,7 +102,7 @@ unsigned char DataInputStream::readUnsignedByte()
//Reads two input bytes and returns a char value. Let a be the first byte read and b be the second byte. The value returned is:
//(char)((a << 8) | (b & 0xff))
//
//
//This method is suitable for reading bytes written by the writeChar method of interface DataOutput.
//Returns:
//the char value read.
@@ -110,7 +110,7 @@ wchar_t DataInputStream::readChar()
{
int a = stream->read();
int b = stream->read();
return (wchar_t)((a << 8) | (b & 0xff));
return (wchar_t)((a << 8) | (b & 0xff));
}
//Reads some bytes from an input stream and stores them into the buffer array b. The number of bytes read is equal to the length of b.
@@ -170,7 +170,7 @@ bool DataInputStream::readFully(charArray b)
//the double value read.
double DataInputStream::readDouble()
{
__int64 bits = readLong();
int64_t bits = readLong();
return Double::longBitsToDouble( bits );
}
@@ -188,10 +188,10 @@ float DataInputStream::readFloat()
}
//Reads four input bytes and returns an int value. Let a-d be the first through fourth bytes read. The value returned is:
//
//
// (((a & 0xff) << 24) | ((b & 0xff) << 16) |
// ((c & 0xff) << 8) | (d & 0xff))
//
//
//This method is suitable for reading bytes written by the writeInt method of interface DataOutput.
//Returns:
//the int value read.
@@ -207,7 +207,7 @@ int DataInputStream::readInt()
}
//Reads eight input bytes and returns a long value. Let a-h be the first through eighth bytes read. The value returned is:
//
//
// (((long)(a & 0xff) << 56) |
// ((long)(b & 0xff) << 48) |
// ((long)(c & 0xff) << 40) |
@@ -216,23 +216,23 @@ int DataInputStream::readInt()
// ((long)(f & 0xff) << 16) |
// ((long)(g & 0xff) << 8) |
// ((long)(h & 0xff)))
//
//
//This method is suitable for reading bytes written by the writeLong method of interface DataOutput.
//
//Returns:
//the long value read.
__int64 DataInputStream::readLong()
int64_t DataInputStream::readLong()
{
__int64 a = stream->read();
__int64 b = stream->read();
__int64 c = stream->read();
__int64 d = stream->read();
__int64 e = stream->read();
__int64 f = stream->read();
__int64 g = stream->read();
__int64 h = stream->read();
int64_t a = stream->read();
int64_t b = stream->read();
int64_t c = stream->read();
int64_t d = stream->read();
int64_t e = stream->read();
int64_t f = stream->read();
int64_t g = stream->read();
int64_t h = stream->read();
__int64 bits = (((a & 0xff) << 56) |
int64_t bits = (((a & 0xff) << 56) |
((b & 0xff) << 48) |
((c & 0xff) << 40) |
((d & 0xff) << 32) |
@@ -246,7 +246,7 @@ __int64 DataInputStream::readLong()
//Reads two input bytes and returns a short value. Let a be the first byte read and b be the second byte. The value returned is:
//(short)((a << 8) | (b & 0xff))
//
//
//This method is suitable for reading the bytes written by the writeShort method of interface DataOutput.
//Returns:
//the 16-bit value read.
@@ -272,13 +272,13 @@ short DataInputStream::readShort()
//then a UTFDataFormatException is thrown. Otherwise, the group is converted to the character:
//
//(char)(((a& 0x1F) << 6) | (b & 0x3F))
//
//
//If the first byte of a group matches the bit pattern 1110xxxx, then the group consists of that byte a and two more bytes b and c.
//If there is no byte c (because byte a was one of the last two of the bytes to be read), or either byte b or byte c does not match the bit
//pattern 10xxxxxx, then a UTFDataFormatException is thrown. Otherwise, the group is converted to the character:
//
// (char)(((a & 0x0F) << 12) | ((b & 0x3F) << 6) | (c & 0x3F))
//
//
//If the first byte of a group matches the pattern 1111xxxx or the pattern 10xxxxxx, then a UTFDataFormatException is thrown.
//If end of file is encountered at any time during this entire process, then an EOFException is thrown.
//
@@ -305,7 +305,7 @@ wstring DataInputStream::readUTF()
outputString.push_back(theChar);
}*/
unsigned short currentByteIndex = 0;
while( currentByteIndex < UTFLength )
{
@@ -390,7 +390,7 @@ wstring DataInputStream::readUTF()
{
// TODO 4J Stu - EOFException
break;
}
}
// No more bytes to read
if( !(currentByteIndex < UTFLength) )
@@ -420,7 +420,7 @@ wstring DataInputStream::readUTF()
continue;
}
}
return outputString;
}
@@ -486,7 +486,7 @@ int DataInputStream::readUTFChar()
{
// TODO 4J Stu - EOFException
return returnValue;
}
}
int thirdByte = stream->read();
@@ -535,7 +535,7 @@ void DataInputStream::deleteChildStream()
//n - the number of bytes to be skipped.
//Returns:
//the actual number of bytes skipped.
__int64 DataInputStream::skip(__int64 n)
int64_t DataInputStream::skip(int64_t n)
{
return stream->skip(n);
}

View File

@@ -24,12 +24,12 @@ public:
virtual double readDouble();
virtual float readFloat();
virtual int readInt();
virtual __int64 readLong();
virtual int64_t readLong();
virtual short readShort();
virtual wstring readUTF();
void deleteChildStream();
virtual int readUTFChar();
virtual PlayerUID readPlayerUID(); // 4J Added
virtual __int64 skip(__int64 n);
virtual int64_t skip(int64_t n);
virtual int skipBytes(int n);
};

View File

@@ -10,7 +10,7 @@ public:
virtual void writeDouble(double a) = 0;
virtual void writeFloat(float a) = 0;
virtual void writeInt(int a) = 0;
virtual void writeLong(__int64 a) = 0;
virtual void writeLong(int64_t a) = 0;
virtual void writeShort(short a) = 0;
virtual void writeBoolean(bool v) = 0;
virtual void writeChar(wchar_t v) = 0;

View File

@@ -78,7 +78,7 @@ void DataOutputStream::writeByte(byte a)
//v - a double value to be written.
void DataOutputStream::writeDouble(double a)
{
__int64 bits = Double::doubleToLongBits( a );
int64_t bits = Double::doubleToLongBits( a );
writeLong( bits );
// TODO 4J Stu - Error handling?
@@ -116,7 +116,7 @@ void DataOutputStream::writeInt(int a)
//In no exception is thrown, the counter written is incremented by 8.
//Parameters:
//v - a long to be written.
void DataOutputStream::writeLong(__int64 a)
void DataOutputStream::writeLong(int64_t a)
{
stream->write( (a >> 56) & 0xff );
stream->write( (a >> 48) & 0xff );
@@ -178,7 +178,7 @@ void DataOutputStream::writeBoolean(bool b)
{
stream->write( b ? (byte)1 : (byte)0 );
// TODO 4J Stu - Error handling?
written += 1;
written += 1;
}
//Writes a string to the underlying output stream using modified UTF-8 encoding in a machine-independent manner.
@@ -220,7 +220,7 @@ void DataOutputStream::writeUTF(const wstring& str)
byteArray bytearr(utflen+2);
bytearr[count++] = (byte) ((utflen >> 8) & 0xFF);
bytearr[count++] = (byte) ((utflen >> 0) & 0xFF);
bytearr[count++] = (byte) ((utflen >> 0) & 0xFF);
int i=0;
for (i=0; i<strlen; i++)

View File

@@ -26,11 +26,11 @@ public:
virtual void writeDouble(double a);
virtual void writeFloat(float a);
virtual void writeInt(int a);
virtual void writeLong(__int64 a);
virtual void writeLong(int64_t a);
virtual void writeShort(short a);
virtual void writeChar(wchar_t a);
virtual void writeChars(const wstring& a);
virtual void writeBoolean(bool b);
virtual void writeBoolean(bool b);
virtual void writeUTF(const wstring& a);
virtual void writePlayerUID(PlayerUID player);
virtual void flush();

View File

@@ -22,7 +22,7 @@ CompoundTag *DerivedLevelData::createTag(vector<shared_ptr<Player> > *players)
return wrapped->createTag(players);
}
__int64 DerivedLevelData::getSeed()
int64_t DerivedLevelData::getSeed()
{
return wrapped->getSeed();
}
@@ -43,12 +43,12 @@ int DerivedLevelData::getZSpawn()
return wrapped->getZSpawn();
}
__int64 DerivedLevelData::getTime()
int64_t DerivedLevelData::getTime()
{
return wrapped->getTime();
}
__int64 DerivedLevelData::getSizeOnDisk()
int64_t DerivedLevelData::getSizeOnDisk()
{
return wrapped->getSizeOnDisk();
}
@@ -68,7 +68,7 @@ int DerivedLevelData::getVersion()
return wrapped->getVersion();
}
__int64 DerivedLevelData::getLastPlayed()
int64_t DerivedLevelData::getLastPlayed()
{
return wrapped->getLastPlayed();
}
@@ -98,7 +98,7 @@ GameType *DerivedLevelData::getGameType()
return wrapped->getGameType();
}
void DerivedLevelData::setSeed(__int64 seed)
void DerivedLevelData::setSeed(int64_t seed)
{
}
@@ -114,11 +114,11 @@ void DerivedLevelData::setZSpawn(int zSpawn)
{
}
void DerivedLevelData::setTime(__int64 time)
void DerivedLevelData::setTime(int64_t time)
{
}
void DerivedLevelData::setSizeOnDisk(__int64 sizeOnDisk)
void DerivedLevelData::setSizeOnDisk(int64_t sizeOnDisk)
{
}

View File

@@ -16,27 +16,27 @@ protected:
public:
CompoundTag *createTag();
CompoundTag *createTag(vector<shared_ptr<Player> > *players);
__int64 getSeed();
int64_t getSeed();
int getXSpawn();
int getYSpawn();
int getZSpawn();
__int64 getTime();
__int64 getSizeOnDisk();
int64_t getTime();
int64_t getSizeOnDisk();
CompoundTag *getLoadedPlayerTag();
wstring getLevelName();
int getVersion();
__int64 getLastPlayed();
int64_t getLastPlayed();
bool isThundering();
int getThunderTime();
bool isRaining();
int getRainTime();
GameType *getGameType();
void setSeed(__int64 seed);
void setSeed(int64_t seed);
void setXSpawn(int xSpawn);
void setYSpawn(int ySpawn);
void setZSpawn(int zSpawn);
void setTime(__int64 time);
void setSizeOnDisk(__int64 sizeOnDisk);
void setTime(int64_t time);
void setSizeOnDisk(int64_t sizeOnDisk);
void setLoadedPlayerTag(CompoundTag *loadedPlayerTag);
void setDimension(int dimension);
void setSpawn(int xSpawn, int ySpawn, int zSpawn);

View File

@@ -41,11 +41,11 @@ void Dimension::init()
}
else
#endif
if (level->getLevelData()->getGenerator() == LevelType::lvl_flat)
if (level->getLevelData()->getGenerator() == LevelType::lvl_flat)
{
biomeSource = new FixedBiomeSource(Biome::plains, 0.5f, 0.5f);
}
else
else
{
biomeSource = new BiomeSource(level);
}
@@ -77,11 +77,11 @@ ChunkSource *Dimension::createRandomLevelSource() const
}
else
#endif
if (levelType == LevelType::lvl_flat)
if (levelType == LevelType::lvl_flat)
{
return new FlatLevelSource(level, level->getSeed(), level->getLevelData()->isGenerateMapFeatures());
}
else
}
else
{
return new RandomLevelSource(level, level->getSeed(), level->getLevelData()->isGenerateMapFeatures());
}
@@ -106,7 +106,7 @@ bool Dimension::isValidSpawn(int x, int z) const
return true;
}
float Dimension::getTimeOfDay(__int64 time, float a) const
float Dimension::getTimeOfDay(int64_t time, float a) const
{
int dayStep = (int) (time % Level::TICKS_PER_DAY);
float td = (dayStep + a) / Level::TICKS_PER_DAY - 0.25f;
@@ -118,7 +118,7 @@ float Dimension::getTimeOfDay(__int64 time, float a) const
return td;
}
int Dimension::getMoonPhase(__int64 time, float a) const
int Dimension::getMoonPhase(int64_t time, float a) const
{
return ((int) (time / Level::TICKS_PER_DAY)) % 8;
}
@@ -162,7 +162,7 @@ Vec3 *Dimension::getFogColor(float td, float a) const
float br = Mth::cos(td * PI * 2) * 2 + 0.5f;
if (br < 0.0f) br = 0.0f;
if (br > 1.0f) br = 1.0f;
unsigned int baseFogColour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Default_Fog_Colour );
float r = ((baseFogColour >> 16) & 0xff) / 255.0f;
float g = ((baseFogColour >> 8) & 0xff) / 255.0f;
@@ -203,16 +203,16 @@ Pos *Dimension::getSpawnPos()
return NULL;
}
int Dimension::getSpawnYPosition()
int Dimension::getSpawnYPosition()
{
if (levelType == LevelType::lvl_flat)
if (levelType == LevelType::lvl_flat)
{
return 4;
}
return Level::genDepth / 2;
}
bool Dimension::hasBedrockFog()
bool Dimension::hasBedrockFog()
{
// 4J-PB - turn off bedrock fog if the host player doesn't want it
if(app.GetGameHostOption(eGameHostOption_BedrockFog)==0)
@@ -223,9 +223,9 @@ bool Dimension::hasBedrockFog()
return (levelType != LevelType::lvl_flat && !hasCeiling);
}
double Dimension::getClearColorScale()
double Dimension::getClearColorScale()
{
if (levelType == LevelType::lvl_flat)
if (levelType == LevelType::lvl_flat)
{
return 1.0;
}

View File

@@ -35,8 +35,8 @@ public:
virtual bool isValidSpawn(int x, int z) const;
virtual float getTimeOfDay(__int64 time, float a) const;
virtual int getMoonPhase(__int64 time, float a) const;
virtual float getTimeOfDay(int64_t time, float a) const;
virtual int getMoonPhase(int64_t time, float a) const;
virtual bool isNaturalDimension();
private:
static const int fogColor = 0xc0d8ff;
@@ -53,7 +53,7 @@ public:
virtual Pos *getSpawnPos();
int getSpawnYPosition();
virtual bool hasBedrockFog();
virtual bool hasBedrockFog();
double getClearColorScale();
virtual bool isFoggyAt(int x, int z);

View File

@@ -108,19 +108,19 @@ void _MapDataMappings_old::setMapping(int id, PlayerUID xuid, int dimension)
#ifdef _LARGE_WORLDS
void DirectoryLevelStorage::PlayerMappings::addMapping(int id, int centreX, int centreZ, int dimension, int scale)
{
__int64 index = ( ((__int64)(centreZ & 0x1FFFFFFF)) << 34) | ( ((__int64)(centreX & 0x1FFFFFFF)) << 5) | ( (scale & 0x7) << 2) | (dimension & 0x3);
int64_t index = ( ((int64_t)(centreZ & 0x1FFFFFFF)) << 34) | ( ((int64_t)(centreX & 0x1FFFFFFF)) << 5) | ( (scale & 0x7) << 2) | (dimension & 0x3);
m_mappings[index] = id;
//app.DebugPrintf("Adding mapping: %d - (%d,%d)/%d/%d [%I64d - 0x%016llx]\n", id, centreX, centreZ, dimension, scale, index, index);
}
bool DirectoryLevelStorage::PlayerMappings::getMapping(int &id, int centreX, int centreZ, int dimension, int scale)
{
//__int64 zMasked = centreZ & 0x1FFFFFFF;
//__int64 xMasked = centreX & 0x1FFFFFFF;
//__int64 zShifted = zMasked << 34;
//__int64 xShifted = xMasked << 5;
//int64_t zMasked = centreZ & 0x1FFFFFFF;
//int64_t xMasked = centreX & 0x1FFFFFFF;
//int64_t zShifted = zMasked << 34;
//int64_t xShifted = xMasked << 5;
//app.DebugPrintf("xShifted = %d (0x%016x), zShifted = %I64d (0x%016llx)\n", xShifted, xShifted, zShifted, zShifted);
__int64 index = ( ((__int64)(centreZ & 0x1FFFFFFF)) << 34) | ( ((__int64)(centreX & 0x1FFFFFFF)) << 5) | ( (scale & 0x7) << 2) | (dimension & 0x3);
int64_t index = ( ((int64_t)(centreZ & 0x1FFFFFFF)) << 34) | ( ((int64_t)(centreX & 0x1FFFFFFF)) << 5) | ( (scale & 0x7) << 2) | (dimension & 0x3);
AUTO_VAR(it,m_mappings.find(index));
if(it != m_mappings.end())
{
@@ -151,7 +151,7 @@ void DirectoryLevelStorage::PlayerMappings::readMappings(DataInputStream *dis)
int count = dis->readInt();
for(unsigned int i = 0; i < count; ++i)
{
__int64 index = dis->readLong();
int64_t index = dis->readLong();
int id = dis->readInt();
m_mappings[index] = id;
app.DebugPrintf(" -- %lld (0x%016llx) = %d\n", index, index, id);
@@ -233,7 +233,7 @@ ChunkStorage *DirectoryLevelStorage::createChunkStorage(Dimension *dimension)
return new OldChunkStorage(dir, true);
}
LevelData *DirectoryLevelStorage::prepareLevel()
LevelData *DirectoryLevelStorage::prepareLevel()
{
// 4J Stu Added
#ifdef _LARGE_WORLDS
@@ -295,7 +295,7 @@ LevelData *DirectoryLevelStorage::prepareLevel()
#else
if(getSaveFile()->getSaveVersion() < END_DIMENSION_MAP_MAPPINGS_SAVE_VERSION)
{
{
MapDataMappings_old oldMapDataMappings;
getSaveFile()->readFile( fileEntry,
&oldMapDataMappings, // data buffer
@@ -334,7 +334,7 @@ LevelData *DirectoryLevelStorage::prepareLevel()
ConsoleSavePath dataFile = ConsoleSavePath( wstring( L"level.dat" ) );
if ( m_saveFile->doesFileExist( dataFile ) )
if ( m_saveFile->doesFileExist( dataFile ) )
{
ConsoleSaveFileInputStream fis = ConsoleSaveFileInputStream(m_saveFile, dataFile);
CompoundTag *root = NbtIo::readCompressed(&fis);
@@ -429,7 +429,7 @@ void DirectoryLevelStorage::save(shared_ptr<Player> player)
}
// 4J Changed return val to bool to check if new player or loaded player
bool DirectoryLevelStorage::load(shared_ptr<Player> player)
bool DirectoryLevelStorage::load(shared_ptr<Player> player)
{
bool newPlayer = true;
CompoundTag *tag = loadPlayerDataTag( player->getXuid() );
@@ -499,7 +499,7 @@ void DirectoryLevelStorage::clearOldPlayerFiles()
m_saveFile->deleteFile( playerFiles->at(i) );
}
}
else
else
#endif
if( playerFiles->size() > MAX_PLAYER_DATA_SAVES )
{
@@ -523,12 +523,12 @@ void DirectoryLevelStorage::clearOldPlayerFiles()
}
}
PlayerIO *DirectoryLevelStorage::getPlayerIO()
PlayerIO *DirectoryLevelStorage::getPlayerIO()
{
return this;
}
void DirectoryLevelStorage::closeAll()
void DirectoryLevelStorage::closeAll()
{
}
@@ -582,7 +582,7 @@ void DirectoryLevelStorage::resetNetherPlayerPositions()
// If the player is in the nether, set their y position above the top of the nether
// This will force the player to be spawned in a valid position in the overworld when they are loaded
if(tag->contains(L"Dimension") && tag->getInt(L"Dimension") == LevelData::DIMENSION_NETHER && tag->contains(L"Pos"))
{
{
ListTag<DoubleTag> *pos = (ListTag<DoubleTag> *) tag->getList(L"Pos");
pos->get(1)->data = DBL_MAX;

View File

@@ -54,7 +54,7 @@ typedef struct _MapDataMappings_old
void setMapping(int id, PlayerUID xuid, int dimension);
} MapDataMappings_old;
class DirectoryLevelStorage : public LevelStorage, public PlayerIO
class DirectoryLevelStorage : public LevelStorage, public PlayerIO
{
private:
/* 4J Jev, Probably no need for this as theres no exceptions being thrown.
@@ -65,7 +65,7 @@ private:
const ConsoleSavePath playerDir;
//const File dataDir;
const ConsoleSavePath dataDir;
const __int64 sessionId;
const int64_t sessionId;
const wstring levelId;
static const wstring sc_szPlayerDir;
@@ -75,7 +75,7 @@ private:
{
friend class DirectoryLevelStorage;
private:
unordered_map<__int64, short> m_mappings;
unordered_map<int64_t, short> m_mappings;
public:
void addMapping(int id, int centreX, int centreZ, int dimension, int scale);
@@ -92,7 +92,7 @@ private:
#else
MapDataMappings m_mapDataMappings;
MapDataMappings m_saveableMapDataMappings;
#endif
#endif
bool m_bHasLoadedMapDataMappings;
unordered_map<wstring, ByteArrayOutputStream *> m_cachedSaveData;

View File

@@ -210,7 +210,7 @@ bool EmptyLevelChunk::testSetBlocksAndData(byteArray data, int x0, int y0, int z
return false;
}
Random *EmptyLevelChunk::getRandom(__int64 l)
Random *EmptyLevelChunk::getRandom(int64_t l)
{
return new Random((level->getSeed() + x * x * 4987142 + x * 5947611 + z * z * 4392871l + z * 389711) ^ l);
}

View File

@@ -48,7 +48,7 @@ public:
int getBlocksAndData(byteArray data, int x0, int y0, int z0, int x1, int y1, int z1, int p, bool includeLighting = true); // 4J - added includeLighting parameter
int setBlocksAndData(byteArray data, int x0, int y0, int z0, int x1, int y1, int z1, int p, bool includeLighting = true); // 4J - added includeLighting parameter
bool testSetBlocksAndData(byteArray data, int x0, int y0, int z0, int x1, int y1, int z1, int p); // 4J added
Random *getRandom(__int64 l);
Random *getRandom(int64_t l);
bool isEmpty();
virtual void reSyncLighting() {}; // 4J added
};

View File

@@ -23,7 +23,7 @@ private:
bool m_costsChanged; // 4J Added
public:
__int64 nameSeed;
int64_t nameSeed;
public:
int costs[3];

View File

@@ -96,7 +96,7 @@ public:
};
__int64 lastModifiedTime; // 8B
int64_t lastModifiedTime; // 8B
};
typedef FileEntrySaveDataV2 FileEntrySaveData;
@@ -122,7 +122,7 @@ public:
currentFilePointer = data.startOffset;
}
unsigned int getFileSize() { return data.length; }
unsigned int getFileSize() { return data.length; }
bool isRegionFile() { return data.filename[0] == 0; } // When using ConsoleSaveFileSplit only
unsigned int getRegionFileIndex() { return data.regionIndex; } // When using ConsoleSaveFileSplit only
@@ -185,7 +185,7 @@ protected:
vector<FileEntry *> *getDatFilesWithMacAndUserID(const PlayerUID& pUID);
vector<FileEntry *> *getDatFilesWithPrimaryUser();
#endif
void setSaveVersion(int version) { m_saveVersion = version; }
int getSaveVersion() { return m_saveVersion; }
void setOriginalSaveVersion(int version) { m_originalSaveVersion = version; }
@@ -199,5 +199,5 @@ protected:
void setEndian(ByteOrder endian) { m_saveEndian = endian; }
static ByteOrder getEndian(ESavePlatform plat);
bool isLocalEndianDifferent(ESavePlatform plat){return m_localEndian != getEndian(plat); }
};

View File

@@ -164,8 +164,8 @@ void FileInputStream::close()
{
//printf("\n\nFileInputStream::close - TRYING TO CLOSE AN INVALID FILE HANDLE\n\n");
return;
}
}
BOOL result = CloseHandle( m_fileHandle );
if( result == 0 )
@@ -185,7 +185,7 @@ void FileInputStream::close()
//n - the number of bytes to be skipped.
//Returns:
//the actual number of bytes skipped.
__int64 FileInputStream::skip(__int64 n)
int64_t FileInputStream::skip(int64_t n)
{
#ifdef _XBOX
LARGE_INTEGER li;

View File

@@ -12,7 +12,7 @@ public:
virtual int read(byteArray b);
virtual int read(byteArray b, unsigned int offset, unsigned int length);
virtual void close();
virtual __int64 skip(__int64 n);
virtual int64_t skip(int64_t n);
private:
HANDLE m_fileHandle;

View File

@@ -11,7 +11,7 @@
//FlatLevelSource::villageFeature = new VillageFeature(1);
FlatLevelSource::FlatLevelSource(Level *level, __int64 seed, bool generateStructures)
FlatLevelSource::FlatLevelSource(Level *level, int64_t seed, bool generateStructures)
{
m_XZSize = level->getLevelData()->getXZSize();
@@ -32,26 +32,26 @@ FlatLevelSource::~FlatLevelSource()
delete villageFeature;
}
void FlatLevelSource::prepareHeights(byteArray blocks)
void FlatLevelSource::prepareHeights(byteArray blocks)
{
int height = blocks.length / (16 * 16);
for (int xc = 0; xc < 16; xc++)
for (int xc = 0; xc < 16; xc++)
{
for (int zc = 0; zc < 16; zc++)
for (int zc = 0; zc < 16; zc++)
{
for (int yc = 0; yc < height; yc++)
for (int yc = 0; yc < height; yc++)
{
int block = 0;
if (yc == 0)
if (yc == 0)
{
block = Tile::unbreakable_Id;
}
else if (yc <= 2)
}
else if (yc <= 2)
{
block = Tile::dirt_Id;
}
else if (yc == 3)
}
else if (yc == 3)
{
block = Tile::grass_Id;
}
@@ -61,12 +61,12 @@ void FlatLevelSource::prepareHeights(byteArray blocks)
}
}
LevelChunk *FlatLevelSource::create(int x, int z)
LevelChunk *FlatLevelSource::create(int x, int z)
{
return getChunk(x, z);
}
LevelChunk *FlatLevelSource::getChunk(int xOffs, int zOffs)
LevelChunk *FlatLevelSource::getChunk(int xOffs, int zOffs)
{
// 4J - now allocating this with a physical alloc & bypassing general memory management so that it will get cleanly freed
int chunksSize = Level::genDepth * 16 * 16;
@@ -80,7 +80,7 @@ LevelChunk *FlatLevelSource::getChunk(int xOffs, int zOffs)
// double[] temperatures = level.getBiomeSource().temperatures;
if (generateStructures)
if (generateStructures)
{
villageFeature->apply(this, level, xOffs, zOffs, blocks);
}
@@ -96,43 +96,43 @@ LevelChunk *FlatLevelSource::getChunk(int xOffs, int zOffs)
}
bool FlatLevelSource::hasChunk(int x, int y)
bool FlatLevelSource::hasChunk(int x, int y)
{
return true;
}
void FlatLevelSource::postProcess(ChunkSource *parent, int xt, int zt)
void FlatLevelSource::postProcess(ChunkSource *parent, int xt, int zt)
{
// 4J - changed from random to pprandom so we can run in parallel with getChunk etc.
pprandom->setSeed(level->getSeed());
__int64 xScale = pprandom->nextLong() / 2 * 2 + 1;
__int64 zScale = pprandom->nextLong() / 2 * 2 + 1;
int64_t xScale = pprandom->nextLong() / 2 * 2 + 1;
int64_t zScale = pprandom->nextLong() / 2 * 2 + 1;
pprandom->setSeed(((xt * xScale) + (zt * zScale)) ^ level->getSeed());
if (generateStructures)
if (generateStructures)
{
villageFeature->postProcess(level, pprandom, xt, zt);
}
app.processSchematics(parent->getChunk(xt,zt));
}
bool FlatLevelSource::save(bool force, ProgressListener *progressListener)
bool FlatLevelSource::save(bool force, ProgressListener *progressListener)
{
return true;
}
bool FlatLevelSource::tick()
bool FlatLevelSource::tick()
{
return false;
}
bool FlatLevelSource::shouldSave()
bool FlatLevelSource::shouldSave()
{
return true;
}
wstring FlatLevelSource::gatherStats()
wstring FlatLevelSource::gatherStats()
{
return L"FlatLevelSource";
}
@@ -140,7 +140,7 @@ wstring FlatLevelSource::gatherStats()
vector<Biome::MobSpawnerData *> *FlatLevelSource::getMobsAt(MobCategory *mobCategory, int x, int y, int z)
{
Biome *biome = level->getBiome(x, z);
if (biome == NULL)
if (biome == NULL)
{
return NULL;
}

View File

@@ -24,13 +24,13 @@ private:
boolean generateStructures;
VillageFeature *villageFeature;// = new VillageFeature(1);
public:
FlatLevelSource(Level *level, __int64 seed, bool generateStructures);
public:
FlatLevelSource(Level *level, int64_t seed, bool generateStructures);
~FlatLevelSource();
private: void prepareHeights(byteArray blocks);
private: void prepareHeights(byteArray blocks);
public:
public:
virtual LevelChunk *create(int x, int z);
virtual LevelChunk *getChunk(int xOffs, int zOffs);
virtual bool hasChunk(int x, int y);

View File

@@ -2,7 +2,7 @@
#include "System.h"
#include "net.minecraft.world.level.newbiome.layer.h"
FuzzyZoomLayer::FuzzyZoomLayer(__int64 seedMixup, shared_ptr<Layer>parent) : Layer(seedMixup)
FuzzyZoomLayer::FuzzyZoomLayer(int64_t seedMixup, shared_ptr<Layer>parent) : Layer(seedMixup)
{
this->parent = parent;
}
@@ -61,7 +61,7 @@ int FuzzyZoomLayer::random(int a, int b, int c, int d)
return d;
}
shared_ptr<Layer>FuzzyZoomLayer::zoom(__int64 seed, shared_ptr<Layer>sup, int count)
shared_ptr<Layer>FuzzyZoomLayer::zoom(int64_t seed, shared_ptr<Layer>sup, int count)
{
shared_ptr<Layer> result = sup;
for (int i = 0; i < count; i++)

View File

@@ -5,7 +5,7 @@
class FuzzyZoomLayer : public Layer
{
public:
FuzzyZoomLayer(__int64 seedMixup, shared_ptr<Layer>parent);
FuzzyZoomLayer(int64_t seedMixup, shared_ptr<Layer>parent);
intArray getArea(int xo, int yo, int w, int h);
protected:
@@ -13,5 +13,5 @@ protected:
int random(int a, int b, int c, int d);
public:
static shared_ptr<Layer>zoom(__int64 seed, shared_ptr<Layer>sup, int count);
static shared_ptr<Layer>zoom(int64_t seed, shared_ptr<Layer>sup, int count);
};

View File

@@ -13,5 +13,5 @@ public:
virtual int read(byteArray b) { return stream->read( b ); };
virtual int read(byteArray b, unsigned int offset, unsigned int length) { return stream->read(b, offset, length); };
virtual void close() { return stream->close(); };
virtual __int64 skip(__int64 n) { return 0; };
virtual int64_t skip(int64_t n) { return 0; };
};

View File

@@ -3,7 +3,7 @@
#include "net.minecraft.world.level.biome.h"
GrowMushroomIslandLayer::GrowMushroomIslandLayer(__int64 seedMixup, shared_ptr<Layer> parent) : Layer(seedMixup)
GrowMushroomIslandLayer::GrowMushroomIslandLayer(int64_t seedMixup, shared_ptr<Layer> parent) : Layer(seedMixup)
{
this->parent = parent;
}
@@ -25,10 +25,10 @@ intArray GrowMushroomIslandLayer::getArea(int xo, int yo, int w, int h)
int n2 = p[(x + 2) + (y + 0) * pw];
int n3 = p[(x + 0) + (y + 2) * pw];
int n4 = p[(x + 2) + (y + 2) * pw];
int c = p[(x + 1) + (y + 1) * pw];
if( ( n1 == Biome::mushroomIsland->id ) || ( n2 == Biome::mushroomIsland->id ) || ( n3 == Biome::mushroomIsland->id ) || ( n4 == Biome::mushroomIsland->id ) )
if( ( n1 == Biome::mushroomIsland->id ) || ( n2 == Biome::mushroomIsland->id ) || ( n3 == Biome::mushroomIsland->id ) || ( n4 == Biome::mushroomIsland->id ) )
{
result[x + y * w] = Biome::mushroomIsland->id;
}

View File

@@ -4,6 +4,6 @@
class GrowMushroomIslandLayer : public Layer
{
public:
GrowMushroomIslandLayer(__int64 seedMixup, shared_ptr<Layer> parent);
GrowMushroomIslandLayer(int64_t seedMixup, shared_ptr<Layer> parent);
virtual intArray getArea(int xo, int yo, int w, int h);
};

View File

@@ -48,7 +48,7 @@ ChunkSource *HellDimension::createRandomLevelSource() const
}
else
#endif
if (levelType == LevelType::lvl_flat)
if (levelType == LevelType::lvl_flat)
{
return new HellFlatLevelSource(level, level->getSeed());
}
@@ -68,7 +68,7 @@ bool HellDimension::isValidSpawn(int x, int z) const
return false;
}
float HellDimension::getTimeOfDay(__int64 time, float a) const
float HellDimension::getTimeOfDay(int64_t time, float a) const
{
return 0.5f;
}

View File

@@ -14,7 +14,7 @@ public:
virtual ChunkSource *createRandomLevelSource() const;
virtual bool isNaturalDimension();
virtual bool isValidSpawn(int x, int y) const;
virtual float getTimeOfDay(__int64 time, float a) const;
virtual float getTimeOfDay(int64_t time, float a) const;
virtual bool mayRespawn() const;
virtual bool isFoggyAt(int x, int z);

View File

@@ -4,7 +4,7 @@
#include "net.minecraft.world.level.storage.h"
#include "HellFlatLevelSource.h"
HellFlatLevelSource::HellFlatLevelSource(Level *level, __int64 seed)
HellFlatLevelSource::HellFlatLevelSource(Level *level, int64_t seed)
{
int xzSize = level->getLevelData()->getXZSize();
int hellScale = level->getLevelData()->getHellScale();
@@ -26,17 +26,17 @@ void HellFlatLevelSource::prepareHeights(int xOffs, int zOffs, byteArray blocks)
{
int height = blocks.length / (16 * 16);
for (int xc = 0; xc < 16; xc++)
for (int xc = 0; xc < 16; xc++)
{
for (int zc = 0; zc < 16; zc++)
for (int zc = 0; zc < 16; zc++)
{
for (int yc = 0; yc < height; yc++)
for (int yc = 0; yc < height; yc++)
{
int block = 0;
if ( (yc <= 6) || ( yc >= 121 ) )
{
block = Tile::hellRock_Id;
}
}
blocks[xc << 11 | zc << 7 | yc] = (byte) block;
}
@@ -159,8 +159,8 @@ void HellFlatLevelSource::postProcess(ChunkSource *parent, int xt, int zt)
// we need to use a separate random - have used the same initialisation code as used in RandomLevelSource::postProcess to make sure this random value
// is consistent for each world generation. Also changed all uses of random here to pprandom.
pprandom->setSeed(level->getSeed());
__int64 xScale = pprandom->nextLong() / 2 * 2 + 1;
__int64 zScale = pprandom->nextLong() / 2 * 2 + 1;
int64_t xScale = pprandom->nextLong() / 2 * 2 + 1;
int64_t zScale = pprandom->nextLong() / 2 * 2 + 1;
pprandom->setSeed(((xt * xScale) + (zt * zScale)) ^ level->getSeed());
int count = pprandom->nextInt(pprandom->nextInt(10) + 1) + 1;
@@ -211,7 +211,7 @@ wstring HellFlatLevelSource::gatherStats()
vector<Biome::MobSpawnerData *> *HellFlatLevelSource::getMobsAt(MobCategory *mobCategory, int x, int y, int z)
{
Biome *biome = level->getBiome(x, z);
if (biome == NULL)
if (biome == NULL)
{
return NULL;
}

View File

@@ -26,7 +26,7 @@ private:
Level *level;
public:
HellFlatLevelSource(Level *level, __int64 seed);
HellFlatLevelSource(Level *level, int64_t seed);
~HellFlatLevelSource();
private:

View File

@@ -7,7 +7,7 @@
#include "BiomeSource.h"
#include "HellRandomLevelSource.h"
HellRandomLevelSource::HellRandomLevelSource(Level *level, __int64 seed)
HellRandomLevelSource::HellRandomLevelSource(Level *level, int64_t seed)
{
int xzSize = level->getLevelData()->getXZSize();
int hellScale = level->getLevelData()->getHellScale();
@@ -224,7 +224,7 @@ void HellRandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks
if(random->nextInt(16) == 0)
{
top = (byte) Tile::netherStalk_Id;
// Place the nether wart on top of the soul sand
y += 1;
int genDepthMinusOne = Level::genDepthMinusOne; // Take into local int for PS4 as min takes a reference to the const int there and then needs the value to exist for the linker
@@ -430,8 +430,8 @@ void HellRandomLevelSource::postProcess(ChunkSource *parent, int xt, int zt)
// we need to use a separate random - have used the same initialisation code as used in RandomLevelSource::postProcess to make sure this random value
// is consistent for each world generation. Also changed all uses of random here to pprandom.
pprandom->setSeed(level->getSeed());
__int64 xScale = pprandom->nextLong() / 2 * 2 + 1;
__int64 zScale = pprandom->nextLong() / 2 * 2 + 1;
int64_t xScale = pprandom->nextLong() / 2 * 2 + 1;
int64_t zScale = pprandom->nextLong() / 2 * 2 + 1;
pprandom->setSeed(((xt * xScale) + (zt * zScale)) ^ level->getSeed());
netherBridgeFeature->postProcess(level, pprandom, xt, zt);
@@ -497,7 +497,7 @@ void HellRandomLevelSource::postProcess(ChunkSource *parent, int xt, int zt)
}
HeavyTile::instaFall = false;
app.processSchematics(parent->getChunk(xt,zt));
}

View File

@@ -37,7 +37,7 @@ private:
Level *level;
public:
HellRandomLevelSource(Level *level, __int64 seed);
HellRandomLevelSource(Level *level, int64_t seed);
~HellRandomLevelSource();
NetherBridgeFeature *netherBridgeFeature;
@@ -68,5 +68,5 @@ public:
wstring gatherStats();
virtual vector<Biome::MobSpawnerData *> *getMobsAt(MobCategory *mobCategory, int x, int y, int z);
virtual TilePos *findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z);
virtual TilePos *findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z);
};

View File

@@ -11,7 +11,7 @@ public:
virtual int read(byteArray b) = 0;
virtual int read(byteArray b, unsigned int offset, unsigned int length) = 0;
virtual void close() = 0;
virtual __int64 skip(__int64 n) = 0;
virtual int64_t skip(int64_t n) = 0;
static InputStream *getResourceAsStream(const wstring &fileName);
};

View File

@@ -1,7 +1,7 @@
#include "stdafx.h"
#include "net.minecraft.world.level.newbiome.layer.h"
IslandLayer::IslandLayer(__int64 seedMixup) : Layer(seedMixup)
IslandLayer::IslandLayer(int64_t seedMixup) : Layer(seedMixup)
{
}

View File

@@ -5,7 +5,7 @@
class IslandLayer : public Layer
{
public:
IslandLayer(__int64 seedMixup);
IslandLayer(int64_t seedMixup);
intArray getArea(int xo, int yo, int w, int h);
};

View File

@@ -34,9 +34,9 @@ double Math::random()
//a - a floating-point value to be rounded to a long.
//Returns:
//the value of the argument rounded to the nearest long value.
__int64 Math::round( double d )
int64_t Math::round( double d )
{
return (__int64)floor( d + 0.5 );
return (int64_t)floor( d + 0.5 );
}
int Math::_max(int a, int b)
@@ -59,7 +59,7 @@ float Math::_min(float a, float b)
return a < b ? a : b;
}
float Math::wrapDegrees(float input)
float Math::wrapDegrees(float input)
{
while(input>=360.0f)input-=360.0f;
if (input >= 180.0f) input -= 360.0f;
@@ -67,7 +67,7 @@ float Math::wrapDegrees(float input)
return input;
}
double Math::wrapDegrees(double input)
double Math::wrapDegrees(double input)
{
while(input>=360.0)input-=360.0;
if (input >= 180.0) input -= 360.0;

View File

@@ -8,7 +8,7 @@ private:
public:
static double random();
static __int64 round( double d );
static int64_t round( double d );
static int _max(int a, int b);
static float _max(float a, float b);
static int _min(int a, int b);

View File

@@ -4,12 +4,12 @@
#include "net.minecraft.world.level.biome.h"
#include "LargeCaveFeature.h"
void LargeCaveFeature::addRoom(__int64 seed, int xOffs, int zOffs, byteArray blocks, double xRoom, double yRoom, double zRoom)
void LargeCaveFeature::addRoom(int64_t seed, int xOffs, int zOffs, byteArray blocks, double xRoom, double yRoom, double zRoom)
{
addTunnel(seed, xOffs, zOffs, blocks, xRoom, yRoom, zRoom, 1 + random->nextFloat() * 6, 0, 0, -1, -1, 0.5);
}
void LargeCaveFeature::addTunnel(__int64 seed, int xOffs, int zOffs, byteArray blocks, double xCave, double yCave, double zCave, float thickness, float yRot, float xRot, int step, int dist, double yScale)
void LargeCaveFeature::addTunnel(int64_t seed, int xOffs, int zOffs, byteArray blocks, double xCave, double yCave, double zCave, float thickness, float yRot, float xRot, int step, int dist, double yScale)
{
double xMid = xOffs * 16 + 8;
double zMid = zOffs * 16 + 8;
@@ -123,7 +123,7 @@ void LargeCaveFeature::addTunnel(__int64 seed, int xOffs, int zOffs, byteArray b
}
if (detectedWater) continue;
for (int xx = x0; xx < x1; xx++)
for (int xx = x0; xx < x1; xx++)
{
double xd = ((xx + xOffs * 16 + 0.5) - xCave) / rad;
for (int zz = z0; zz < z1; zz++)
@@ -142,7 +142,7 @@ void LargeCaveFeature::addTunnel(__int64 seed, int xOffs, int zOffs, byteArray b
if (block == Tile::grass_Id) hasGrass = true;
if (block == Tile::rock_Id || block == Tile::dirt_Id || block == Tile::grass_Id)
{
if (yy < 10)
if (yy < 10)
{
blocks[p] = (byte) Tile::lava_Id;
}

View File

@@ -5,7 +5,7 @@
class LargeCaveFeature : public LargeFeature
{
protected:
void addRoom(__int64 seed, int xOffs, int zOffs, byteArray blocks, double xRoom, double yRoom, double zRoom);
void addTunnel(__int64 seed, int xOffs, int zOffs, byteArray blocks, double xCave, double yCave, double zCave, float thickness, float yRot, float xRot, int step, int dist, double yScale);
void addRoom(int64_t seed, int xOffs, int zOffs, byteArray blocks, double xRoom, double yRoom, double zRoom);
void addTunnel(int64_t seed, int xOffs, int zOffs, byteArray blocks, double xCave, double yCave, double zCave, float thickness, float yRot, float xRot, int step, int dist, double yScale);
virtual void addFeature(Level *level, int x, int z, int xOffs, int zOffs, byteArray blocks);
};

View File

@@ -21,15 +21,15 @@ void LargeFeature::apply(ChunkSource *ChunkSource, Level *level, int xOffs, int
this->level = level;
random->setSeed(level->getSeed());
__int64 xScale = random->nextLong();
__int64 zScale = random->nextLong();
int64_t xScale = random->nextLong();
int64_t zScale = random->nextLong();
for (int x = xOffs - r; x <= xOffs + r; x++)
{
for (int z = zOffs - r; z <= zOffs + r; z++)
{
__int64 xx = x * xScale;
__int64 zz = z * zScale;
int64_t xx = x * xScale;
int64_t zz = z * zScale;
random->setSeed(xx ^ zz ^ level->getSeed());
addFeature(level, x, z, xOffs, zOffs, blocks);
}

View File

@@ -16,7 +16,7 @@ libdivide::divider<long long> fast_d7(7);
libdivide::divider<long long> fast_d10(10);
#endif
LayerArray Layer::getDefaultLayers(__int64 seed, LevelType *levelType)
LayerArray Layer::getDefaultLayers(int64_t seed, LevelType *levelType)
{
// 4J - Some changes moved here from 1.2.3. Temperature & downfall layers are no longer created & returned, and a debug layer is isn't.
// For reference with regard to future merging, things NOT brought forward from the 1.2.3 version are new layer types that we
@@ -58,7 +58,7 @@ LayerArray Layer::getDefaultLayers(__int64 seed, LevelType *levelType)
biomeLayer = shared_ptr<Layer>(new ZoomLayer(1000 + i, biomeLayer));
if (i == 0) biomeLayer = shared_ptr<Layer>(new AddIslandLayer(3, biomeLayer));
if (i == 0)
{
// 4J - moved mushroom islands to here. This skips 3 zooms that the old location of the add was, making them about 1/8 of the original size. Adding
@@ -68,13 +68,13 @@ LayerArray Layer::getDefaultLayers(__int64 seed, LevelType *levelType)
}
if (i == 1 )
{
{
// 4J - now expand mushroom islands up again. This does a simple region grow to add a new mushroom island element when any of the neighbours are also mushroom islands.
// This helps make the islands into nice compact shapes of the type that are actually likely to be able to make an island out of the sea in a small space. Also
// helps the shore layer from doing too much damage in shrinking the islands we are making
biomeLayer = shared_ptr<Layer>(new GrowMushroomIslandLayer(5, biomeLayer));
biomeLayer = shared_ptr<Layer>(new GrowMushroomIslandLayer(5, biomeLayer));
// Note - this reduces the size of mushroom islands by turning their edges into shores. We are doing this at i == 1 rather than i == 0 as the original does
biomeLayer = shared_ptr<Layer>(new ShoreLayer(1000, biomeLayer));
biomeLayer = shared_ptr<Layer>(new ShoreLayer(1000, biomeLayer));
biomeLayer = shared_ptr<Layer>(new SwampRiversLayer(1000, biomeLayer));
}
@@ -107,7 +107,7 @@ LayerArray Layer::getDefaultLayers(__int64 seed, LevelType *levelType)
return result;
}
Layer::Layer(__int64 seedMixup)
Layer::Layer(int64_t seedMixup)
{
parent = nullptr;
@@ -120,7 +120,7 @@ Layer::Layer(__int64 seedMixup)
this->seedMixup += seedMixup;
}
void Layer::init(__int64 seed)
void Layer::init(int64_t seed)
{
this->seed = seed;
if (parent != NULL) parent->init(seed);
@@ -132,7 +132,7 @@ void Layer::init(__int64 seed)
this->seed += seedMixup;
}
void Layer::initRandom(__int64 x, __int64 y)
void Layer::initRandom(int64_t x, int64_t y)
{
rval = seed;
rval *= rval * 6364136223846793005l + 1442695040888963407l;

View File

@@ -11,22 +11,22 @@ class LevelType;
class Layer
{
private:
__int64 seed;
int64_t seed;
protected:
shared_ptr<Layer>parent;
private:
__int64 rval;
__int64 seedMixup;
int64_t rval;
int64_t seedMixup;
public:
static LayerArray getDefaultLayers(__int64 seed, LevelType *levelType);
static LayerArray getDefaultLayers(int64_t seed, LevelType *levelType);
Layer(__int64 seedMixup);
Layer(int64_t seedMixup);
virtual void init(__int64 seed);
virtual void initRandom(__int64 x, __int64 y);
virtual void init(int64_t seed);
virtual void initRandom(int64_t x, int64_t y);
protected:
int nextRandom(int max);

View File

@@ -112,7 +112,7 @@ void Level::initCache(lightCache_t *cache)
}
// Set a brightness value, going through the cache if enabled for this thread
void inline Level::setBrightnessCached(lightCache_t *cache, __uint64 *cacheUse, LightLayer::variety layer, int x, int y, int z, int brightness)
void inline Level::setBrightnessCached(lightCache_t *cache, uint64_t *cacheUse, LightLayer::variety layer, int x, int y, int z, int brightness)
{
if( cache == NULL )
{
@@ -129,8 +129,8 @@ void inline Level::setBrightnessCached(lightCache_t *cache, __uint64 *cacheUse,
( ( z & 0x3f0 ) >> 4 );
#ifdef _LARGE_WORLDS
// Add in the higher bits for x and z
posbits |= ( ( ((__uint64)x) & 0x3FFFC00L) << 38) |
( ( ((__uint64)z) & 0x3FFFC00L) << 22);
posbits |= ( ( ((uint64_t)x) & 0x3FFFC00L) << 38) |
( ( ((uint64_t)z) & 0x3FFFC00L) << 22);
#endif
lightCache_t cacheValue = cache[idx];
@@ -188,8 +188,8 @@ inline int Level::getBrightnessCached(lightCache_t *cache, LightLayer::variety l
( ( z & 0x3f0 ) >> 4 );
#ifdef _LARGE_WORLDS
// Add in the higher bits for x and z
posbits |= ( ( ((__uint64)x) & 0x3FFFC00L) << 38) |
( ( ((__uint64)z) & 0x3FFFC00L) << 22);
posbits |= ( ( ((uint64_t)x) & 0x3FFFC00L) << 38) |
( ( ((uint64_t)z) & 0x3FFFC00L) << 22);
#endif
lightCache_t cacheValue = cache[idx];
@@ -255,8 +255,8 @@ inline int Level::getEmissionCached(lightCache_t *cache, int ct, int x, int y, i
( ( z & 0x3f0 ) >> 4 );
#ifdef _LARGE_WORLDS
// Add in the higher bits for x and z
posbits |= ( ( ((__uint64)x) & 0x3FFFC00) << 38) |
( ( ((__uint64)z) & 0x3FFFC00) << 22);
posbits |= ( ( ((uint64_t)x) & 0x3FFFC00) << 38) |
( ( ((uint64_t)z) & 0x3FFFC00) << 22);
#endif
lightCache_t cacheValue = cache[idx];
@@ -285,7 +285,7 @@ inline int Level::getEmissionCached(lightCache_t *cache, int ct, int x, int y, i
#endif
setBrightness(LightLayer::Block, xx, yy, zz, val, true);
}
// Update both emission & blocking values whilst we are here
cacheValue = posbits | EMISSION_VALID | BLOCKING_VALID;
int t = getTile(x,y,z);
@@ -331,8 +331,8 @@ inline int Level::getBlockingCached(lightCache_t *cache, LightLayer::variety lay
( ( z & 0x3f0 ) >> 4 );
#ifdef _LARGE_WORLDS
// Add in the higher bits for x and z
posbits |= ( ( ((__uint64)x) & 0x3FFFC00L) << 38) |
( ( ((__uint64)z) & 0x3FFFC00L) << 22);
posbits |= ( ( ((uint64_t)x) & 0x3FFFC00L) << 38) |
( ( ((uint64_t)z) & 0x3FFFC00L) << 22);
#endif
lightCache_t cacheValue = cache[idx];
@@ -361,7 +361,7 @@ inline int Level::getBlockingCached(lightCache_t *cache, LightLayer::variety lay
#endif
setBrightness(layer, xx, yy, zz, val, true);
}
// Update both emission & blocking values whilst we are here
cacheValue = posbits | EMISSION_VALID | BLOCKING_VALID;
int t = getTile(x,y,z);
@@ -394,7 +394,7 @@ inline int Level::getBlockingCached(lightCache_t *cache, LightLayer::variety lay
// this hasn't been updated (for client threads) for each individual lighting update as would have been the case with the non-cached lighting. There's two reasons for this
// (1) it's more efficient, since we aren't doing so many individual calls to the level listener to let the renderer know what has been updated
// (2) it lets the lighting actually complete before we get any visual representation of the update, otherwise we end up seeing some strange partial updates
void Level::flushCache(lightCache_t *cache, __uint64 cacheUse, LightLayer::variety layer)
void Level::flushCache(lightCache_t *cache, uint64_t cacheUse, LightLayer::variety layer)
{
// cacheUse has a single bit for each x, y and z to say whether anything with that x, y or z has been written to
if( cacheUse == 0 ) return;
@@ -596,7 +596,7 @@ Level::Level(Level *level, Dimension *dimension)
this->levelData = new LevelData(level->levelData);
if( !this->levelData->useNewSeaLevel() ) seaLevel = Level::genDepth / 2; // 4J added - sea level is one unit lower since 1.8.2, maintain older height for old levels
this->savedDataStorage = new SavedDataStorage( levelStorage.get() );
shared_ptr<Villages> savedVillages = dynamic_pointer_cast<Villages>(savedDataStorage->get(typeid(Villages), Villages::VILLAGE_FILE_ID));
if (savedVillages == NULL)
{
@@ -660,7 +660,7 @@ void Level::_init(shared_ptr<LevelStorage>levelStorage, const wstring& levelName
//{
// dimension = Dimension::getNew(levelData->getDimension());
//}
else
else
{
dimension = Dimension::getNew(0);
}
@@ -676,7 +676,7 @@ void Level::_init(shared_ptr<LevelStorage>levelStorage, const wstring& levelName
if( !this->levelData->useNewSeaLevel() ) seaLevel = Level::genDepth / 2; // 4J added - sea level is one unit lower since 1.8.2, maintain older height for old levels
((Dimension *) dimension)->init( this );
chunkSource = doCreateChunkSource ? createChunkSource() : NULL; // 4J - added flag so chunk source can be called from derived class instead
// 4J Stu- Moved to derived classes
@@ -707,7 +707,7 @@ Level::~Level()
DeleteCriticalSection(&m_checkLightCS);
// 4J-PB - savedDataStorage is shared between overworld and nether levels in the server, so it will already have been deleted on the first level delete
if(savedDataStorage!=NULL) delete savedDataStorage;
if(savedDataStorage!=NULL) delete savedDataStorage;
DeleteCriticalSection(&m_entitiesCS);
DeleteCriticalSection(&m_tileEntityListCS);
@@ -1298,7 +1298,7 @@ int Level::getBrightness(LightLayer::variety layer, int x, int y, int z)
// the level chunk once
void Level::getNeighbourBrightnesses(int *brightnesses, LightLayer::variety layer, int x, int y, int z)
{
if( ( ( ( x & 15 ) == 0 ) || ( ( x & 15 ) == 15 ) ) ||
if( ( ( ( x & 15 ) == 0 ) || ( ( x & 15 ) == 15 ) ) ||
( ( ( z & 15 ) == 0 ) || ( ( z & 15 ) == 15 ) ) ||
( ( y <= 0 ) || ( y >= 127 ) ) )
{
@@ -1591,7 +1591,7 @@ void Level::playSound(shared_ptr<Entity> entity, int iSound, float volume, float
if(entity->GetType() == eTYPE_SERVERPLAYER)
{
//app.DebugPrintf("ENTITY is serverplayer\n");
(*it)->playSound(entity,iSound, entity->x, entity->y - entity->heightOffset, entity->z, volume, pitch);
}
else
@@ -1630,7 +1630,7 @@ void Level::playMusic(double x, double y, double z, const wstring& string, float
{
}
// 4J removed -
// 4J removed -
/*
void Level::addParticle(const wstring& id, double x, double y, double z, double xd, double yd, double zd)
{
@@ -2255,7 +2255,7 @@ void Level::tickEntities()
{
entityRemoved(*it);
}
//
//
entitiesToRemove.clear();
//for (int i = 0; i < entities.size(); i++)
@@ -2268,7 +2268,7 @@ void Level::tickEntities()
for (unsigned int i = 0; i < entities.size(); )
{
shared_ptr<Entity> e = entities.at(i);
if (e->riding != NULL)
{
if (e->riding->removed || e->riding->rider.lock() != e)
@@ -2287,7 +2287,7 @@ void Level::tickEntities()
{
#ifndef _FINAL_BUILD
if(!( app.DebugSettingsOn() && app.GetMobsDontTickEnabled() && (dynamic_pointer_cast<Mob>(e) != NULL) && (dynamic_pointer_cast<Player>(e) == NULL)))
#endif
#endif
{
tick(e);
}
@@ -2360,7 +2360,7 @@ void Level::tickEntities()
// 4J-PB - Stuart - check this is correct here
if (!tileEntitiesToUnload.empty())
{
{
//tileEntityList.removeAll(tileEntitiesToUnload);
for( AUTO_VAR(it, tileEntityList.begin()); it != tileEntityList.end(); )
@@ -2767,7 +2767,7 @@ shared_ptr<Explosion> Level::explode(shared_ptr<Entity> source, double x, double
shared_ptr<Explosion> Level::explode(shared_ptr<Entity> source, double x, double y, double z, float r, bool fire, bool destroyBlocks)
{
shared_ptr<Explosion> explosion = shared_ptr<Explosion>( new Explosion(this, source, x, y, z, r) );
explosion->fire = fire;
explosion->fire = fire;
explosion->destroyBlocks = destroyBlocks;
explosion->explode();
explosion->finalizeExplosion(true);
@@ -2945,7 +2945,7 @@ bool Level::isSolidRenderTile(int x, int y, int z)
{
Tile *tile = Tile::tiles[getTile(x, y, z)];
if (tile == NULL) return false;
// 4J - addition here to make rendering big blocks of leaves more efficient. Normally leaves never consider themselves as solid, so
// blocks of leaves will have all sides of each block completely visible. Changing to consider as solid if this block is surrounded by
// other leaves (or solid things). This is paired with another change in Tile::getTexture which makes such solid tiles actually visibly solid (these
@@ -3008,7 +3008,7 @@ bool Level::isTopSolidBlocking(int x, int y, int z)
if (tile == NULL) return false;
if (tile->material->isSolidBlocking() && tile->isCubeShaped()) return true;
if (dynamic_cast<StairTile *>(tile) != NULL)
if (dynamic_cast<StairTile *>(tile) != NULL)
{
return (getData(x, y, z) & StairTile::UPSIDEDOWN_BIT) == StairTile::UPSIDEDOWN_BIT;
}
@@ -3159,7 +3159,7 @@ void Level::toggleDownfall()
void Level::buildAndPrepareChunksToPoll()
{
#if 0
#if 0
AUTO_VAR(itEnd, players.end());
for (AUTO_VAR(it, players.begin()); it != itEnd; it++)
{
@@ -3205,7 +3205,7 @@ void Level::buildAndPrepareChunksToPoll()
delete [] xx;
delete [] zz;
#endif
if (delayUntilNextMoodSound > 0) delayUntilNextMoodSound--;
// 4J Stu - Added 1.2.3, but not sure if we want to do it
@@ -3387,7 +3387,7 @@ inline int GetIndex(int x, int y, int z)
void Level::checkLight(LightLayer::variety layer, int xc, int yc, int zc, bool force, bool rootOnlyEmissive)
{
lightCache_t *cache = (lightCache_t *)TlsGetValue(tlsIdxLightCache);
__uint64 cacheUse = 0;
uint64_t cacheUse = 0;
if( force )
{
@@ -3416,7 +3416,7 @@ void Level::checkLight(LightLayer::variety layer, int xc, int yc, int zc, bool f
EnterCriticalSection(&m_checkLightCS);
#ifdef __PSVITA__
// AP - only clear the one array element required to check if something has changed
// AP - only clear the one array element required to check if something has changed
cachewritten = false;
if( cache != NULL )
{
@@ -3450,7 +3450,7 @@ void Level::checkLight(LightLayer::variety layer, int xc, int yc, int zc, bool f
#endif
// If we're in cached mode, then use memory allocated after the cached data itself for the toCheck array, in an attempt to make both that & the other cached data sit on the CPU L2 cache better.
int *toCheck;
if( cache == NULL )
{
@@ -3477,7 +3477,7 @@ void Level::checkLight(LightLayer::variety layer, int xc, int yc, int zc, bool f
// Lock 128K of cache (containing all the lighting cache + first 112K of toCheck array) on L2 to try and stop any cached data getting knocked out of L2 by other non-cached reads (or vice-versa)
// if( cache ) XLockL2(XLOCKL2_INDEX_TITLE, cache, 128 * 1024, XLOCKL2_LOCK_SIZE_1_WAY, 0 );
{
int cc = getBrightnessCached(cache, layer, xc, yc, zc);
int ex = 0;
@@ -3713,7 +3713,7 @@ void Level::checkLight(LightLayer::variety layer, int xc, int yc, int zc, bool f
/////////////////////////////////////////////////////////////////
#endif
LeaveCriticalSection(&m_checkLightCS);
}
@@ -3905,7 +3905,7 @@ unsigned int Level::countInstanceOfInRange(eINSTANCEOF clas, bool singleType, in
for (AUTO_VAR(it, entities.begin()); it != itEnd; it++)
{
shared_ptr<Entity> e = *it;//entities.at(i);
float sd = e->distanceTo(x,y,z);
if (sd * sd > range * range)
{
@@ -4149,7 +4149,7 @@ shared_ptr<Player> Level::getNearestAttackablePlayer(shared_ptr<Entity> source,
shared_ptr<Player> Level::getNearestAttackablePlayer(double x, double y, double z, double maxDist)
{
double best = -1;
shared_ptr<Player> result = nullptr;
AUTO_VAR(itEnd, players.end());
for (AUTO_VAR(it, players.begin()); it != itEnd; it++)
@@ -4179,7 +4179,7 @@ shared_ptr<Player> Level::getNearestAttackablePlayer(double x, double y, double
}
visibleDist *= (.7f * coverPercentage);
}
// 4J Stu - Added check that this player is still alive and privilege check
if ((visibleDist < 0 || dist < visibleDist * visibleDist) && (best == -1 || dist < best) && p->isAlive() && !p->hasInvisiblePrivilege())
{
@@ -4318,16 +4318,16 @@ void Level::checkSession()
}
void Level::setTime(__int64 time)
void Level::setTime(int64_t time)
{
// 4J : WESTY : Added to track game time played by players for other awards.
if (time != 0) // Ignore setting time to 0, done at level start and during tutorial.
{
// Determine step in time and ensure it is reasonable ( we only have an int to store the player stat).
__int64 timeDiff = time - levelData->getTime();
int64_t timeDiff = time - levelData->getTime();
// debug setting added to keep it at day time
#ifndef _FINAL_BUILD
#ifndef _FINAL_BUILD
if(app.DebugSettingsOn())
{
if(app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L<<eDebugSetting_FreezeTime))
@@ -4363,18 +4363,18 @@ void Level::setTime(__int64 time)
this->levelData->setTime(time);
}
void Level::setOverrideTimeOfDay(__int64 time)
void Level::setOverrideTimeOfDay(int64_t time)
{
m_timeOfDayOverride = time;
}
__int64 Level::getSeed()
int64_t Level::getSeed()
{
return levelData->getSeed();
}
__int64 Level::getTime()
int64_t Level::getTime()
{
return levelData->getTime();
}
@@ -4529,7 +4529,7 @@ int Level::getAuxValueForMap(PlayerUID xuid, int dimension, int centreXC, int ce
return savedDataStorage->getAuxValueForMap(xuid, dimension, centreXC, centreZC, scale);
}
// void Level::globalLevelEvent(int type, int sourceX, int sourceY, int sourceZ, int data)
// void Level::globalLevelEvent(int type, int sourceX, int sourceY, int sourceZ, int data)
// {
// auto itEnd = listeners.end();
// for (auto it = listeners.begin(); it != itEnd; it++)
@@ -4565,7 +4565,7 @@ int Level::getHeight()
Random *Level::getRandomFor(int x, int z, int blend)
{
__int64 seed = (x * 341873128712l + z * 132897987541l) + getLevelData()->getSeed() + blend;
int64_t seed = (x * 341873128712l + z * 132897987541l) + getLevelData()->getSeed() + blend;
random->setSeed(seed);
return random;
}
@@ -4585,9 +4585,9 @@ bool Level::isAllEmpty()
return false;
}
double Level::getHorizonHeight()
double Level::getHorizonHeight()
{
if (levelData->getGenerator() == LevelType::lvl_flat)
if (levelData->getGenerator() == LevelType::lvl_flat)
{
return 0.0;
}

View File

@@ -133,7 +133,7 @@ public:
Random *random;
bool isNew;
Dimension *dimension;
protected:
vector<LevelListener *> listeners;
@@ -239,26 +239,26 @@ public:
void setBrightnessNoUpdateOnClient(LightLayer::variety layer, int x, int y, int z, int brightness); // 4J added
#ifdef _LARGE_WORLDS
typedef __uint64 lightCache_t;
typedef uint64_t lightCache_t;
#else
typedef unsigned int lightCache_t;
#endif
inline void setBrightnessCached(lightCache_t *cache, __uint64 *cacheUse, LightLayer::variety layer, int x, int y, int z, int brightness);
inline void setBrightnessCached(lightCache_t *cache, uint64_t *cacheUse, LightLayer::variety layer, int x, int y, int z, int brightness);
inline int getBrightnessCached(lightCache_t *cache, LightLayer::variety layer, int x, int y, int z);
inline int getEmissionCached(lightCache_t *cache, int ct, int x, int y, int z);
inline int getBlockingCached(lightCache_t *cache, LightLayer::variety layer, int *ct, int x, int y, int z);
void initCache(lightCache_t *cache);
void flushCache(lightCache_t *cache, __uint64 cacheUse, LightLayer::variety layer);
void flushCache(lightCache_t *cache, uint64_t cacheUse, LightLayer::variety layer);
bool cachewritten;
static const int LIGHTING_SHIFT = 24;
static const int BLOCKING_SHIFT = 20;
static const int EMISSION_SHIFT = 16;
#ifdef _LARGE_WORLDS
static const __int64 LIGHTING_WRITEBACK = 0x80000000LL;
static const __int64 EMISSION_VALID = 0x40000000LL;
static const __int64 BLOCKING_VALID = 0x20000000LL;
static const __int64 LIGHTING_VALID = 0x10000000LL;
static const int64_t LIGHTING_WRITEBACK = 0x80000000LL;
static const int64_t EMISSION_VALID = 0x40000000LL;
static const int64_t BLOCKING_VALID = 0x20000000LL;
static const int64_t LIGHTING_VALID = 0x10000000LL;
static const lightCache_t POSITION_MASK = 0xffffffff0000ffffLL;
#else
static const int LIGHTING_WRITEBACK = 0x80000000;
@@ -402,7 +402,7 @@ public:
bool shouldSnow(int x, int y, int z);
void checkLight(int x, int y, int z, bool force = false, bool rootOnlyEmissive = false); // 4J added force, rootOnlySource parameters
private:
int *toCheckLevel;
int *toCheckLevel;
int getExpectedSkyColor(lightCache_t *cache, int oc, int x, int y , int z, int ct, int block);
int getExpectedBlockColor(lightCache_t *cache, int oc, int x, int y, int z, int ct, int block, bool propagatedOnly); // 4J added parameter
public:
@@ -449,10 +449,10 @@ public:
void setBlocksAndData(int x, int y, int z, int xs, int ys, int zs, byteArray data, bool includeLighting = true);
virtual void disconnect(bool sendDisconnect = true);
void checkSession();
void setTime(__int64 time);
void setOverrideTimeOfDay(__int64 time); // 4J Added so we can override timeOfDay without changing tick time
__int64 getSeed();
__int64 getTime();
void setTime(int64_t time);
void setOverrideTimeOfDay(int64_t time); // 4J Added so we can override timeOfDay without changing tick time
int64_t getSeed();
int64_t getTime();
Pos *getSharedSpawnPos();
void setSpawnPos(int x, int y, int z);
void setSpawnPos(Pos *spawnPos);
@@ -496,7 +496,7 @@ public:
// 4J added
__int64 m_timeOfDayOverride;
int64_t m_timeOfDayOverride;
// 4J - optimisation - keep direct reference of underlying cache here
LevelChunk **chunkSourceCache;

View File

@@ -51,7 +51,7 @@ void LevelChunk::init(Level *level, int x, int z)
biomes = byteArray(16 * 16);
for(int i = 0; i < 16 * 16; i++ )
{
biomes[i] = 0xff;
biomes[i] = 0xff;
}
#ifdef _ENTITIES_RW_SECTION
EnterCriticalRWSection(&m_csEntities, true);
@@ -103,12 +103,12 @@ void LevelChunk::init(Level *level, int x, int z)
// Optimisation brought forward from 1.8.2, change from int to unsigned char & this special value changed from -999 to 255
for(int i = 0; i < 16 * 16; i++ )
{
rainHeights[i] = 255;
rainHeights[i] = 255;
}
// 4J - lighting change brought forward from 1.8.2, introduced an array of bools called gapsToRecheck, which are now a single bit in array of nybble flags in this version
for(int i = 0; i < 8 * 16; i++ )
{
columnFlags[i] = 0;
columnFlags[i] = 0;
}
// 4J added - to flag if any emissive tile has been added to this chunk (will be cleared when lighting has been successfully completed for this chunk). Defaulting to true
@@ -183,7 +183,7 @@ LevelChunk::LevelChunk(Level *level, byteArray blocks, int x, int z) : ENTITY_BL
// skyLight = new DataLayer(blocks.length, level->depthBits);
// blockLight = new DataLayer(blocks.length, level->depthBits);
if(Level::maxBuildHeight > Level::COMPRESSED_CHUNK_SECTION_HEIGHT)
if(Level::maxBuildHeight > Level::COMPRESSED_CHUNK_SECTION_HEIGHT)
{
if(blocks.length > Level::COMPRESSED_CHUNK_SECTION_TILES) upperBlocks = new CompressedTileStorage(blocks,Level::COMPRESSED_CHUNK_SECTION_TILES);
else upperBlocks = new CompressedTileStorage(true);
@@ -388,7 +388,7 @@ void LevelChunk::startSharingTilesAndData(int forceMs)
else
{
// Only force if it has been more than forceMs milliseconds since we last wanted to unshare this chunk
__int64 timenow = System::currentTimeMillis();
int64_t timenow = System::currentTimeMillis();
if( ( timenow - lastUnsharedTime ) < forceMs )
{
LeaveCriticalSection(&m_csSharing);
@@ -551,7 +551,7 @@ void LevelChunk::recalcHeightmap()
{
int y = Level::maxBuildHeight - 1;
// int p = x << level->depthBitsPlusFour | z << level->depthBits; // 4J - removed
#ifdef __PSVITA__
int Index = ( x << 11 ) + ( z << 7 );
int offset = Level::COMPRESSED_CHUNK_SECTION_TILES;
@@ -656,7 +656,7 @@ void LevelChunk::recalcHeightmap()
void LevelChunk::lightLava()
{
if( !emissiveAdded ) return;
for (int x = 0; x < 16; x++)
for (int z = 0; z < 16; z++)
{
@@ -697,7 +697,7 @@ void LevelChunk::recheckGaps(bool bForce)
// 4J added - otherwise we can end up doing a very broken kind of lighting since for an empty chunk, the heightmap is all zero, but it
// still has an x and z of 0 which means that the level->getHeightmap references in here find a real chunk near the origin, and then attempt
// to light massive gaps between the height of 0 and whatever heights are in those.
if( isEmpty() ) return;
if( isEmpty() ) return;
// 4J added
int minXZ = - (level->dimension->getXZSize() * 16 ) / 2;
@@ -765,7 +765,7 @@ void LevelChunk::lightGap(int x, int z, int source)
{
lightGap(x, z, source, height + 1);
}
else if (height < source)
else if (height < source)
{
lightGap(x, z, height, source + 1);
}
@@ -793,7 +793,7 @@ void LevelChunk::recalcHeight(int x, int yStart, int z)
if (yStart > yOld) y = yStart;
// int p = x << level->depthBitsPlusFour | z << level->depthBits; // 4J - removed
CompressedTileStorage *blocks = (y-1) >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT?upperBlocks : lowerBlocks;
while (y > 0 && Tile::lightBlock[blocks->get(x,(y-1) % Level::COMPRESSED_CHUNK_SECTION_HEIGHT,z) & 0xff] == 0) // 4J - blocks->get() was blocks[p + y - 1]
{
@@ -845,7 +845,7 @@ void LevelChunk::recalcHeight(int x, int yStart, int z)
}
int br = 15;
SparseLightStorage *skyLight = y >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT? upperSkyLight : lowerSkyLight;
while (y > 0 && br > 0)
{
@@ -891,7 +891,7 @@ void LevelChunk::recalcHeight(int x, int yStart, int z)
/**
* The purpose of this method is to allow the EmptyLevelChunk to be all air
* but still block light. See EmptyLevelChunk.java
*
*
* @param x
* @param y
* @param z
@@ -921,7 +921,7 @@ bool LevelChunk::setTileAndData(int x, int y, int z, int _tile, int _data)
}
int oldHeight = heightmap[slot] & 0xff;
CompressedTileStorage *blocks = y >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT ? upperBlocks : lowerBlocks;
SparseDataStorage *data = y >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT ? upperData : lowerData;
int old = blocks->get(x,y % Level::COMPRESSED_CHUNK_SECTION_HEIGHT,z);
@@ -1116,12 +1116,12 @@ void LevelChunk::getNeighbourBrightnesses(int *brightnesses, LightLayer::variety
brightnesses[5] = light->get(x, y % Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z + 1);
}
if( layer == LightLayer::Sky ) light = (y-1) >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT ? upperSkyLight : lowerSkyLight;
else light = (y-1) >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT ? upperBlockLight : lowerBlockLight;
if(light) brightnesses[2] = light->get(x, (y - 1) % Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z);
if( layer == LightLayer::Sky ) light = (y+1) >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT ? upperSkyLight : lowerSkyLight;
else light = (y+1) >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT ? upperBlockLight : lowerBlockLight;
if(light) brightnesses[3] = light->get(x, (y + 1) % Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z);
@@ -1227,7 +1227,7 @@ void LevelChunk::removeEntity(shared_ptr<Entity> e, int yc)
// MGH - have to sort this C++11 code
static bool bShowMsg = true;
if(bShowMsg)
{
{
app.DebugPrintf("Need to add C++11 shrink_to_fit for PS3\n");
bShowMsg = false;
}
@@ -1282,7 +1282,7 @@ shared_ptr<TileEntity> LevelChunk::getTileEntity(int x, int y, int z)
int t = getTile(x, y, z);
if (t <= 0 || !Tile::tiles[t]->isEntityTile()) return nullptr;
// 4J-PB changed from this in 1.7.3
//EntityTile *et = (EntityTile *) Tile::tiles[t];
//et->onPlace(level, this->x * 16 + x, y, this->z * 16 + z);
@@ -1316,7 +1316,7 @@ shared_ptr<TileEntity> LevelChunk::getTileEntity(int x, int y, int z)
LeaveCriticalSection(&m_csTileEntities);
return nullptr;
}
return tileEntity;
}
@@ -1631,7 +1631,7 @@ void LevelChunk::getEntitiesOfClass(const type_info& ec, AABB *bb, vector<shared
for (int yc = yc0; yc <= yc1; yc++)
{
vector<shared_ptr<Entity> > *entities = entityBlocks[yc];
AUTO_VAR(itEnd, entities->end());
for (AUTO_VAR(it, entities->begin()); it != itEnd; it++)
{
@@ -1879,7 +1879,7 @@ void LevelChunk::setCheckAllLight()
checkLightPosition = 0;
}
Random *LevelChunk::getRandom(__int64 l)
Random *LevelChunk::getRandom(int64_t l)
{
return new Random((level->getSeed() + x * x * 4987142 + x * 5947611 + z * z * 4392871l + z * 389711) ^ l);
}
@@ -2130,7 +2130,7 @@ void LevelChunk::setSkyLightDataAllBright()
void LevelChunk::compressLighting()
{
// The lighting data is now generally not shared between host & local client, but is for a while at the start of level creation (until the point where the chunk data would be transferred by network
// data for remote clients). We'll therefore either be compressing a shared copy here or one of the server or client copies depending on
// data for remote clients). We'll therefore either be compressing a shared copy here or one of the server or client copies depending on
lowerSkyLight->compress();
upperSkyLight->compress();
lowerBlockLight->compress();
@@ -2400,7 +2400,7 @@ void LevelChunk::reorderBlocksAndDataToXZY(int y0, int xs, int ys, int zs, byteA
int y1 = y0 + ys;
unsigned int tileCount = xs * ys * zs;
unsigned int halfTileCount = tileCount/2;
int sectionHeight = Level::COMPRESSED_CHUNK_SECTION_HEIGHT;
int lowerYSpan = min(y1, sectionHeight) - y0;
int upperYSpan = ys - lowerYSpan;
@@ -2439,7 +2439,7 @@ void LevelChunk::reorderBlocksAndDataToXZY(int y0, int xs, int ys, int zs, byteA
//setBlocksAndData(*data, x0, y0, z0, x1, y1, z1, p);
//// If it is a full chunk, we'll need to rearrange into the order the rest of the game expects
//if( xs == 16 && ys == 128 && zs == 16 && ( ( x & 15 ) == 0 ) && ( y == 0 ) && ( ( z & 15 ) == 0 ) )
//if( xs == 16 && ys == 128 && zs == 16 && ( ( x & 15 ) == 0 ) && ( y == 0 ) && ( ( z & 15 ) == 0 ) )
//{
// byteArray newBuffer = byteArray(81920);
// for( int x = 0; x < 16; x++ )

View File

@@ -102,13 +102,13 @@ public:
unordered_map<TilePos, shared_ptr<TileEntity>, TilePosKeyHash, TilePosKeyEq> tileEntities;
vector<shared_ptr<Entity> > **entityBlocks;
static const int sTerrainPopulatedFromHere = 2;
static const int sTerrainPopulatedFromW = 4;
static const int sTerrainPopulatedFromS = 8;
static const int sTerrainPopulatedFromSW = 16;
static const int sTerrainPopulatedAllAffecting = 30; // All the post-processing that can actually place tiles in this chunk are complete
static const int sTerrainPopulatedFromNW = 32;
static const int sTerrainPopulatedFromNW = 32;
static const int sTerrainPopulatedFromN = 64;
static const int sTerrainPopulatedFromNE = 128;
static const int sTerrainPopulatedFromE = 256;
@@ -134,8 +134,8 @@ public:
void stopSharingTilesAndData(); // 4J added
virtual void reSyncLighting(); // 4J added
void startSharingTilesAndData(int forceMs = 0); // 4J added
__int64 lastUnsharedTime; // 4J added
__int64 lastSaveTime;
int64_t lastUnsharedTime; // 4J added
int64_t lastSaveTime;
bool seenByPlayer;
#ifdef _LARGE_WORLDS
@@ -213,7 +213,7 @@ public:
virtual bool testSetBlocksAndData(byteArray data, int x0, int y0, int z0, int x1, int y1, int z1, int p); // 4J added
virtual void setCheckAllLight();
virtual Random *getRandom(__int64 l);
virtual Random *getRandom(int64_t l);
virtual bool isEmpty();
virtual void attemptCompression();
@@ -238,9 +238,9 @@ public:
byteArray getBiomes();
void setBiomes(byteArray biomes);
bool biomeHasRain(int x, int z); // 4J added
bool biomeHasSnow(int x, int z); // 4J added
bool biomeHasSnow(int x, int z); // 4J added
private:
void updateBiomeFlags(int x, int z); // 4J added
void updateBiomeFlags(int x, int z); // 4J added
public:
void compressLighting(); // 4J added
void compressBlocks(); // 4J added

View File

@@ -14,18 +14,18 @@ LevelData::LevelData(CompoundTag *tag)
{
seed = tag->getLong(L"RandomSeed");
m_pGenerator = LevelType::lvl_normal;
if (tag->contains(L"generatorName"))
if (tag->contains(L"generatorName"))
{
wstring generatorName = tag->getString(L"generatorName");
m_pGenerator = LevelType::getLevelType(generatorName);
if (m_pGenerator == NULL)
if (m_pGenerator == NULL)
{
m_pGenerator = LevelType::lvl_normal;
}
else if (m_pGenerator->hasReplacement())
}
else if (m_pGenerator->hasReplacement())
{
int generatorVersion = 0;
if (tag->contains(L"generatorVersion"))
if (tag->contains(L"generatorVersion"))
{
generatorVersion = tag->getInt(L"generatorVersion");
}
@@ -80,7 +80,7 @@ LevelData::LevelData(CompoundTag *tag)
hasBeenInCreative = tag->getBoolean(L"hasBeenInCreative"); // 4J added so we can not award achievements to levels modified in creative
// 4J added - for stronghold position
bStronghold = tag->getBoolean(L"hasStronghold");
bStronghold = tag->getBoolean(L"hasStronghold");
if(bStronghold==false)
{
@@ -95,7 +95,7 @@ LevelData::LevelData(CompoundTag *tag)
}
// 4J added - for stronghold end portal position
bStrongholdEndPortal = tag->getBoolean(L"hasStrongholdEndPortal");
bStrongholdEndPortal = tag->getBoolean(L"hasStrongholdEndPortal");
if(bStrongholdEndPortal==false)
{
@@ -111,7 +111,7 @@ LevelData::LevelData(CompoundTag *tag)
// 4J Added
m_xzSize = tag->getInt(L"XZSize");
m_hellScale = tag->getInt(L"HellScale");
m_xzSize = min(m_xzSize,LEVEL_MAX_WIDTH);
m_xzSize = max(m_xzSize,LEVEL_MIN_WIDTH);
@@ -126,20 +126,20 @@ LevelData::LevelData(CompoundTag *tag)
}
/* 4J - we don't store this anymore
if (tag->contains(L"Player"))
if (tag->contains(L"Player"))
{
loadedPlayerTag = tag->getCompound(L"Player");
dimension = loadedPlayerTag->getInt(L"Dimension");
}
else
{
{
this->loadedPlayerTag = NULL;
}
*/
dimension = 0;
}
LevelData::LevelData(LevelSettings *levelSettings, const wstring& levelName)
LevelData::LevelData(LevelSettings *levelSettings, const wstring& levelName)
{
this->seed = levelSettings->getSeed();
this->gameType = levelSettings->getGameType();
@@ -149,7 +149,7 @@ LevelData::LevelData(LevelSettings *levelSettings, const wstring& levelName)
this->m_pGenerator = levelSettings->getLevelType();
this->hardcore = levelSettings->isHardcore();
// 4J Stu - Default initers
// 4J Stu - Default initers
this->xSpawn = 0;
this->ySpawn = 0;
this->zSpawn = 0;
@@ -179,7 +179,7 @@ LevelData::LevelData(LevelSettings *levelSettings, const wstring& levelName)
this->bStrongholdEndPortal = false;
m_xzSize = levelSettings->getXZSize();
m_hellScale = levelSettings->getHellScale();
m_xzSize = min(m_xzSize,LEVEL_MAX_WIDTH);
m_xzSize = max(m_xzSize,LEVEL_MIN_WIDTH);
@@ -243,13 +243,13 @@ CompoundTag *LevelData::createTag()
return tag;
}
CompoundTag *LevelData::createTag(vector<shared_ptr<Player> > *players)
CompoundTag *LevelData::createTag(vector<shared_ptr<Player> > *players)
{
// 4J - removed all code for storing tags for players
return createTag();
}
void LevelData::setTagData(CompoundTag *tag)
void LevelData::setTagData(CompoundTag *tag)
{
tag->putLong(L"RandomSeed", seed);
tag->putString(L"generatorName", m_pGenerator->getGeneratorName());
@@ -287,17 +287,17 @@ void LevelData::setTagData(CompoundTag *tag)
tag->putInt(L"HellScale", m_hellScale);
}
__int64 LevelData::getSeed()
int64_t LevelData::getSeed()
{
return seed;
}
int LevelData::getXSpawn()
int LevelData::getXSpawn()
{
return xSpawn;
}
int LevelData::getYSpawn()
int LevelData::getYSpawn()
{
return ySpawn;
}
@@ -307,7 +307,7 @@ int LevelData::getZSpawn()
return zSpawn;
}
int LevelData::getXStronghold()
int LevelData::getXStronghold()
{
return xStronghold;
}
@@ -318,7 +318,7 @@ int LevelData::getZStronghold()
return zStronghold;
}
int LevelData::getXStrongholdEndPortal()
int LevelData::getXStrongholdEndPortal()
{
return xStrongholdEndPortal;
}
@@ -329,12 +329,12 @@ int LevelData::getZStrongholdEndPortal()
return zStrongholdEndPortal;
}
__int64 LevelData::getTime()
int64_t LevelData::getTime()
{
return time;
}
__int64 LevelData::getSizeOnDisk()
int64_t LevelData::getSizeOnDisk()
{
return sizeOnDisk;
}
@@ -350,7 +350,7 @@ CompoundTag *LevelData::getLoadedPlayerTag()
// return dimension;
//}
void LevelData::setSeed(__int64 seed)
void LevelData::setSeed(int64_t seed)
{
this->seed = seed;
}
@@ -360,7 +360,7 @@ void LevelData::setXSpawn(int xSpawn)
this->xSpawn = xSpawn;
}
void LevelData::setYSpawn(int ySpawn)
void LevelData::setYSpawn(int ySpawn)
{
this->ySpawn = ySpawn;
}
@@ -411,12 +411,12 @@ void LevelData::setZStrongholdEndPortal(int zStrongholdEndPortal)
this->zStrongholdEndPortal = zStrongholdEndPortal;
}
void LevelData::setTime(__int64 time)
void LevelData::setTime(int64_t time)
{
this->time = time;
}
void LevelData::setSizeOnDisk(__int64 sizeOnDisk)
void LevelData::setSizeOnDisk(int64_t sizeOnDisk)
{
this->sizeOnDisk = sizeOnDisk;
}
@@ -428,7 +428,7 @@ void LevelData::setLoadedPlayerTag(CompoundTag *loadedPlayerTag)
}
// 4J Remove TU9 as it's never used
//void LevelData::setDimension(int dimension)
//void LevelData::setDimension(int dimension)
//{
// this->dimension = dimension;
//}
@@ -440,7 +440,7 @@ void LevelData::setSpawn(int xSpawn, int ySpawn, int zSpawn)
this->zSpawn = zSpawn;
}
wstring LevelData::getLevelName()
wstring LevelData::getLevelName()
{
return levelName;
}
@@ -450,7 +450,7 @@ void LevelData::setLevelName(const wstring& levelName)
this->levelName = levelName;
}
int LevelData::getVersion()
int LevelData::getVersion()
{
return version;
}
@@ -460,7 +460,7 @@ void LevelData::setVersion(int version)
this->version = version;
}
__int64 LevelData::getLastPlayed()
int64_t LevelData::getLastPlayed()
{
return lastPlayed;
}
@@ -485,7 +485,7 @@ void LevelData::setThunderTime(int thunderTime)
this->thunderTime = thunderTime;
}
bool LevelData::isRaining()
bool LevelData::isRaining()
{
return raining;
}
@@ -543,12 +543,12 @@ void LevelData::setHasBeenInCreative(bool value)
hasBeenInCreative = value;
}
LevelType *LevelData::getGenerator()
LevelType *LevelData::getGenerator()
{
return m_pGenerator;
}
void LevelData::setGenerator(LevelType *generator)
void LevelData::setGenerator(LevelType *generator)
{
m_pGenerator = generator;
}

View File

@@ -11,14 +11,14 @@ class LevelData
{
friend class DerivedLevelData;
private:
__int64 seed;
int64_t seed;
LevelType *m_pGenerator;// = LevelType.normal;
int xSpawn;
int ySpawn;
int zSpawn;
__int64 time;
__int64 lastPlayed;
__int64 sizeOnDisk;
int64_t time;
int64_t lastPlayed;
int64_t sizeOnDisk;
// CompoundTag *loadedPlayerTag; // 4J removed
int dimension;
wstring levelName;
@@ -71,7 +71,7 @@ protected:
virtual void setTagData(CompoundTag *tag); // 4J - removed CompoundTag *playerTag
public:
virtual __int64 getSeed();
virtual int64_t getSeed();
virtual int getXSpawn();
virtual int getYSpawn();
virtual int getZSpawn();
@@ -79,11 +79,11 @@ public:
virtual int getZStronghold();
virtual int getXStrongholdEndPortal();
virtual int getZStrongholdEndPortal();
virtual __int64 getTime();
virtual __int64 getSizeOnDisk();
virtual int64_t getTime();
virtual int64_t getSizeOnDisk();
virtual CompoundTag *getLoadedPlayerTag();
//int getDimension(); // 4J Removed TU 9 as it's never accurate
virtual void setSeed(__int64 seed);
virtual void setSeed(int64_t seed);
virtual void setXSpawn(int xSpawn);
virtual void setYSpawn(int ySpawn);
virtual void setZSpawn(int zSpawn);
@@ -96,8 +96,8 @@ public:
virtual void setXStrongholdEndPortal(int xStrongholdEndPortal);
virtual void setZStrongholdEndPortal(int zStrongholdEndPortal);
virtual void setTime(__int64 time);
virtual void setSizeOnDisk(__int64 sizeOnDisk);
virtual void setTime(int64_t time);
virtual void setSizeOnDisk(int64_t sizeOnDisk);
virtual void setLoadedPlayerTag(CompoundTag *loadedPlayerTag);
//void setDimension(int dimension); // 4J Removed TU 9 as it's never used
virtual void setSpawn(int xSpawn, int ySpawn, int zSpawn);
@@ -105,7 +105,7 @@ public:
virtual void setLevelName(const wstring& levelName);
virtual int getVersion();
virtual void setVersion(int version);
virtual __int64 getLastPlayed();
virtual int64_t getLastPlayed();
virtual bool isThundering();
virtual void setThundering(bool thundering);
virtual int getThunderTime();

View File

@@ -85,7 +85,7 @@ GameType *GameType::byName(const wstring &name)
return SURVIVAL;
}
void LevelSettings::_init(__int64 seed, GameType *gameType, bool generateMapFeatures, bool hardcore, bool newSeaLevel, LevelType *levelType, int xzSize, int hellScale)
void LevelSettings::_init(int64_t seed, GameType *gameType, bool generateMapFeatures, bool hardcore, bool newSeaLevel, LevelType *levelType, int xzSize, int hellScale)
{
this->seed = seed;
this->gameType = gameType;
@@ -99,11 +99,11 @@ void LevelSettings::_init(__int64 seed, GameType *gameType, bool generateMapFeat
m_hellScale = hellScale;
}
LevelSettings::LevelSettings(__int64 seed, GameType *gameType, bool generateMapFeatures, bool hardcore, bool newSeaLevel, LevelType *levelType, int xzSize, int hellScale) :
seed(seed),
gameType(gameType),
LevelSettings::LevelSettings(int64_t seed, GameType *gameType, bool generateMapFeatures, bool hardcore, bool newSeaLevel, LevelType *levelType, int xzSize, int hellScale) :
seed(seed),
gameType(gameType),
hardcore(hardcore),
generateMapFeatures(generateMapFeatures),
generateMapFeatures(generateMapFeatures),
newSeaLevel(newSeaLevel),
levelType(levelType),
startingBonusItems(false)
@@ -133,7 +133,7 @@ bool LevelSettings::hasStartingBonusItems()
return startingBonusItems;
}
__int64 LevelSettings::getSeed()
int64_t LevelSettings::getSeed()
{
return seed;
}
@@ -148,7 +148,7 @@ bool LevelSettings::isHardcore()
return hardcore;
}
LevelType *LevelSettings::getLevelType()
LevelType *LevelSettings::getLevelType()
{
return levelType;
}

View File

@@ -35,7 +35,7 @@ public:
class LevelSettings
{
private:
__int64 seed;
int64_t seed;
GameType *gameType;
bool generateMapFeatures;
bool hardcore;
@@ -46,15 +46,15 @@ private:
int m_xzSize; // 4J Added
int m_hellScale;
void _init(__int64 seed, GameType *gameType, bool generateMapFeatures, bool hardcore, bool newSeaLevel, LevelType *levelType, int xzSize, int hellScale); // 4J Added xzSize and hellScale param
void _init(int64_t seed, GameType *gameType, bool generateMapFeatures, bool hardcore, bool newSeaLevel, LevelType *levelType, int xzSize, int hellScale); // 4J Added xzSize and hellScale param
public:
LevelSettings(__int64 seed, GameType *gameType, bool generateMapFeatures, bool hardcore, bool newSeaLevel, LevelType *levelType, int xzSize, int hellScale); // 4J Added xzSize and hellScale param
LevelSettings(int64_t seed, GameType *gameType, bool generateMapFeatures, bool hardcore, bool newSeaLevel, LevelType *levelType, int xzSize, int hellScale); // 4J Added xzSize and hellScale param
LevelSettings(LevelData *levelData);
LevelSettings *enableStartingBonusItems(); // 4J - brought forward from 1.3.2
LevelSettings *enableSinglePlayerCommands();
bool hasStartingBonusItems(); // 4J - brought forward from 1.3.2
__int64 getSeed();
int64_t getSeed();
GameType *getGameType();
bool isHardcore();
LevelType *getLevelType();

View File

@@ -1,7 +1,7 @@
#include "stdafx.h"
#include "LevelSummary.h"
LevelSummary::LevelSummary(const wstring& levelId, const wstring& levelName, __int64 lastPlayed, __int64 sizeOnDisk, GameType *gameMode, bool requiresConversion, bool hardcore, bool hasCheats) :
LevelSummary::LevelSummary(const wstring& levelId, const wstring& levelName, int64_t lastPlayed, int64_t sizeOnDisk, GameType *gameMode, bool requiresConversion, bool hardcore, bool hasCheats) :
levelId( levelId ),
levelName( levelName ),
lastPlayed( lastPlayed ),
@@ -13,7 +13,7 @@ LevelSummary::LevelSummary(const wstring& levelId, const wstring& levelName, __i
{
}
wstring LevelSummary::getLevelId()
wstring LevelSummary::getLevelId()
{
return levelId;
}
@@ -23,28 +23,28 @@ wstring LevelSummary::getLevelName()
return levelName;
}
__int64 LevelSummary::getSizeOnDisk()
int64_t LevelSummary::getSizeOnDisk()
{
return sizeOnDisk;
}
bool LevelSummary::isRequiresConversion()
bool LevelSummary::isRequiresConversion()
{
return requiresConversion;
}
__int64 LevelSummary::getLastPlayed()
int64_t LevelSummary::getLastPlayed()
{
return lastPlayed;
}
int LevelSummary::compareTo(LevelSummary *rhs)
int LevelSummary::compareTo(LevelSummary *rhs)
{
if (lastPlayed < rhs->lastPlayed)
{
return 1;
}
if (lastPlayed > rhs->lastPlayed)
if (lastPlayed > rhs->lastPlayed)
{
return -1;
}

View File

@@ -7,20 +7,20 @@ class LevelSummary
{
const wstring levelId;
const wstring levelName;
const __int64 lastPlayed;
const __int64 sizeOnDisk;
const int64_t lastPlayed;
const int64_t sizeOnDisk;
const bool requiresConversion;
GameType *gameMode;
const bool hardcore;
const bool _hasCheats;
public:
LevelSummary(const wstring& levelId, const wstring& levelName, __int64 lastPlayed, __int64 sizeOnDisk, GameType *gameMode, bool requiresConversion, bool hardcore, bool hasCheats);
LevelSummary(const wstring& levelId, const wstring& levelName, int64_t lastPlayed, int64_t sizeOnDisk, GameType *gameMode, bool requiresConversion, bool hardcore, bool hasCheats);
wstring getLevelId();
wstring getLevelName();
__int64 getSizeOnDisk();
int64_t getSizeOnDisk();
bool isRequiresConversion();
__int64 getLastPlayed();
int64_t getLastPlayed();
int compareTo(LevelSummary *rhs);
GameType *getGameMode();
bool isHardcore();

View File

@@ -16,7 +16,7 @@ private:
int life;
public:
__int64 seed;
int64_t seed;
private:
int flashes;

View File

@@ -66,7 +66,7 @@ LoginPacket::LoginPacket(const wstring& userName, int clientVersion, PlayerUID o
}
// Server -> Client
LoginPacket::LoginPacket(const wstring& userName, int clientVersion, LevelType *pLevelType, __int64 seed, int gameType, char dimension, BYTE mapHeight, BYTE maxPlayers, char difficulty, INT multiplayerInstanceId, BYTE playerIndex, bool newSeaLevel, unsigned int uiGamePrivileges, int xzSize, int hellScale)
LoginPacket::LoginPacket(const wstring& userName, int clientVersion, LevelType *pLevelType, int64_t seed, int gameType, char dimension, BYTE mapHeight, BYTE maxPlayers, char difficulty, INT multiplayerInstanceId, BYTE playerIndex, bool newSeaLevel, unsigned int uiGamePrivileges, int xzSize, int hellScale)
{
this->userName = userName;
this->clientVersion = clientVersion;
@@ -94,13 +94,13 @@ LoginPacket::LoginPacket(const wstring& userName, int clientVersion, LevelType *
m_hellScale = hellScale;
}
void LoginPacket::read(DataInputStream *dis) //throws IOException
void LoginPacket::read(DataInputStream *dis) //throws IOException
{
clientVersion = dis->readInt();
userName = readUtf(dis, Player::MAX_NAME_LENGTH);
wstring typeName = readUtf(dis, 16);
m_pLevelType = LevelType::getLevelType(typeName);
if (m_pLevelType == NULL)
if (m_pLevelType == NULL)
{
m_pLevelType = LevelType::lvl_normal;
}
@@ -131,15 +131,15 @@ void LoginPacket::read(DataInputStream *dis) //throws IOException
}
void LoginPacket::write(DataOutputStream *dos) //throws IOException
void LoginPacket::write(DataOutputStream *dos) //throws IOException
{
dos->writeInt(clientVersion);
writeUtf(userName, dos);
if (m_pLevelType == NULL)
if (m_pLevelType == NULL)
{
writeUtf(L"", dos);
}
else
}
else
{
writeUtf(m_pLevelType->getGeneratorName(), dos);
}
@@ -171,13 +171,13 @@ void LoginPacket::handle(PacketListener *listener)
listener->handleLogin(shared_from_this());
}
int LoginPacket::getEstimatedSize()
int LoginPacket::getEstimatedSize()
{
int length=0;
if (m_pLevelType != NULL)
if (m_pLevelType != NULL)
{
length = (int)m_pLevelType->getGeneratorName().length();
}
return (int)(sizeof(int) + userName.length() + 4 + 6 + sizeof(__int64) + sizeof(char) + sizeof(int) + (2*sizeof(PlayerUID)) +1 + sizeof(char) + sizeof(BYTE) + sizeof(bool) + sizeof(bool) + length + sizeof(unsigned int));
return (int)(sizeof(int) + userName.length() + 4 + 6 + sizeof(int64_t) + sizeof(char) + sizeof(int) + (2*sizeof(PlayerUID)) +1 + sizeof(char) + sizeof(BYTE) + sizeof(bool) + sizeof(bool) + length + sizeof(unsigned int));
}

View File

@@ -9,10 +9,10 @@ class LoginPacket : public Packet, public enable_shared_from_this<LoginPacket>
public:
int clientVersion;
wstring userName;
__int64 seed;
int64_t seed;
char dimension;
PlayerUID m_offlineXuid, m_onlineXuid; // 4J Added
char difficulty; // 4J Added
char difficulty; // 4J Added
bool m_friendsOnlyUGC; // 4J Added
DWORD m_ugcPlayersVersion; // 4J Added
INT m_multiplayerInstanceId; //4J Added for sentient
@@ -31,7 +31,7 @@ public:
BYTE maxPlayers;
LoginPacket();
LoginPacket(const wstring& userName, int clientVersion, LevelType *pLevelType, __int64 seed, int gameType, char dimension, BYTE mapHeight, BYTE maxPlayers, char difficulty, INT m_multiplayerInstanceId, BYTE playerIndex, bool newSeaLevel, unsigned int uiGamePrivileges, int xzSize, int hellScale); // Server -> Client
LoginPacket(const wstring& userName, int clientVersion, LevelType *pLevelType, int64_t seed, int gameType, char dimension, BYTE mapHeight, BYTE maxPlayers, char difficulty, INT m_multiplayerInstanceId, BYTE playerIndex, bool newSeaLevel, unsigned int uiGamePrivileges, int xzSize, int hellScale); // Server -> Client
LoginPacket(const wstring& userName, int clientVersion, PlayerUID offlineXuid, PlayerUID onlineXuid, bool friendsOnlyUGC, DWORD ugcPlayersVersion, DWORD skinId, DWORD capeId, bool isGuest); // Client -> Server
virtual void read(DataInputStream *dis);

View File

@@ -4,10 +4,10 @@
class LongTag : public Tag
{
public:
__int64 data;
int64_t data;
LongTag(const wstring &name) : Tag(name) {}
LongTag(const wstring &name, __int64 data) : Tag(name) {this->data = data; }
LongTag(const wstring &name, int64_t data) : Tag(name) {this->data = data; }
void write(DataOutput *dos) { dos->writeLong(data); }
void load(DataInput *dis) { data = dis->readLong(); }

View File

@@ -32,7 +32,7 @@ McRegionChunkStorage::McRegionChunkStorage(ConsoleSaveFile *saveFile, const wstr
m_saveFile->createFile(ConsoleSavePath(L"r.-1.0.mcr"));
}
#ifdef SPLIT_SAVES
ConsoleSavePath currentFile = ConsoleSavePath( m_prefix + wstring( L"entities.dat" ) );
@@ -45,7 +45,7 @@ McRegionChunkStorage::McRegionChunkStorage(ConsoleSaveFile *saveFile, const wstr
for(int i = 0; i < count; ++i)
{
__int64 index = dis.readLong();
int64_t index = dis.readLong();
CompoundTag *tag = NbtIo::read(&dis);
ByteArrayOutputStream bos;
@@ -78,7 +78,7 @@ LevelChunk *McRegionChunkStorage::load(Level *level, int x, int z)
// If we can't find the chunk in the save file, then we should remove any entities we might have for that chunk
if(regionChunkInputStream == NULL)
{
__int64 index = ((__int64)(x) << 32) | (((__int64)(z))&0x00000000FFFFFFFF);
int64_t index = ((int64_t)(x) << 32) | (((int64_t)(z))&0x00000000FFFFFFFF);
AUTO_VAR(it, m_entityData.find(index));
if(it != m_entityData.end())
@@ -235,7 +235,7 @@ void McRegionChunkStorage::saveEntities(Level *level, LevelChunk *levelChunk)
{
#ifdef SPLIT_SAVES
PIXBeginNamedEvent(0,"Saving entities");
__int64 index = ((__int64)(levelChunk->x) << 32) | (((__int64)(levelChunk->z))&0x00000000FFFFFFFF);
int64_t index = ((int64_t)(levelChunk->x) << 32) | (((int64_t)(levelChunk->z))&0x00000000FFFFFFFF);
delete m_entityData[index].data;
@@ -269,8 +269,8 @@ void McRegionChunkStorage::saveEntities(Level *level, LevelChunk *levelChunk)
void McRegionChunkStorage::loadEntities(Level *level, LevelChunk *levelChunk)
{
#ifdef SPLIT_SAVES
__int64 index = ((__int64)(levelChunk->x) << 32) | (((__int64)(levelChunk->z))&0x00000000FFFFFFFF);
int64_t index = ((int64_t)(levelChunk->x) << 32) | (((int64_t)(levelChunk->z))&0x00000000FFFFFFFF);
AUTO_VAR(it, m_entityData.find(index));
if(it != m_entityData.end())
{

View File

@@ -16,7 +16,7 @@ private:
ConsoleSaveFile *m_saveFile;
static CRITICAL_SECTION cs_memory;
unordered_map<__int64, byteArray> m_entityData;
unordered_map<int64_t, byteArray> m_entityData;
static std::deque<DataOutputStream *> s_chunkDataQueue;
static int s_runningThreadCount;

View File

@@ -50,9 +50,9 @@ int Mth::floor(float v)
return v < i ? i - 1 : i;
}
__int64 Mth::lfloor(double v)
int64_t Mth::lfloor(double v)
{
__int64 i = (__int64) v;
int64_t i = (int64_t) v;
return v < i ? i - 1 : i;
}

View File

@@ -22,7 +22,7 @@ public :
static float sqrt(float x);
static float sqrt(double x);
static int floor(float v);
static __int64 lfloor(double v);
static int64_t lfloor(double v);
static int fastFloor(double x);
static int floor(double v);
static int absFloor(double v);

View File

@@ -4,7 +4,7 @@
byteArray NbtSlotFile::READ_BUFFER(1024*1024);
__int64 NbtSlotFile::largest = 0;
int64_t NbtSlotFile::largest = 0;
NbtSlotFile::NbtSlotFile(File file)
{
@@ -144,12 +144,12 @@ int NbtSlotFile::getFreeSlot()
// fileSlot = toReplace->back();
// toReplace->pop_back();
// } else
if (freeFileSlots.size() > 0)
{
fileSlot = freeFileSlots.back();
freeFileSlots.pop_back();
}
}
else
{
fileSlot = totalFileSlots++;
@@ -164,7 +164,7 @@ void NbtSlotFile::replaceSlot(int slot, vector<CompoundTag *> *tags)
DWORD numberOfBytesWritten;
toReplace = fileSlotMap[slot];
fileSlotMap[slot] = new vector<int>();
AUTO_VAR(itEndTags, tags->end());
for (AUTO_VAR(it, tags->begin()); it != itEndTags; it++)
{
@@ -227,7 +227,7 @@ void NbtSlotFile::replaceSlot(int slot, vector<CompoundTag *> *tags)
}
delete[] compressed.data;
}
AUTO_VAR(itEndToRep, toReplace->end());
for (AUTO_VAR(it, toReplace->begin()); it != itEndToRep; it++)
{

View File

@@ -19,7 +19,7 @@ private:
int fileSlotMapLength;
vector<int> freeFileSlots;
int totalFileSlots;
static __int64 largest;
static int64_t largest;
public:
NbtSlotFile(File file);

View File

@@ -121,7 +121,7 @@ void NotGateTile::tick(Level *level, int x, int y, int z, Random *random)
}
}
if (on)
if (on)
{
if (neighborSignal)
{
@@ -152,7 +152,7 @@ void NotGateTile::tick(Level *level, int x, int y, int z, Random *random)
level->setTileAndData(x, y, z, Tile::notGate_on_Id, level->getData(x, y, z));
}
else
{
{
app.DebugPrintf("Torch at (%d,%d,%d) has toggled too many times\n",x,y,z);
}
}
@@ -221,7 +221,7 @@ int NotGateTile::cloneTileId(Level *level, int x, int y, int z)
return Tile::notGate_on_Id;
}
void NotGateTile::levelTimeChanged(Level *level, __int64 delta, __int64 newTime)
void NotGateTile::levelTimeChanged(Level *level, int64_t delta, int64_t newTime)
{
deque<Toggle> *toggles = recentToggles[level];

View File

@@ -19,9 +19,9 @@ public:
{
public:
int x, y, z;
__int64 when;
int64_t when;
Toggle(int x, int y, int z, __int64 when)
Toggle(int x, int y, int z, int64_t when)
{
this->x = x;
this->y = y;
@@ -61,7 +61,7 @@ public:
public:
void animateTick(Level *level, int xt, int yt, int zt, Random *random);
int cloneTileId(Level *level, int x, int y, int z);
void levelTimeChanged(Level *level, __int64 delta, __int64 newTime);
void levelTimeChanged(Level *level, int64_t delta, int64_t newTime);
void registerIcons(IconRegister *iconRegister);
};

View File

@@ -103,7 +103,7 @@ File OldChunkStorage::getFile(int x, int z)
file = File( file, wstring( name ) );
if ( !file.exists() )
{
if (!create)
if (!create)
{
return File(L"");
}
@@ -163,7 +163,7 @@ void OldChunkStorage::save(Level *level, LevelChunk *levelChunk)
{
LevelData *levelData = level->getLevelData();
levelData->setSizeOnDisk( levelData->getSizeOnDisk() - file.length() );
}
}
// 4J - removed try/catch
// try {
@@ -202,7 +202,7 @@ bool OldChunkStorage::saveEntities(LevelChunk *lc, Level *level, CompoundTag *ta
lc->lastSaveHadEntities = false;
ListTag<CompoundTag> *entityTags = new ListTag<CompoundTag>();
#ifdef _ENTITIES_RW_SECTION
EnterCriticalRWSection(&lc->m_csEntities, true);
#else
@@ -263,7 +263,7 @@ void OldChunkStorage::save(LevelChunk *lc, Level *level, DataOutputStream *dos)
#ifndef SPLIT_SAVES
saveEntities(lc, level, tag);
#endif
PIXBeginNamedEvent(0,"Saving tile entities");
ListTag<CompoundTag> *tileEntityTags = new ListTag<CompoundTag>();
@@ -283,7 +283,7 @@ void OldChunkStorage::save(LevelChunk *lc, Level *level, DataOutputStream *dos)
vector<TickNextTickData > *ticksInChunk = level->fetchTicksInChunk(lc, false);
if (ticksInChunk != NULL)
{
__int64 levelTime = level->getTime();
int64_t levelTime = level->getTime();
ListTag<CompoundTag> *tickTags = new ListTag<CompoundTag>();
for( int i = 0; i < ticksInChunk->size(); i++ )
@@ -372,7 +372,7 @@ void OldChunkStorage::save(LevelChunk *lc, Level *level, CompoundTag *tag)
vector<TickNextTickData > *ticksInChunk = level->fetchTicksInChunk(lc, false);
if (ticksInChunk != NULL)
{
__int64 levelTime = level->getTime();
int64_t levelTime = level->getTime();
ListTag<CompoundTag> *tickTags = new ListTag<CompoundTag>();
for( int i = 0; i < ticksInChunk->size(); i++ )
@@ -442,7 +442,7 @@ LevelChunk *OldChunkStorage::load(Level *level, DataInputStream *dis)
dis->readFully(levelChunk->heightmap);
levelChunk->terrainPopulated = dis->readShort();
levelChunk->terrainPopulated = dis->readShort();
// If all neighbours have been post-processed, then we should have done the post-post-processing now. Check that this is set as if it isn't then we won't be able
// to send network data for chunks, and we won't ever try and set it again as all the directional flags are now already set - should only be an issue for old maps
// before this flag was added.
@@ -512,13 +512,13 @@ LevelChunk *OldChunkStorage::load(Level *level, CompoundTag *tag)
if( tag->get(L"TerrainPopulated") )
{
// Java bool type or byte bitfield
levelChunk->terrainPopulated = tag->getByte(L"TerrainPopulated");
levelChunk->terrainPopulated = tag->getByte(L"TerrainPopulated");
if( levelChunk->terrainPopulated >= 1 ) levelChunk->terrainPopulated = LevelChunk::sTerrainPopulatedAllNeighbours | LevelChunk::sTerrainPostPostProcessed; // Convert from old bool type to new bitfield
}
else
{
// New style short
levelChunk->terrainPopulated = tag->getShort(L"TerrainPopulatedFlags");
levelChunk->terrainPopulated = tag->getShort(L"TerrainPopulatedFlags");
// If all neighbours have been post-processed, then we should have done the post-post-processing now. Check that this is set as if it isn't then we won't be able
// to send network data for chunks, and we won't ever try and set it again as all the directional flags are now already set - should only be an issue for old maps
// before this flag was added.

View File

@@ -30,7 +30,7 @@ void Packet::staticCtor()
map(8, true, false, true, true, typeid(SetHealthPacket), SetHealthPacket::create);
map(9, true, true, true, false, typeid(RespawnPacket), RespawnPacket::create);
map(10, true, true, true, false, typeid(MovePlayerPacket), MovePlayerPacket::create);
map(10, true, true, true, false, typeid(MovePlayerPacket), MovePlayerPacket::create);
map(11, true, true, true, true, typeid(MovePlayerPacket::Pos), MovePlayerPacket::Pos::create);
map(12, true, true, true, true, typeid(MovePlayerPacket::Rot), MovePlayerPacket::Rot::create);
map(13, true, true, true, true, typeid(MovePlayerPacket::PosRot), MovePlayerPacket::PosRot::create);
@@ -254,7 +254,7 @@ void Packet::renderAllPacketStats()
void Packet::renderAllPacketStatsKey()
{
#ifndef _CONTENT_PACKAGE
#ifndef _CONTENT_PACKAGE
#if PACKET_ENABLE_STAT_TRACKING
Minecraft *pMinecraft = Minecraft::GetInstance();
int total = Packet::renderableStats.size();
@@ -271,9 +271,9 @@ void Packet::renderAllPacketStatsKey()
#endif
}
__int64 Packet::getIndexedStatValue(unsigned int samplePos, unsigned int renderableId)
int64_t Packet::getIndexedStatValue(unsigned int samplePos, unsigned int renderableId)
{
__int64 val = 0;
int64_t val = 0;
#ifndef _CONTENT_PACKAGE
#if PACKET_ENABLE_STAT_TRACKING
@@ -285,13 +285,13 @@ __int64 Packet::getIndexedStatValue(unsigned int samplePos, unsigned int rendera
}
shared_ptr<Packet> Packet::getPacket(int id)
shared_ptr<Packet> Packet::getPacket(int id)
{
// 4J - removed try/catch
// try
// {
return idToCreateMap[id]();
// }
// }
// catch (exception e)
// {
// // TODO 4J JEV print stack trace, newInstance doesnt throw an exception in c++ yet.
@@ -366,11 +366,11 @@ shared_ptr<Packet> Packet::readPacket(DataInputStream *dis, bool isServer) // th
packet = getPacket(id);
if (packet == NULL) assert(false);//throw new IOException(wstring(L"Bad packet id ") + _toString<int>(id));
//app.DebugPrintf("%s reading packet %d\n", isServer ? "Server" : "Client", packet->getId());
packet->read(dis);
// }
// catch (EOFException e)
// catch (EOFException e)
// {
// // reached end of stream
// OutputDebugString("Reached end of stream");
@@ -409,7 +409,7 @@ void Packet::writePacket(shared_ptr<Packet> packet, DataOutputStream *dos) // th
void Packet::writeUtf(const wstring& value, DataOutputStream *dos) // throws IOException TODO 4J JEV, should this declare a throws?
{
#if 0
if (value.length() > Short::MAX_VALUE)
if (value.length() > Short::MAX_VALUE)
{
throw new IOException(L"String too big");
}
@@ -437,7 +437,7 @@ wstring Packet::readUtf(DataInputStream *dis, int maxLength) // throws IOExcepti
}
wstring builder = L"";
for (int i = 0; i < stringLength; i++)
for (int i = 0; i < stringLength; i++)
{
wchar_t rc = dis->readChar();
builder.push_back( rc );
@@ -455,12 +455,12 @@ void Packet::PacketStatistics::addPacket(int bytes)
count++;
totalSize += bytes;
// 4J Added
// 4J Added
countSamples[samplesPos & (512 - 1)]++;
sizeSamples[samplesPos & (512 - 1)] += (unsigned int) bytes;
}
int Packet::PacketStatistics::getCount()
int Packet::PacketStatistics::getCount()
{
return count;
}
@@ -489,7 +489,7 @@ void Packet::PacketStatistics::renderStats( )
#endif
}
__int64 Packet::PacketStatistics::getCountSample(int samplePos)
int64_t Packet::PacketStatistics::getCountSample(int samplePos)
{
if(samplePos == 511)
{

View File

@@ -15,17 +15,17 @@ typedef shared_ptr<Packet> (*packetCreateFn)();
class Packet
{
public:
class PacketStatistics
class PacketStatistics
{
private:
int count;
int totalSize;
// 4J Added
__int64 countSamples[512];
__int64 sizeSamples[512];
int64_t countSamples[512];
int64_t sizeSamples[512];
int samplesPos;
__int64 firstSampleTime;
int64_t firstSampleTime;
public:
@@ -39,7 +39,7 @@ public:
// 4J Added
void renderStats();
__int64 getCountSample(int samplePos);
int64_t getCountSample(int samplePos);
wstring getLegendString();
};
@@ -58,7 +58,7 @@ public:
static void map(int id, bool receiveOnClient, bool receiveOnServer, bool sendToAnyClient, bool renderStats, const type_info& clazz, packetCreateFn );
public:
const __int64 createTime;
const int64_t createTime;
Packet();
@@ -84,7 +84,7 @@ public:
static void renderPacketStats(int id);
static void renderAllPacketStats();
static void renderAllPacketStatsKey();
static __int64 getIndexedStatValue(unsigned int samplePos, unsigned int renderableId);
static int64_t getIndexedStatValue(unsigned int samplePos, unsigned int renderableId);
private :
static unordered_map<int, PacketStatistics *> statistics;

View File

@@ -77,8 +77,8 @@ doubleArray PerlinNoise::getRegion(doubleArray buffer, int x, int y, int z, int
double xx = x * pow * xScale;
double yy = y * pow * yScale;
double zz = z * pow * zScale;
__int64 xb = Mth::lfloor(xx);
__int64 zb = Mth::lfloor(zz);
int64_t xb = Mth::lfloor(xx);
int64_t zb = Mth::lfloor(zz);
xx -= xb;
zz -= zb;
xb %= 16777216;

Some files were not shown because too many files have changed in this diff Show More