mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-08-20 09:57:10 +00:00
new batch of delete operator missmatch
This commit is contained in:
parent
10ee2085ff
commit
66b31669c3
|
|
@ -285,12 +285,12 @@ __int64 ConsoleSchematicFile::applyBlocksAndData(LevelChunk *chunk, AABB *chunkB
|
||||||
PIXBeginNamedEvent(0,"Setting Block data");
|
PIXBeginNamedEvent(0,"Setting Block data");
|
||||||
chunk->setBlockData(blockData);
|
chunk->setBlockData(blockData);
|
||||||
PIXEndNamedEvent();
|
PIXEndNamedEvent();
|
||||||
delete blockData.data;
|
delete[] blockData.data; //4jcraft changed to array delete
|
||||||
chunk->recalcHeightmapOnly();
|
chunk->recalcHeightmapOnly();
|
||||||
PIXBeginNamedEvent(0,"Setting Data data");
|
PIXBeginNamedEvent(0,"Setting Data data");
|
||||||
chunk->setDataData(dataData);
|
chunk->setDataData(dataData);
|
||||||
PIXEndNamedEvent();
|
PIXEndNamedEvent();
|
||||||
delete dataData.data;
|
delete[] dataData.data; //4jcraft, same here
|
||||||
|
|
||||||
// A basic pass through to roughly do the lighting. At this point of post-processing, we don't have all the neighbouring chunks loaded in,
|
// A basic pass through to roughly do the lighting. At this point of post-processing, we don't have all the neighbouring chunks loaded in,
|
||||||
// so any lighting here should be things that won't propagate out of this chunk.
|
// so any lighting here should be things that won't propagate out of this chunk.
|
||||||
|
|
|
||||||
|
|
@ -19,4 +19,4 @@ public:
|
||||||
~LookAtTileHint();
|
~LookAtTileHint();
|
||||||
|
|
||||||
virtual bool onLookAt(int id, int iData=0);
|
virtual bool onLookAt(int id, int iData=0);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -16,4 +16,4 @@ public:
|
||||||
~TakeItemHint();
|
~TakeItemHint();
|
||||||
|
|
||||||
virtual bool onTake( std::shared_ptr<ItemInstance> item );
|
virtual bool onTake( std::shared_ptr<ItemInstance> item );
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -50,4 +50,4 @@ public:
|
||||||
virtual bool onLookAtEntity(eINSTANCEOF type);
|
virtual bool onLookAtEntity(eINSTANCEOF type);
|
||||||
virtual int tick();
|
virtual int tick();
|
||||||
virtual bool allowFade() { return m_allowFade; }
|
virtual bool allowFade() { return m_allowFade; }
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@ TileRenderer::TileRenderer( LevelSource* level, int xMin, int yMin, int zMin, un
|
||||||
|
|
||||||
TileRenderer::~TileRenderer()
|
TileRenderer::~TileRenderer()
|
||||||
{
|
{
|
||||||
delete cache;
|
delete[] cache; //4jcraft, changed to []
|
||||||
}
|
}
|
||||||
|
|
||||||
TileRenderer::TileRenderer( LevelSource* level )
|
TileRenderer::TileRenderer( LevelSource* level )
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,11 @@ BufferedOutputStream::BufferedOutputStream(OutputStream *out, int size)
|
||||||
|
|
||||||
BufferedOutputStream::~BufferedOutputStream()
|
BufferedOutputStream::~BufferedOutputStream()
|
||||||
{
|
{
|
||||||
delete buf.data;
|
//4jcraft, changed to [], deallocates internal buffer
|
||||||
|
//TODO: ArrayWithLength.h doesnt have a destructor.
|
||||||
|
//this wouldnt need to be done manually.
|
||||||
|
//but for some reason the destructor is commented out in the source code?
|
||||||
|
delete[] buf.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Flushes this buffered output stream. This forces any buffered output bytes to be written out to the underlying output stream.
|
//Flushes this buffered output stream. This forces any buffered output bytes to be written out to the underlying output stream.
|
||||||
|
|
|
||||||
|
|
@ -342,6 +342,6 @@ std::shared_ptr<Packet> MapItem::getUpdatePacket(std::shared_ptr<ItemInstance> i
|
||||||
if (data.data == NULL || data.length == 0) return nullptr;
|
if (data.data == NULL || data.length == 0) return nullptr;
|
||||||
|
|
||||||
std::shared_ptr<Packet> retval = std::shared_ptr<Packet>(new ComplexItemDataPacket((short) Item::map->id, (short) itemInstance->getAuxValue(), data));
|
std::shared_ptr<Packet> retval = std::shared_ptr<Packet>(new ComplexItemDataPacket((short) Item::map->id, (short) itemInstance->getAuxValue(), data));
|
||||||
delete data.data;
|
delete[] data.data; //4jcraft, changed to []
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ charArray MapItemSavedData::HoldingPlayer::nextUpdatePacket(std::shared_ptr<Item
|
||||||
memcpy(lastSentDecorations.data, data.data, data.length);
|
memcpy(lastSentDecorations.data, data.data, data.length);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
delete data.data;
|
delete[] data.data; //4jcraft, changed to []
|
||||||
}
|
}
|
||||||
std::shared_ptr<ServerPlayer> servPlayer = std::dynamic_pointer_cast<ServerPlayer>(player);
|
std::shared_ptr<ServerPlayer> servPlayer = std::dynamic_pointer_cast<ServerPlayer>(player);
|
||||||
for (int d = 0; d < 10; d++)
|
for (int d = 0; d < 10; d++)
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,12 @@ AwardStatPacket::AwardStatPacket(int statId, int count)
|
||||||
{
|
{
|
||||||
this->statId = statId;
|
this->statId = statId;
|
||||||
|
|
||||||
this->m_paramData.data = (uint8_t *) new int(count);
|
// 4jcraft, changed from new int(count); to new int[1];
|
||||||
|
// and initializing the array with count
|
||||||
|
// reason: .data needs to be delete with delete[] but its
|
||||||
|
// allocated with new, not new T[]
|
||||||
|
this->m_paramData.data = (uint8_t *) new int[1];
|
||||||
|
((int*)this->m_paramData.data)[0] = count;
|
||||||
this->m_paramData.length = sizeof(int);
|
this->m_paramData.length = sizeof(int);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -30,7 +35,7 @@ AwardStatPacket::~AwardStatPacket()
|
||||||
{
|
{
|
||||||
if (m_paramData.data != NULL)
|
if (m_paramData.data != NULL)
|
||||||
{
|
{
|
||||||
delete [] m_paramData.data;
|
delete[] m_paramData.data;
|
||||||
m_paramData.data = NULL;
|
m_paramData.data = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ RemoveEntitiesPacket::RemoveEntitiesPacket(intArray ids)
|
||||||
|
|
||||||
RemoveEntitiesPacket::~RemoveEntitiesPacket()
|
RemoveEntitiesPacket::~RemoveEntitiesPacket()
|
||||||
{
|
{
|
||||||
delete ids.data;
|
delete[] ids.data; //4jcraft, changed to []
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoveEntitiesPacket::read(DataInputStream *dis) //throws IOException
|
void RemoveEntitiesPacket::read(DataInputStream *dis) //throws IOException
|
||||||
|
|
|
||||||
|
|
@ -12,14 +12,14 @@ AABB::ThreadStorage *AABB::tlsDefault = NULL;
|
||||||
|
|
||||||
AABB::ThreadStorage::ThreadStorage()
|
AABB::ThreadStorage::ThreadStorage()
|
||||||
{
|
{
|
||||||
pool = new AABB[POOL_SIZE];
|
pool = new AABB[POOL_SIZE]; //4jcraft, needs to be deleted with delete[]
|
||||||
poolPointer = 0;
|
poolPointer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AABB::ThreadStorage::~ThreadStorage()
|
AABB::ThreadStorage::~ThreadStorage()
|
||||||
{
|
{
|
||||||
delete pool;
|
delete[] pool; //4jcraft, changed to []
|
||||||
}
|
}
|
||||||
|
|
||||||
void AABB::CreateNewThreadStorage()
|
void AABB::CreateNewThreadStorage()
|
||||||
|
|
|
||||||
|
|
@ -218,7 +218,7 @@ void BiomeSource::getBiomeBlock(BiomeArray& biomes, int x, int z, int w, int h,
|
||||||
{
|
{
|
||||||
BiomeArray tmp = cache->getBiomeBlockAt(x, z);
|
BiomeArray tmp = cache->getBiomeBlockAt(x, z);
|
||||||
System::arraycopy(tmp, 0, &biomes, 0, w * h);
|
System::arraycopy(tmp, 0, &biomes, 0, w * h);
|
||||||
delete tmp.data; // MGH - added, the caching creates this array from the indices now.
|
delete[] tmp.data; // MGH - added, the caching creates this array from the indices now. //4jcraft made it array delete
|
||||||
//return biomes;
|
//return biomes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -635,4 +635,4 @@ bool BiomeSource::getIsMatch(float *frac)
|
||||||
|
|
||||||
// Consider as suitable if we've got all the critical ones, and in total 9 or more - currently there's 8 critical so this just forces at least 1 more others
|
// Consider as suitable if we've got all the critical ones, and in total 9 or more - currently there's 8 critical so this just forces at least 1 more others
|
||||||
return ( typeCount >= 9 );
|
return ( typeCount >= 9 );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -188,7 +188,8 @@ LevelChunk *TheEndLevelRandomLevelSource::getChunk(int xOffs, int zOffs)
|
||||||
levelChunk->recalcHeightmap();
|
levelChunk->recalcHeightmap();
|
||||||
|
|
||||||
//delete blocks.data; // Don't delete the blocks as the array data is actually owned by the chunk now
|
//delete blocks.data; // Don't delete the blocks as the array data is actually owned by the chunk now
|
||||||
delete biomes.data;
|
//4jcraft changed to []
|
||||||
|
delete[] biomes.data;
|
||||||
|
|
||||||
return levelChunk;
|
return levelChunk;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue