fix: remove byte type alias

This commit is contained in:
Tropical
2026-03-06 05:03:37 -06:00
parent 09eae49d21
commit 15af35eef2
208 changed files with 700 additions and 701 deletions
+3 -3
View File
@@ -181,9 +181,9 @@ void FallingTile::causeFallDamage(float distance)
void FallingTile::addAdditonalSaveData(CompoundTag *tag)
{
tag->putByte(L"Tile", (byte) tile);
tag->putByte(L"Data", (byte) data);
tag->putByte(L"Time", (byte) time);
tag->putByte(L"Tile", (uint8_t) tile);
tag->putByte(L"Data", (uint8_t) data);
tag->putByte(L"Time", (uint8_t) time);
tag->putBoolean(L"DropItem", dropItem);
tag->putBoolean(L"HurtEntities", hurtEntities);
tag->putFloat(L"FallHurtAmount", fallDamageAmount);
+3 -3
View File
@@ -353,9 +353,9 @@ void RedStoneDustTile::animateTick(Level *level, int x, int y, int z, Random *ra
unsigned int minColour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Tile_RedstoneDustLitMin );
unsigned int maxColour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Tile_RedstoneDustLitMax );
byte redComponent = ((minColour>>16)&0xFF) + (( (maxColour>>16)&0xFF - (minColour>>16)&0xFF)*( (data-1)/14.0f));
byte greenComponent = ((minColour>>8)&0xFF) + (( (maxColour>>8)&0xFF - (minColour>>8)&0xFF)*( (data-1)/14.0f));
byte blueComponent = ((minColour)&0xFF) + (( (maxColour)&0xFF - (minColour)&0xFF)*( (data-1)/14.0f));
uint8_t redComponent = ((minColour>>16)&0xFF) + (( (maxColour>>16)&0xFF - (minColour>>16)&0xFF)*( (data-1)/14.0f));
uint8_t greenComponent = ((minColour>>8)&0xFF) + (( (maxColour>>8)&0xFF - (minColour>>8)&0xFF)*( (data-1)/14.0f));
uint8_t blueComponent = ((minColour)&0xFF) + (( (maxColour)&0xFF - (minColour)&0xFF)*( (data-1)/14.0f));
colour = redComponent<<16 | greenComponent<<8 | blueComponent;
}
+3 -3
View File
@@ -126,9 +126,9 @@ int StemTile::getColor(int data)
unsigned int minColour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Tile_StemMin );
unsigned int maxColour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Tile_StemMax );
byte redComponent = ((minColour>>16)&0xFF) + (( (maxColour>>16)&0xFF - (minColour>>16)&0xFF)*( data/7.0f));
byte greenComponent = ((minColour>>8)&0xFF) + (( (maxColour>>8)&0xFF - (minColour>>8)&0xFF)*( data/7.0f));
byte blueComponent = ((minColour)&0xFF) + (( (maxColour)&0xFF - (minColour)&0xFF)*( data/7.0f));
uint8_t redComponent = ((minColour>>16)&0xFF) + (( (maxColour>>16)&0xFF - (minColour>>16)&0xFF)*( data/7.0f));
uint8_t greenComponent = ((minColour>>8)&0xFF) + (( (maxColour>>8)&0xFF - (minColour>>8)&0xFF)*( data/7.0f));
uint8_t blueComponent = ((minColour)&0xFF) + (( (maxColour)&0xFF - (minColour)&0xFF)*( data/7.0f));
colour = redComponent<<16 | greenComponent<<8 | blueComponent;
return colour;
@@ -308,7 +308,7 @@ void BrewingStandTileEntity::save(CompoundTag *base)
if (items[i] != NULL)
{
CompoundTag *tag = new CompoundTag();
tag->putByte(L"Slot", (byte) i);
tag->putByte(L"Slot", (uint8_t) i);
items[i]->save(tag);
listTag->add(tag);
}
@@ -121,7 +121,7 @@ void ChestTileEntity::save(CompoundTag *base)
if (items->data[i] != NULL)
{
CompoundTag *tag = new CompoundTag();
tag->putByte(L"Slot", (byte) i);
tag->putByte(L"Slot", (uint8_t) i);
items->data[i]->save(tag);
listTag->add(tag);
}
@@ -174,7 +174,7 @@ void DispenserTileEntity::save(CompoundTag *base)
if (items->data[i] != NULL)
{
CompoundTag *tag = new CompoundTag();
tag->putByte(L"Slot", (byte) i);
tag->putByte(L"Slot", (uint8_t) i);
items->data[i]->save(tag);
listTag->add(tag);
}
@@ -129,7 +129,7 @@ void FurnaceTileEntity::save(CompoundTag *base)
if ((*items)[i] != NULL)
{
CompoundTag *tag = new CompoundTag();
tag->putByte(L"Slot", (byte) i);
tag->putByte(L"Slot", (uint8_t) i);
(*items)[i]->save(tag);
listTag->add(tag);
}
@@ -33,7 +33,7 @@ void MusicTileEntity::load(CompoundTag *tag)
void MusicTileEntity::tune()
{
note = (byte) ((note + 1) % 25);
note = (uint8_t) ((note + 1) % 25);
setChanged();
}
@@ -10,7 +10,7 @@ public:
static TileEntity *create() { return new MusicTileEntity(); }
public:
byte note;
uint8_t note;
bool on;
+1 -1
View File
@@ -21,7 +21,7 @@ template <class T> void System::arraycopy(arrayWithLength<T> src, unsigned int s
ArrayCopyFunctionDefinition(Node *)
ArrayCopyFunctionDefinition(Biome *)
void System::arraycopy(arrayWithLength<byte> src, unsigned int srcPos, arrayWithLength<byte> *dst, unsigned int dstPos, unsigned int length)
void System::arraycopy(arrayWithLength<uint8_t> src, unsigned int srcPos, arrayWithLength<uint8_t> *dst, unsigned int dstPos, unsigned int length)
{
assert( srcPos >=0 && srcPos <= src.length);
assert( srcPos + length <= src.length );
+1 -1
View File
@@ -15,7 +15,7 @@ class System
template <class T> static void arraycopy(arrayWithLength<T> src, unsigned int srcPos, arrayWithLength<T> *dst, unsigned int dstPos, unsigned int length);
public:
ArrayCopyFunctionDeclaration(byte)
ArrayCopyFunctionDeclaration(uint8_t)
ArrayCopyFunctionDeclaration(Node *)
ArrayCopyFunctionDeclaration(Biome *)
ArrayCopyFunctionDeclaration(int)
+4 -4
View File
@@ -202,7 +202,7 @@ public:
bool IsHost();
bool IsGuest();
bool IsLocal();
PlayerUID GetXuid();
PlayerUID GetXuid();
LPCWSTR GetGamertag();
int GetSessionIndex();
bool IsTalking();
@@ -383,7 +383,7 @@ typedef struct _XMARKETPLACE_CONTENTOFFER_INFO
DWORD dwPointsPrice;
} XMARKETPLACE_CONTENTOFFER_INFO, *PXMARKETPLACE_CONTENTOFFER_INFO;
typedef enum
typedef enum
{
XMARKETPLACE_OFFERING_TYPE_CONTENT = 0x00000002,
XMARKETPLACE_OFFERING_TYPE_GAME_DEMO = 0x00000020,
@@ -403,7 +403,7 @@ const int QNET_SENDDATA_SEQUENTIAL = 0;
struct XRNM_SEND_BUFFER
{
DWORD dwDataSize;
byte *pbyData;
uint8_t *pbyData;
};
const int D3DBLEND_CONSTANTALPHA = 0;
@@ -531,7 +531,7 @@ typedef struct {
// const int XC_LANGUAGE_POLISH =17;
// const int XC_LANGUAGE_TURKISH =18;
// const int XC_LANGUAGE_LATINAMERICANSPANISH =19;
//
//
// const int XC_LANGUAGE_GREEK =20;
// #else
// const int XC_LANGUAGE_UKENGLISH =11;
+2 -2
View File
@@ -475,7 +475,7 @@ ListTag<CompoundTag> *Inventory::save(ListTag<CompoundTag> *listTag)
if (items[i] != NULL)
{
CompoundTag *tag = new CompoundTag();
tag->putByte(L"Slot", (byte) i);
tag->putByte(L"Slot", (uint8_t) i);
items[i]->save(tag);
listTag->add(tag);
}
@@ -485,7 +485,7 @@ ListTag<CompoundTag> *Inventory::save(ListTag<CompoundTag> *listTag)
if (armor[i] != NULL)
{
CompoundTag *tag = new CompoundTag();
tag->putByte(L"Slot", (byte) (i + 100));
tag->putByte(L"Slot", (uint8_t) (i + 100));
armor[i]->save(tag);
listTag->add(tag);
}
@@ -85,7 +85,7 @@ MerchantRecipe *MerchantRecipeList::getMatchingRecipeFor(shared_ptr<ItemInstance
void MerchantRecipeList::writeToStream(DataOutputStream *stream)
{
stream->writeByte((byte) (m_recipes.size() & 0xff));
stream->writeByte((uint8_t) (m_recipes.size() & 0xff));
for (int i = 0; i < m_recipes.size(); i++)
{
MerchantRecipe *r = m_recipes.at(i);
+5 -5
View File
@@ -340,7 +340,7 @@ Entity::Entity(Level *level, bool useSmallId) // 4J - added useSmallId parameter
// resetPos();
setPos(0, 0, 0);
entityData->define(DATA_SHARED_FLAGS_ID, (byte) 0);
entityData->define(DATA_SHARED_FLAGS_ID, (uint8_t) 0);
entityData->define(DATA_AIR_SUPPLY_ID, TOTAL_AIR_SUPPLY); // 4J Stu - Brought forward from 1.2.3 to fix 38654 - Gameplay: Player will take damage when air bubbles are present if resuming game from load/autosave underwater.
// 4J Stu - We cannot call virtual functions in ctors, as at this point the object
@@ -1677,7 +1677,7 @@ void Entity::lerpMotion(double xd, double yd, double zd)
this->zd = zd;
}
void Entity::handleEntityEvent(byte eventId)
void Entity::handleEntityEvent(uint8_t eventId)
{
}
@@ -1781,14 +1781,14 @@ bool Entity::getSharedFlag(int flag)
void Entity::setSharedFlag(int flag, bool value)
{
byte currentValue = entityData->getByte(DATA_SHARED_FLAGS_ID);
uint8_t currentValue = entityData->getByte(DATA_SHARED_FLAGS_ID);
if (value)
{
entityData->set(DATA_SHARED_FLAGS_ID, (byte) (currentValue | (1 << flag)));
entityData->set(DATA_SHARED_FLAGS_ID, (uint8_t) (currentValue | (1 << flag)));
}
else
{
entityData->set(DATA_SHARED_FLAGS_ID, (byte) (currentValue & ~(1 << flag)));
entityData->set(DATA_SHARED_FLAGS_ID, (uint8_t) (currentValue & ~(1 << flag)));
}
}
+1 -1
View File
@@ -303,7 +303,7 @@ public:
virtual Vec3 *getLookAngle();
virtual void handleInsidePortal();
virtual void lerpMotion(double xd, double yd, double zd);
virtual void handleEntityEvent(byte eventId);
virtual void handleEntityEvent(uint8_t eventId);
virtual void animateHurt();
virtual void prepareCustomTextures();
virtual ItemInstanceArray getEquipmentSlots(); // ItemInstance[]
+5 -5
View File
@@ -236,7 +236,7 @@ void HangingEntity::push(double xa, double ya, double za)
void HangingEntity::addAdditonalSaveData(CompoundTag *tag)
{
tag->putByte(L"Direction", (byte) dir);
tag->putByte(L"Direction", (uint8_t) dir);
tag->putInt(L"TileX", xTile);
tag->putInt(L"TileY", yTile);
tag->putInt(L"TileZ", zTile);
@@ -245,16 +245,16 @@ void HangingEntity::addAdditonalSaveData(CompoundTag *tag)
switch (dir)
{
case Direction::NORTH:
tag->putByte(L"Dir", (byte) 0);
tag->putByte(L"Dir", (uint8_t) 0);
break;
case Direction::WEST:
tag->putByte(L"Dir", (byte) 1);
tag->putByte(L"Dir", (uint8_t) 1);
break;
case Direction::SOUTH:
tag->putByte(L"Dir", (byte) 2);
tag->putByte(L"Dir", (uint8_t) 2);
break;
case Direction::EAST:
tag->putByte(L"Dir", (byte) 3);
tag->putByte(L"Dir", (uint8_t) 3);
break;
}
}
+1 -1
View File
@@ -202,7 +202,7 @@ bool ItemEntity::hurt(DamageSource *source, int damage)
void ItemEntity::addAdditonalSaveData(CompoundTag *entityTag)
{
entityTag->putShort(L"Health", (byte) health);
entityTag->putShort(L"Health", (uint8_t) health);
entityTag->putShort(L"Age", (short) age);
if (getItem() != NULL) entityTag->putCompound(L"Item", getItem()->save(new CompoundTag()));
}
+1 -1
View File
@@ -1591,7 +1591,7 @@ shared_ptr<ItemInstance> Mob::getArmor(int pos)
//return equipment[pos + 1];
}
void Mob::handleEntityEvent(byte id)
void Mob::handleEntityEvent(uint8_t id)
{
if (id == EntityEvent::HURT)
{
+1 -1
View File
@@ -324,7 +324,7 @@ public:
virtual int getMaxSpawnClusterSize();
virtual shared_ptr<ItemInstance> getCarriedItem();
virtual shared_ptr<ItemInstance> getArmor(int pos);
virtual void handleEntityEvent(byte id);
virtual void handleEntityEvent(uint8_t id);
virtual bool isSleeping();
virtual Icon *getItemInHandIcon(shared_ptr<ItemInstance> item, int layer);
virtual bool shouldRender(Vec3 *c);
+10 -10
View File
@@ -116,7 +116,7 @@ Arrow::Arrow(Level *level, shared_ptr<Mob> mob, float power) : Entity( level )
void Arrow::defineSynchedData()
{
entityData->define(ID_FLAGS, (byte) 0);
entityData->define(ID_FLAGS, (uint8_t) 0);
}
@@ -432,11 +432,11 @@ void Arrow::addAdditonalSaveData(CompoundTag *tag)
tag->putShort(L"xTile", (short) xTile);
tag->putShort(L"yTile", (short) yTile);
tag->putShort(L"zTile", (short) zTile);
tag->putByte(L"inTile", (byte) lastTile);
tag->putByte(L"inData", (byte) lastData);
tag->putByte(L"shake", (byte) shakeTime);
tag->putByte(L"inGround", (byte) (inGround ? 1 : 0));
tag->putByte(L"pickup", (byte) pickup);
tag->putByte(L"inTile", (uint8_t) lastTile);
tag->putByte(L"inData", (uint8_t) lastData);
tag->putByte(L"shake", (uint8_t) shakeTime);
tag->putByte(L"inGround", (uint8_t) (inGround ? 1 : 0));
tag->putByte(L"pickup", (uint8_t) pickup);
tag->putDouble(L"damage", baseDamage);
}
@@ -513,19 +513,19 @@ bool Arrow::isAttackable()
void Arrow::setCritArrow(bool critArrow)
{
byte flags = entityData->getByte(ID_FLAGS);
uint8_t flags = entityData->getByte(ID_FLAGS);
if (critArrow)
{
entityData->set(ID_FLAGS, (byte) (flags | FLAG_CRIT));
entityData->set(ID_FLAGS, (uint8_t) (flags | FLAG_CRIT));
}
else
{
entityData->set(ID_FLAGS, (byte) (flags & ~FLAG_CRIT));
entityData->set(ID_FLAGS, (uint8_t) (flags & ~FLAG_CRIT));
}
}
bool Arrow::isCritArrow()
{
byte flags = entityData->getByte(ID_FLAGS);
uint8_t flags = entityData->getByte(ID_FLAGS);
return (flags & FLAG_CRIT) != 0;
}
+2 -2
View File
@@ -44,7 +44,7 @@ void Blaze::defineSynchedData()
{
Monster::defineSynchedData();
entityData->define(DATA_FLAGS_ID, (byte) 0);
entityData->define(DATA_FLAGS_ID, (uint8_t) 0);
}
int Blaze::getAmbientSound()
@@ -209,7 +209,7 @@ bool Blaze::isCharged()
void Blaze::setCharged(bool value)
{
byte flags = entityData->getByte(DATA_FLAGS_ID);
uint8_t flags = entityData->getByte(DATA_FLAGS_ID);
if (value)
{
flags |= 0x1;
+5 -5
View File
@@ -63,8 +63,8 @@ void Creeper::defineSynchedData()
{
Monster::defineSynchedData();
entityData->define(DATA_SWELL_DIR, (byte) -1);
entityData->define(DATA_IS_POWERED, (byte) 0);
entityData->define(DATA_SWELL_DIR, (uint8_t) -1);
entityData->define(DATA_IS_POWERED, (uint8_t) 0);
}
void Creeper::addAdditonalSaveData(CompoundTag *entityTag)
@@ -76,7 +76,7 @@ void Creeper::addAdditonalSaveData(CompoundTag *entityTag)
void Creeper::readAdditionalSaveData(CompoundTag *tag)
{
Monster::readAdditionalSaveData(tag);
entityData->set(DATA_IS_POWERED, (byte) (tag->getBoolean(L"powered") ? 1 : 0));
entityData->set(DATA_IS_POWERED, (uint8_t) (tag->getBoolean(L"powered") ? 1 : 0));
}
void Creeper::tick()
@@ -159,11 +159,11 @@ int Creeper::getSwellDir()
void Creeper::setSwellDir(int dir)
{
entityData->set(DATA_SWELL_DIR, (byte) dir);
entityData->set(DATA_SWELL_DIR, (uint8_t) dir);
}
void Creeper::thunderHit(const LightningBolt *lightningBolt)
{
Monster::thunderHit(lightningBolt);
entityData->set(DATA_IS_POWERED, (byte) 1);
entityData->set(DATA_IS_POWERED, (uint8_t) 1);
}
+6 -6
View File
@@ -63,9 +63,9 @@ void EnderMan::defineSynchedData()
{
Monster::defineSynchedData();
entityData->define(DATA_CARRY_ITEM_ID, (byte) 0);
entityData->define(DATA_CARRY_ITEM_DATA, (byte) 0);
entityData->define(DATA_CREEPY, (byte) 0);
entityData->define(DATA_CARRY_ITEM_ID, (uint8_t) 0);
entityData->define(DATA_CARRY_ITEM_DATA, (uint8_t) 0);
entityData->define(DATA_CREEPY, (uint8_t) 0);
}
void EnderMan::addAdditonalSaveData(CompoundTag *tag)
@@ -368,7 +368,7 @@ void EnderMan::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel)
// 4J Brought forward from 1.2.3 to help fix Enderman behaviour
void EnderMan::setCarryingTile(int carryingTile)
{
entityData->set(DATA_CARRY_ITEM_ID, (byte) (carryingTile & 0xff));
entityData->set(DATA_CARRY_ITEM_ID, (uint8_t) (carryingTile & 0xff));
}
int EnderMan::getCarryingTile()
@@ -378,7 +378,7 @@ int EnderMan::getCarryingTile()
void EnderMan::setCarryingData(int carryingData)
{
entityData->set(DATA_CARRY_ITEM_DATA, (byte) (carryingData & 0xff));
entityData->set(DATA_CARRY_ITEM_DATA, (uint8_t) (carryingData & 0xff));
}
int EnderMan::getCarryingData()
@@ -406,5 +406,5 @@ bool EnderMan::isCreepy()
void EnderMan::setCreepy(bool creepy)
{
entityData->set(DATA_CREEPY, (byte)(creepy ? 1 : 0));
entityData->set(DATA_CREEPY, (uint8_t)(creepy ? 1 : 0));
}
@@ -175,7 +175,7 @@ bool ExperienceOrb::hurt(DamageSource *source, int damage)
void ExperienceOrb::addAdditonalSaveData(CompoundTag *entityTag)
{
entityTag->putShort(L"Health", (byte) health);
entityTag->putShort(L"Health", (uint8_t) health);
entityTag->putShort(L"Age", (short) age);
entityTag->putShort(L"Value", (short) value);
}
+2 -2
View File
@@ -320,8 +320,8 @@ void Fireball::addAdditonalSaveData(CompoundTag *tag)
tag->putShort(L"xTile", (short) xTile);
tag->putShort(L"yTile", (short) yTile);
tag->putShort(L"zTile", (short) zTile);
tag->putByte(L"inTile", (byte) lastTile);
tag->putByte(L"inGround", (byte) (inGround ? 1 : 0));
tag->putByte(L"inTile", (uint8_t) lastTile);
tag->putByte(L"inGround", (uint8_t) (inGround ? 1 : 0));
tag->put(L"direction", this->newDoubleList(3, this->xd, this->yd, this->zd));
}
@@ -381,9 +381,9 @@ void FishingHook::addAdditonalSaveData(CompoundTag *tag)
tag->putShort(L"xTile", (short) xTile);
tag->putShort(L"yTile", (short) yTile);
tag->putShort(L"zTile", (short) zTile);
tag->putByte(L"inTile", (byte) lastTile);
tag->putByte(L"shake", (byte) shakeTime);
tag->putByte(L"inGround", (byte) (inGround ? 1 : 0));
tag->putByte(L"inTile", (uint8_t) lastTile);
tag->putByte(L"shake", (uint8_t) shakeTime);
tag->putByte(L"inGround", (uint8_t) (inGround ? 1 : 0));
}
void FishingHook::readAdditionalSaveData(CompoundTag *tag)
+4 -4
View File
@@ -66,7 +66,7 @@ void Ghast::defineSynchedData()
{
FlyingMob::defineSynchedData();
entityData->define(DATA_IS_CHARGING, (byte) 0);
entityData->define(DATA_IS_CHARGING, (uint8_t) 0);
}
int Ghast::getMaxHealth()
@@ -77,7 +77,7 @@ int Ghast::getMaxHealth()
void Ghast::tick()
{
FlyingMob::tick();
byte current = entityData->getByte(DATA_IS_CHARGING);
uint8_t current = entityData->getByte(DATA_IS_CHARGING);
// this->textureName = current == 1 ? L"/mob/ghast_fire.png" : L"/mob/ghast.png"; // 4J replaced with following line
this->textureIdx = current == 1 ? TN_MOB_GHAST_FIRE : TN_MOB_GHAST;
}
@@ -174,8 +174,8 @@ void Ghast::serverAiStep()
if (!level->isClientSide)
{
byte old = entityData->getByte(DATA_IS_CHARGING);
byte current = (byte) (charge > 10 ? 1 : 0);
uint8_t old = entityData->getByte(DATA_IS_CHARGING);
uint8_t current = (uint8_t) (charge > 10 ? 1 : 0);
if (old != current)
{
entityData->set(DATA_IS_CHARGING, current);
+3 -3
View File
@@ -36,7 +36,7 @@ ItemFrame::ItemFrame(Level *level, int xTile, int yTile, int zTile, int dir) : H
void ItemFrame::defineSynchedData()
{
getEntityData()->defineNULL(DATA_ITEM, NULL);
getEntityData()->define(DATA_ROTATION, (byte) 0);
getEntityData()->define(DATA_ROTATION, (uint8_t) 0);
}
void ItemFrame::dropItem()
@@ -79,7 +79,7 @@ int ItemFrame::getRotation()
void ItemFrame::setRotation(int rotation)
{
getEntityData()->set(DATA_ROTATION, (byte) (rotation % 4));
getEntityData()->set(DATA_ROTATION, (uint8_t) (rotation % 4));
}
void ItemFrame::addAdditonalSaveData(CompoundTag *tag)
@@ -87,7 +87,7 @@ void ItemFrame::addAdditonalSaveData(CompoundTag *tag)
if (getItem() != NULL)
{
tag->putCompound(L"Item", getItem()->save(new CompoundTag()));
tag->putByte(L"ItemRotation", (byte) getRotation());
tag->putByte(L"ItemRotation", (uint8_t) getRotation());
//tag->putFloat(L"ItemDropChance", dropChance);
}
HangingEntity::addAdditonalSaveData(tag);
+4 -4
View File
@@ -128,7 +128,7 @@ bool Minecart::makeStepSound()
void Minecart::defineSynchedData()
{
entityData->define(DATA_ID_FUEL, (byte) 0);
entityData->define(DATA_ID_FUEL, (uint8_t) 0);
entityData->define(DATA_ID_HURT, 0);
entityData->define(DATA_ID_HURTDIR, 1);
entityData->define(DATA_ID_DAMAGE, 0);
@@ -861,7 +861,7 @@ void Minecart::addAdditonalSaveData(CompoundTag *base)
if ( (*items)[i] != NULL)
{
CompoundTag *tag = new CompoundTag();
tag->putByte(L"Slot", (byte) i);
tag->putByte(L"Slot", (uint8_t) i);
(*items)[i]->save(tag);
listTag->add(tag);
}
@@ -1158,11 +1158,11 @@ void Minecart::setHasFuel(bool fuel)
{
if (fuel)
{
entityData->set(DATA_ID_FUEL, (byte) (entityData->getByte(DATA_ID_FUEL) | 1));
entityData->set(DATA_ID_FUEL, (uint8_t) (entityData->getByte(DATA_ID_FUEL) | 1));
}
else
{
entityData->set(DATA_ID_FUEL, (byte) (entityData->getByte(DATA_ID_FUEL) & ~1));
entityData->set(DATA_ID_FUEL, (uint8_t) (entityData->getByte(DATA_ID_FUEL) & ~1));
}
}
+2 -2
View File
@@ -60,7 +60,7 @@ void Ozelot::defineSynchedData()
{
TamableAnimal::defineSynchedData();
entityData->define(DATA_TYPE_ID, (byte) TYPE_OZELOT);
entityData->define(DATA_TYPE_ID, (uint8_t) TYPE_OZELOT);
}
void Ozelot::serverAiMobStep()
@@ -294,7 +294,7 @@ int Ozelot::getCatType()
void Ozelot::setCatType(int type)
{
entityData->set(DATA_TYPE_ID, (byte) type);
entityData->set(DATA_TYPE_ID, (uint8_t) type);
}
bool Ozelot::canSpawn()
+3 -3
View File
@@ -64,7 +64,7 @@ bool Pig::canBeControlledByRider()
void Pig::defineSynchedData()
{
Animal::defineSynchedData();
entityData->define(DATA_SADDLE_ID, (byte) 0);
entityData->define(DATA_SADDLE_ID, (uint8_t) 0);
}
void Pig::addAdditonalSaveData(CompoundTag *tag)
@@ -142,11 +142,11 @@ void Pig::setSaddle(bool value)
{
if (value)
{
entityData->set(DATA_SADDLE_ID, (byte) 1);
entityData->set(DATA_SADDLE_ID, (uint8_t) 1);
}
else
{
entityData->set(DATA_SADDLE_ID, (byte) 0);
entityData->set(DATA_SADDLE_ID, (uint8_t) 0);
}
}
+1 -1
View File
@@ -101,7 +101,7 @@ void PrimedTnt::explode()
void PrimedTnt::addAdditonalSaveData(CompoundTag *entityTag)
{
entityTag->putByte(L"Fuse", (byte) life);
entityTag->putByte(L"Fuse", (uint8_t) life);
}
void PrimedTnt::readAdditionalSaveData(CompoundTag *tag)
+8 -8
View File
@@ -100,7 +100,7 @@ void Sheep::defineSynchedData()
Animal::defineSynchedData();
// sheared and color share a byte
entityData->define(DATA_WOOL_ID, ((byte) 0)); //was new Byte((byte), 0)
entityData->define(DATA_WOOL_ID, ((uint8_t) 0)); //was new Byte((uint8_t), 0)
}
void Sheep::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel)
@@ -117,7 +117,7 @@ int Sheep::getDeathLoot()
return Tile::cloth_Id;
}
void Sheep::handleEntityEvent(byte id)
void Sheep::handleEntityEvent(uint8_t id)
{
if (id == EntityEvent::EAT_GRASS)
{
@@ -195,7 +195,7 @@ void Sheep::addAdditonalSaveData(CompoundTag *tag)
{
Animal::addAdditonalSaveData(tag);
tag->putBoolean(L"Sheared", isSheared());
tag->putByte(L"Color", (byte) getColor());
tag->putByte(L"Color", (uint8_t) getColor());
}
void Sheep::readAdditionalSaveData(CompoundTag *tag)
@@ -227,8 +227,8 @@ int Sheep::getColor()
void Sheep::setColor(int color)
{
byte current = entityData->getByte(DATA_WOOL_ID);
entityData->set(DATA_WOOL_ID, (byte) ((current & 0xf0) | (color & 0x0f)));
uint8_t current = entityData->getByte(DATA_WOOL_ID);
entityData->set(DATA_WOOL_ID, (uint8_t) ((current & 0xf0) | (color & 0x0f)));
}
bool Sheep::isSheared()
@@ -238,14 +238,14 @@ bool Sheep::isSheared()
void Sheep::setSheared(bool value)
{
byte current = entityData->getByte(DATA_WOOL_ID);
uint8_t current = entityData->getByte(DATA_WOOL_ID);
if (value)
{
entityData->set(DATA_WOOL_ID, (byte) (current | 0x10));
entityData->set(DATA_WOOL_ID, (uint8_t) (current | 0x10));
}
else
{
entityData->set(DATA_WOOL_ID, (byte) (current & ~0x10));
entityData->set(DATA_WOOL_ID, (uint8_t) (current & ~0x10));
}
}
+1 -1
View File
@@ -52,7 +52,7 @@ public:
virtual int getDeathLoot();
public:
virtual void handleEntityEvent(byte id);
virtual void handleEntityEvent(uint8_t id);
public:
float getHeadEatPositionScale(float a);
+2 -2
View File
@@ -47,12 +47,12 @@ void Slime::defineSynchedData()
{
Mob::defineSynchedData();
entityData->define(ID_SIZE, (byte) 1);
entityData->define(ID_SIZE, (uint8_t) 1);
}
void Slime::setSize(int size)
{
entityData->set(ID_SIZE, (byte) size);
entityData->set(ID_SIZE, (uint8_t) size);
Mob::setSize(0.6f * size, 0.6f * size);
this->setPos(x, y, z);
setHealth(getMaxHealth());
+2 -2
View File
@@ -31,7 +31,7 @@ void Spider::defineSynchedData()
{
Monster::defineSynchedData();
entityData->define(DATA_FLAGS_ID, (byte) 0);
entityData->define(DATA_FLAGS_ID, (uint8_t) 0);
}
void Spider::tick()
@@ -179,7 +179,7 @@ bool Spider::isClimbing()
void Spider::setClimbing(bool value)
{
byte flags = entityData->getByte(DATA_FLAGS_ID);
uint8_t flags = entityData->getByte(DATA_FLAGS_ID);
if (value)
{
flags |= 0x1;
+1 -1
View File
@@ -701,7 +701,7 @@ int Villager::getPurchaseCost(int itemId, Random *random)
return minMax.first + random->nextInt(minMax.second - minMax.first);
}
void Villager::handleEntityEvent(byte id)
void Villager::handleEntityEvent(uint8_t id)
{
if (id == EntityEvent::LOVE_HEARTS)
{
+1 -1
View File
@@ -86,7 +86,7 @@ public:
void setLastHurtByMob(shared_ptr<Mob> mob);
void die(DamageSource *source);
void handleEntityEvent(byte id);
void handleEntityEvent(uint8_t id);
private:
void addParticlesAroundSelf(ePARTICLE_TYPE particle);
@@ -56,7 +56,7 @@ VillagerGolem::VillagerGolem(Level *level) : Golem(level)
void VillagerGolem::defineSynchedData()
{
Golem::defineSynchedData();
entityData->define(DATA_FLAGS_ID, (byte) 0);
entityData->define(DATA_FLAGS_ID, (uint8_t) 0);
}
bool VillagerGolem::useNewAi()
@@ -143,7 +143,7 @@ bool VillagerGolem::doHurtTarget(shared_ptr<Entity> target)
return hurt;
}
void VillagerGolem::handleEntityEvent(byte id)
void VillagerGolem::handleEntityEvent(uint8_t id)
{
if (id == EntityEvent::START_ATTACKING)
{
@@ -219,14 +219,14 @@ bool VillagerGolem::isPlayerCreated()
void VillagerGolem::setPlayerCreated(bool value)
{
byte current = entityData->getByte(DATA_FLAGS_ID);
uint8_t current = entityData->getByte(DATA_FLAGS_ID);
if (value)
{
entityData->set(DATA_FLAGS_ID, (byte) (current | 0x01));
entityData->set(DATA_FLAGS_ID, (uint8_t) (current | 0x01));
}
else
{
entityData->set(DATA_FLAGS_ID, (byte) (current & ~0x01));
entityData->set(DATA_FLAGS_ID, (uint8_t) (current & ~0x01));
}
}
@@ -44,7 +44,7 @@ public:
virtual void addAdditonalSaveData(CompoundTag *tag);
virtual void readAdditionalSaveData(CompoundTag *tag);
virtual bool doHurtTarget(shared_ptr<Entity> target);
virtual void handleEntityEvent(byte id);
virtual void handleEntityEvent(uint8_t id);
virtual shared_ptr<Village> getVillage();
virtual int getAttackAnimationTick();
virtual void offerFlower(bool offer);
+11 -11
View File
@@ -91,8 +91,8 @@ void Wolf::defineSynchedData()
{
TamableAnimal::defineSynchedData();
entityData->define(DATA_HEALTH_ID, getHealth());
entityData->define(DATA_INTERESTED_ID, (byte)0);
entityData->define(DATA_COLLAR_COLOR, (byte) ClothTile::getTileDataForItemAuxValue(DyePowderItem::RED));
entityData->define(DATA_INTERESTED_ID, (uint8_t)0);
entityData->define(DATA_COLLAR_COLOR, (uint8_t) ClothTile::getTileDataForItemAuxValue(DyePowderItem::RED));
}
bool Wolf::makeStepSound()
@@ -118,7 +118,7 @@ void Wolf::addAdditonalSaveData(CompoundTag *tag)
TamableAnimal::addAdditonalSaveData(tag);
tag->putBoolean(L"Angry", isAngry());
tag->putByte(L"CollarColor", (byte) getCollarColor());
tag->putByte(L"CollarColor", (uint8_t) getCollarColor());
}
void Wolf::readAdditionalSaveData(CompoundTag *tag)
@@ -424,7 +424,7 @@ bool Wolf::interact(shared_ptr<Player> player)
return TamableAnimal::interact(player);
}
void Wolf::handleEntityEvent(byte id)
void Wolf::handleEntityEvent(uint8_t id)
{
if (id == EntityEvent::SHAKE_WETNESS)
{
@@ -471,14 +471,14 @@ bool Wolf::isAngry()
void Wolf::setAngry(bool value)
{
byte current = entityData->getByte(DATA_FLAGS_ID);
uint8_t current = entityData->getByte(DATA_FLAGS_ID);
if (value)
{
entityData->set(DATA_FLAGS_ID, (byte) (current | 0x02));
entityData->set(DATA_FLAGS_ID, (uint8_t) (current | 0x02));
}
else
{
entityData->set(DATA_FLAGS_ID, (byte) (current & ~0x02));
entityData->set(DATA_FLAGS_ID, (uint8_t) (current & ~0x02));
}
}
@@ -489,7 +489,7 @@ int Wolf::getCollarColor()
void Wolf::setCollarColor(int color)
{
entityData->set(DATA_COLLAR_COLOR, (byte) (color & 0xF));
entityData->set(DATA_COLLAR_COLOR, (uint8_t) (color & 0xF));
}
// 4J-PB added for tooltips
@@ -520,15 +520,15 @@ shared_ptr<AgableMob> Wolf::getBreedOffspring(shared_ptr<AgableMob> target)
void Wolf::setIsInterested(bool value)
{
//byte current = entityData->getByte(DATA_INTERESTED_ID);
//uint8_t current = entityData->getByte(DATA_INTERESTED_ID);
if (value)
{
entityData->set(DATA_INTERESTED_ID, (byte) 1);
entityData->set(DATA_INTERESTED_ID, (uint8_t) 1);
}
else
{
entityData->set(DATA_INTERESTED_ID, (byte) 0);
entityData->set(DATA_INTERESTED_ID, (uint8_t) 0);
}
}
+1 -1
View File
@@ -63,7 +63,7 @@ public:
virtual bool hurt(DamageSource *source, int dmg);
virtual bool doHurtTarget(shared_ptr<Entity> target);
virtual bool interact(shared_ptr<Player> player);
virtual void handleEntityEvent(byte id);
virtual void handleEntityEvent(uint8_t id);
float getTailAngle();
virtual bool isFood(shared_ptr<ItemInstance> item);
virtual int getMaxSpawnClusterSize();
+10 -10
View File
@@ -55,9 +55,9 @@ void Zombie::defineSynchedData()
{
Monster::defineSynchedData();
getEntityData()->define(DATA_BABY_ID, (byte) 0);
getEntityData()->define(DATA_VILLAGER_ID, (byte) 0);
getEntityData()->define(DATA_CONVERTING_ID, (byte) 0);
getEntityData()->define(DATA_BABY_ID, (uint8_t) 0);
getEntityData()->define(DATA_VILLAGER_ID, (uint8_t) 0);
getEntityData()->define(DATA_CONVERTING_ID, (uint8_t) 0);
}
float Zombie::getWalkingSpeedModifier()
@@ -87,23 +87,23 @@ bool Zombie::useNewAi()
bool Zombie::isBaby()
{
return getEntityData()->getByte(DATA_BABY_ID) == (byte) 1;
return getEntityData()->getByte(DATA_BABY_ID) == (uint8_t) 1;
}
void Zombie::setBaby(bool baby)
{
getEntityData()->set(DATA_BABY_ID, (byte) 1);
getEntityData()->set(DATA_BABY_ID, (uint8_t) 1);
updateSize(isBaby());
}
bool Zombie::isVillager()
{
return getEntityData()->getByte(DATA_VILLAGER_ID) == (byte) 1;
return getEntityData()->getByte(DATA_VILLAGER_ID) == (uint8_t) 1;
}
void Zombie::setVillager(bool villager)
{
getEntityData()->set(DATA_VILLAGER_ID, (byte) (villager ? 1 : 0));
getEntityData()->set(DATA_VILLAGER_ID, (uint8_t) (villager ? 1 : 0));
}
void Zombie::aiStep()
@@ -292,7 +292,7 @@ bool Zombie::interact(shared_ptr<Player> player)
void Zombie::startConverting(int time)
{
villagerConversionTime = time;
getEntityData()->set(DATA_CONVERTING_ID, (byte) 1);
getEntityData()->set(DATA_CONVERTING_ID, (uint8_t) 1);
removeEffect(MobEffect::weakness->id);
addEffect(new MobEffectInstance(MobEffect::damageBoost->id, time, min(level->difficulty - 1, 0)));
@@ -300,7 +300,7 @@ void Zombie::startConverting(int time)
level->broadcastEntityEvent(shared_from_this(), EntityEvent::ZOMBIE_CONVERTING);
}
void Zombie::handleEntityEvent(byte id)
void Zombie::handleEntityEvent(uint8_t id)
{
if (id == EntityEvent::ZOMBIE_CONVERTING)
{
@@ -314,7 +314,7 @@ void Zombie::handleEntityEvent(byte id)
bool Zombie::isConverting()
{
return getEntityData()->getByte(DATA_CONVERTING_ID) == (byte) 1;
return getEntityData()->getByte(DATA_CONVERTING_ID) == (uint8_t) 1;
}
void Zombie::finishConversion()
+1 -1
View File
@@ -72,7 +72,7 @@ protected:
void startConverting(int time);
public:
void handleEntityEvent(byte id);
void handleEntityEvent(uint8_t id);
bool isConverting();
protected:
@@ -24,7 +24,7 @@ void SynchedEntityData::define(int id, int value)
m_isEmpty = false;
}
void SynchedEntityData::define(int id, byte value)
void SynchedEntityData::define(int id, uint8_t value)
{
MemSect(17);
checkId(id);
@@ -82,7 +82,7 @@ void SynchedEntityData::checkId(int id)
#endif
}
byte SynchedEntityData::getByte(int id)
uint8_t SynchedEntityData::getByte(int id)
{
return itemsById[id]->getValue_byte();
}
@@ -133,7 +133,7 @@ void SynchedEntityData::set(int id, int value)
}
}
void SynchedEntityData::set(int id, byte value)
void SynchedEntityData::set(int id, uint8_t value)
{
shared_ptr<DataItem> dataItem = itemsById[id];
@@ -331,7 +331,7 @@ vector<shared_ptr<SynchedEntityData::DataItem> > *SynchedEntityData::unpack(Data
{
case TYPE_BYTE:
{
byte dataRead = input->readByte();
uint8_t dataRead = input->readByte();
item = shared_ptr<DataItem>( new DataItem(itemType, itemId, dataRead) );
}
break;
@@ -462,7 +462,7 @@ SynchedEntityData::DataItem::DataItem(int type, int id, int value) : type( type
this->dirty = true;
}
SynchedEntityData::DataItem::DataItem(int type, int id, byte value) : type( type ), id( id )
SynchedEntityData::DataItem::DataItem(int type, int id, uint8_t value) : type( type ), id( id )
{
this->value_byte = value;
this->dirty = true;
@@ -496,7 +496,7 @@ void SynchedEntityData::DataItem::setValue(int value)
this->value_int = value;
}
void SynchedEntityData::DataItem::setValue(byte value)
void SynchedEntityData::DataItem::setValue(uint8_t value)
{
this->value_byte = value;
}
@@ -526,7 +526,7 @@ short SynchedEntityData::DataItem::getValue_short()
return value_short;
}
byte SynchedEntityData::DataItem::getValue_byte()
uint8_t SynchedEntityData::DataItem::getValue_byte()
{
return value_byte;
}
+7 -7
View File
@@ -15,7 +15,7 @@ public:
const int id;
// 4J - there used to be one "value" type here of general type Object, just storing the different (used) varieties
// here separately for us
byte value_byte;
uint8_t value_byte;
int value_int;
short value_short;
wstring value_wstring;
@@ -24,19 +24,19 @@ public:
public:
// There was one type here that took a generic Object type, using overloading here instead
DataItem(int type, int id, byte value);
DataItem(int type, int id, uint8_t value);
DataItem(int type, int id, int value);
DataItem(int type, int id, const wstring& value);
DataItem(int type, int id, shared_ptr<ItemInstance> itemInstance);
DataItem(int type, int id, short value);
int getId();
void setValue(byte value);
void setValue(uint8_t value);
void setValue(int value);
void setValue(short value);
void setValue(const wstring& value);
void setValue(shared_ptr<ItemInstance> value);
byte getValue_byte();
uint8_t getValue_byte();
int getValue_int();
short getValue_short();
wstring getValue_wstring();
@@ -79,14 +79,14 @@ public:
// 4J - this function used to be a template, but there's only 3 varieties of use I've found so just hard-coding now, as
// the original had some automatic Class to type sort of conversion that's a real pain for us to actually do
void define(int id, byte value);
void define(int id, uint8_t value);
void define(int id, const wstring& value);
void define(int id, int value);
void define(int id, short value);
void defineNULL(int id, void *pVal);
void checkId(int id); // 4J - added to contain common code from overloaded define functions above
byte getByte(int id);
uint8_t getByte(int id);
short getShort(int id);
int getInteger(int id);
float getFloat(int id);
@@ -94,7 +94,7 @@ public:
shared_ptr<ItemInstance> getItemInstance(int id);
Pos *getPos(int id);
// 4J - using overloads rather than template here
void set(int id, byte value);
void set(int id, uint8_t value);
void set(int id, int value);
void set(int id, short value);
void set(int id, const wstring& value);
+8 -8
View File
@@ -19,7 +19,7 @@ TamableAnimal::~TamableAnimal()
void TamableAnimal::defineSynchedData()
{
Animal::defineSynchedData();
entityData->define(DATA_FLAGS_ID, (byte) 0);
entityData->define(DATA_FLAGS_ID, (uint8_t) 0);
entityData->define(DATA_OWNERUUID_ID, L"");
}
@@ -86,7 +86,7 @@ void TamableAnimal::spawnTamingParticles(bool success)
}
}
void TamableAnimal::handleEntityEvent(byte id)
void TamableAnimal::handleEntityEvent(uint8_t id)
{
if (id == EntityEvent::TAMING_SUCCEEDED)
{
@@ -109,14 +109,14 @@ bool TamableAnimal::isTame()
void TamableAnimal::setTame(bool value)
{
byte current = entityData->getByte(DATA_FLAGS_ID);
uint8_t current = entityData->getByte(DATA_FLAGS_ID);
if (value)
{
entityData->set(DATA_FLAGS_ID, (byte) (current | 0x04));
entityData->set(DATA_FLAGS_ID, (uint8_t) (current | 0x04));
}
else
{
entityData->set(DATA_FLAGS_ID, (byte) (current & ~0x04));
entityData->set(DATA_FLAGS_ID, (uint8_t) (current & ~0x04));
}
}
@@ -127,14 +127,14 @@ bool TamableAnimal::isSitting()
void TamableAnimal::setSitting(bool value)
{
byte current = entityData->getByte(DATA_FLAGS_ID);
uint8_t current = entityData->getByte(DATA_FLAGS_ID);
if (value)
{
entityData->set(DATA_FLAGS_ID, (byte) (current | 0x01));
entityData->set(DATA_FLAGS_ID, (uint8_t) (current | 0x01));
}
else
{
entityData->set(DATA_FLAGS_ID, (byte) (current & ~0x01));
entityData->set(DATA_FLAGS_ID, (uint8_t) (current & ~0x01));
}
}
+1 -1
View File
@@ -26,7 +26,7 @@ protected:
virtual void spawnTamingParticles(bool success);
public:
virtual void handleEntityEvent(byte id);
virtual void handleEntityEvent(uint8_t id);
virtual bool isTame();
virtual void setTame(bool value);
virtual bool isSitting();
+3 -3
View File
@@ -260,9 +260,9 @@ void Throwable::addAdditonalSaveData(CompoundTag *tag)
tag->putShort(L"xTile", (short) xTile);
tag->putShort(L"yTile", (short) yTile);
tag->putShort(L"zTile", (short) zTile);
tag->putByte(L"inTile", (byte) lastTile);
tag->putByte(L"shake", (byte) shakeTime);
tag->putByte(L"inGround", (byte) (inGround ? 1 : 0));
tag->putByte(L"inTile", (uint8_t) lastTile);
tag->putByte(L"shake", (uint8_t) shakeTime);
tag->putByte(L"inGround", (uint8_t) (inGround ? 1 : 0));
}
void Throwable::readAdditionalSaveData(CompoundTag *tag)
@@ -10,7 +10,7 @@ void ConsoleSaveFileConverter::ProcessSimpleFile(ConsoleSaveFile *sourceSave, Fi
DWORD numberOfBytesRead = 0;
DWORD numberOfBytesWritten = 0;
byte *data = new byte[sourceFileEntry->getFileSize()];
uint8_t *data = new uint8_t[sourceFileEntry->getFileSize()];
// Read from source
sourceSave->readFile(sourceFileEntry, data, sourceFileEntry->getFileSize(), &numberOfBytesRead);
@@ -25,7 +25,7 @@ ConsoleSaveFileInputStream::ConsoleSaveFileInputStream(ConsoleSaveFile *saveFile
//the next byte of data, or -1 if the end of the file is reached.
int ConsoleSaveFileInputStream::read()
{
byte byteRead = static_cast<byte>(0);
uint8_t byteRead = static_cast<uint8_t>(0);
DWORD numberOfBytesRead;
BOOL result = m_saveFile->readFile(
@@ -243,7 +243,7 @@ void ConsoleSaveFileOriginal::deleteFile( FileEntry *file )
const int bufferSize = 4096;
int amountToRead = bufferSize;
byte buffer[bufferSize];
uint8_t buffer[bufferSize];
DWORD bufferDataSize = 0;
@@ -474,8 +474,8 @@ void ConsoleSaveFileOriginal::MoveDataBeyond(FileEntry *file, DWORD nNumberOfByt
const DWORD bufferSize = 4096;
DWORD amountToRead = bufferSize;
//assert( nNumberOfBytesToWrite <= bufferSize );
static byte buffer1[bufferSize];
static byte buffer2[bufferSize];
static uint8_t buffer1[bufferSize];
static uint8_t buffer2[bufferSize];
DWORD buffer1Size = 0;
DWORD buffer2Size = 0;
@@ -666,11 +666,11 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail )
// On PS3, don't compress the data as we can't really afford the extra memory this requires for the output buffer. Instead we'll be writing
// directly from the save data.
StorageManager.SetSaveData(pvSaveMem,fileSize);
byte *compData = (byte *)pvSaveMem;
uint8_t *compData = (uint8_t *)pvSaveMem;
#else
// Attempt to allocate the required memory
// We do not own this, it belongs to the StorageManager
byte *compData = (byte *)StorageManager.AllocateSaveData( compLength );
uint8_t *compData = (uint8_t *)StorageManager.AllocateSaveData( compLength );
#ifdef __PSVITA__
// AP - make sure we always allocate just what is needed so it will only SAVE what is needed.
@@ -708,7 +708,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail )
compLength = compLength+8;
// Attempt to allocate the required memory
compData = (byte *)StorageManager.AllocateSaveData( compLength );
compData = (uint8_t *)StorageManager.AllocateSaveData( compLength );
}
#endif
@@ -38,7 +38,7 @@ void ConsoleSaveFileOutputStream::write(unsigned int b)
{
DWORD numberOfBytesWritten;
byte value = (byte) b;
uint8_t value = (uint8_t) b;
BOOL result = m_saveFile->writeFile(
m_file,
@@ -641,7 +641,7 @@ void ConsoleSaveFileSplit::deleteFile( FileEntry *file )
const int bufferSize = 4096;
int amountToRead = bufferSize;
byte buffer[bufferSize];
uint8_t buffer[bufferSize];
DWORD bufferDataSize = 0;
@@ -1044,8 +1044,8 @@ void ConsoleSaveFileSplit::MoveDataBeyond(FileEntry *file, DWORD nNumberOfBytesT
const DWORD bufferSize = 4096;
DWORD amountToRead = bufferSize;
//assert( nNumberOfBytesToWrite <= bufferSize );
static byte buffer1[bufferSize];
static byte buffer2[bufferSize];
static uint8_t buffer1[bufferSize];
static uint8_t buffer2[bufferSize];
DWORD buffer1Size = 0;
DWORD buffer2Size = 0;
@@ -1352,7 +1352,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail)
// Attempt to allocate the required memory
// We do not own this, it belongs to the StorageManager
byte *compData = (byte *)StorageManager.AllocateSaveData( compLength );
uint8_t *compData = (uint8_t *)StorageManager.AllocateSaveData( compLength );
// If we failed to allocate then compData will be NULL
// Pre-calculate the compressed data size so that we can attempt to allocate a smaller buffer
@@ -1379,7 +1379,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail)
compLength = compLength+8;
// Attempt to allocate the required memory
compData = (byte *)StorageManager.AllocateSaveData( compLength );
compData = (uint8_t *)StorageManager.AllocateSaveData( compLength );
}
if(compData != NULL)
+1 -1
View File
@@ -84,7 +84,7 @@ ssize_t ReadFile(int fd, void* buffer, size_t byteRead, DWORD* numberOfBytesRead
//the next byte of data, or -1 if the end of the file is reached.
int FileInputStream::read()
{
byte byteRead = static_cast<byte>(0);
uint8_t byteRead = static_cast<uint8_t>(0);
DWORD numberOfBytesRead;
BOOL bSuccess = ReadFile(
@@ -74,7 +74,7 @@ FileOutputStream::~FileOutputStream()
//b - the byte to be written.
void FileOutputStream::write(unsigned int b)
{
byte value = (byte) b;
uint8_t value = (uint8_t) b;
#if defined(_WIN32)
BOOL result = WriteFile(
+1 -1
View File
@@ -25,7 +25,7 @@ public:
dis->readFully(data);
}
byte getId() { return TAG_Byte_Array; }
uint8_t getId() { return TAG_Byte_Array; }
wstring toString()
{
+3 -3
View File
@@ -4,14 +4,14 @@
class ByteTag : public Tag
{
public:
byte data;
uint8_t data;
ByteTag(const wstring &name) : Tag(name) {}
ByteTag(const wstring &name, byte data) : Tag(name) {this->data = data; }
ByteTag(const wstring &name, uint8_t data) : Tag(name) {this->data = data; }
void write(DataOutput *dos) { dos->writeByte(data); }
void load(DataInput *dis) { data = dis->readByte(); }
byte getId() { return TAG_Byte; }
uint8_t getId() { return TAG_Byte; }
wstring toString()
{
static wchar_t buf[32];
+6 -6
View File
@@ -55,7 +55,7 @@ public:
return ret;
}
byte getId()
uint8_t getId()
{
return TAG_Compound;
}
@@ -65,7 +65,7 @@ public:
tags[name] = tag->setName(wstring( name ));
}
void putByte(const wchar_t * name, byte value)
void putByte(const wchar_t * name, uint8_t value)
{
tags[name] = (new ByteTag(name,value));
}
@@ -117,7 +117,7 @@ public:
void putBoolean(const wchar_t * string, bool val)
{
putByte(string, val?static_cast<byte>(1):static_cast<byte>(0));
putByte(string, val?static_cast<uint8_t>(1):static_cast<uint8_t>(0));
}
Tag *get(const wchar_t *name)
@@ -132,9 +132,9 @@ public:
return tags.find(name) != tags.end();
}
byte getByte(const wchar_t * name)
uint8_t getByte(const wchar_t * name)
{
if (tags.find(name) == tags.end()) return (byte)0;
if (tags.find(name) == tags.end()) return (uint8_t)0;
return ((ByteTag *) tags[name])->data;
}
@@ -200,7 +200,7 @@ public:
bool getBoolean(const wchar_t *string)
{
return getByte(string) != static_cast<byte>(0);
return getByte(string) != static_cast<uint8_t>(0);
}
void remove(const wstring &name)
+1 -1
View File
@@ -12,7 +12,7 @@ public:
void write(DataOutput *dos) { dos->writeDouble(data); }
void load(DataInput *dis) { data = dis->readDouble(); }
byte getId() { return TAG_Double; }
uint8_t getId() { return TAG_Double; }
wstring toString()
{
static wchar_t buf[32];
+1 -1
View File
@@ -10,7 +10,7 @@ public:
void load(DataInput *dis) {};
void write(DataOutput *dos) {};
byte getId() { return TAG_End; }
uint8_t getId() { return TAG_End; }
wstring toString() { return wstring( L"END" ); }
Tag *copy()
+1 -1
View File
@@ -12,7 +12,7 @@ public:
void write(DataOutput *dos) { dos->writeFloat(data); }
void load(DataInput *dis) { data = dis->readFloat(); }
byte getId() { return TAG_Float; }
uint8_t getId() { return TAG_Float; }
wstring toString()
{
static wchar_t buf[32];
+1 -1
View File
@@ -38,7 +38,7 @@ public:
}
}
byte getId() { return TAG_Int_Array; }
uint8_t getId() { return TAG_Int_Array; }
wstring toString()
{
+1 -1
View File
@@ -11,7 +11,7 @@ public:
void write(DataOutput *dos) { dos->writeInt(data); }
void load(DataInput *dis) { data = dis->readInt(); }
byte getId() { return TAG_Int; }
uint8_t getId() { return TAG_Int; }
wstring toString()
{
static wchar_t buf[32];
+3 -3
View File
@@ -6,7 +6,7 @@ template <class T> class ListTag : public Tag
{
private:
vector<Tag *> list;
byte type;
uint8_t type;
public:
ListTag() : Tag(L"") {}
@@ -15,7 +15,7 @@ public:
void write(DataOutput *dos)
{
if (list.size() > 0) type = (list[0])->getId();
else type = static_cast<byte>(1);
else type = static_cast<uint8_t>(1);
dos->writeByte(type);
dos->writeInt((int)list.size());
@@ -38,7 +38,7 @@ public:
}
}
byte getId() { return TAG_List; }
uint8_t getId() { return TAG_List; }
wstring toString()
{
+1 -1
View File
@@ -11,7 +11,7 @@ public:
void write(DataOutput *dos) { dos->writeLong(data); }
void load(DataInput *dis) { data = dis->readLong(); }
byte getId() { return TAG_Long; }
uint8_t getId() { return TAG_Long; }
wstring toString()
{
static wchar_t buf[32];
+1 -1
View File
@@ -11,7 +11,7 @@ public:
void write(DataOutput *dos) { dos->writeShort(data); }
void load(DataInput *dis) { data = dis->readShort(); }
byte getId() { return TAG_Short; }
uint8_t getId() { return TAG_Short; }
wstring toString()
{
static wchar_t buf[32];
+1 -1
View File
@@ -18,7 +18,7 @@ public:
data = dis->readUTF();
}
byte getId() { return TAG_String; }
uint8_t getId() { return TAG_String; }
wstring toString()
{
+4 -4
View File
@@ -79,7 +79,7 @@ Tag *Tag::setName(const wstring& name)
Tag *Tag::readNamedTag(DataInput *dis)
{
byte type = dis->readByte();
uint8_t type = dis->readByte();
if ( static_cast<int>(type) == 0) return new EndTag();
// 4J Stu - readByte can return -1, so if it's that then also mark as the end tag
@@ -96,7 +96,7 @@ Tag *Tag::readNamedTag(DataInput *dis)
Tag *tag = newTag(type, name);
// short length = dis.readShort();
// byte[] bytes = new byte[length];
// byte[] bytes = new uint8_t[length];
// dis.readFully(bytes);
tag->load(dis);
@@ -116,7 +116,7 @@ void Tag::writeNamedTag(Tag *tag, DataOutput *dos)
tag->write(dos);
}
Tag *Tag::newTag(byte type, const wstring &name)
Tag *Tag::newTag(uint8_t type, const wstring &name)
{
switch (type)
{
@@ -148,7 +148,7 @@ Tag *Tag::newTag(byte type, const wstring &name)
return NULL;
}
const wchar_t *Tag::getTagName(byte type)
const wchar_t *Tag::getTagName(uint8_t type)
{
switch (type)
{
+15 -15
View File
@@ -7,18 +7,18 @@ using namespace std;
class Tag
{
public:
static const byte TAG_End = static_cast<byte>(0);
static const byte TAG_Byte = static_cast<byte>(1);
static const byte TAG_Short = static_cast<byte>(2);
static const byte TAG_Int = static_cast<byte>(3);
static const byte TAG_Long = static_cast<byte>(4);
static const byte TAG_Float = static_cast<byte>(5);
static const byte TAG_Double = static_cast<byte>(6);
static const byte TAG_Byte_Array = static_cast<byte>(7);
static const byte TAG_String = static_cast<byte>(8);
static const byte TAG_List = static_cast<byte>(9);
static const byte TAG_Compound = static_cast<byte>(10);
static const byte TAG_Int_Array = static_cast<byte>(11);
static const uint8_t TAG_End = static_cast<uint8_t>(0);
static const uint8_t TAG_Byte = static_cast<uint8_t>(1);
static const uint8_t TAG_Short = static_cast<uint8_t>(2);
static const uint8_t TAG_Int = static_cast<uint8_t>(3);
static const uint8_t TAG_Long = static_cast<uint8_t>(4);
static const uint8_t TAG_Float = static_cast<uint8_t>(5);
static const uint8_t TAG_Double = static_cast<uint8_t>(6);
static const uint8_t TAG_Byte_Array = static_cast<uint8_t>(7);
static const uint8_t TAG_String = static_cast<uint8_t>(8);
static const uint8_t TAG_List = static_cast<uint8_t>(9);
static const uint8_t TAG_Compound = static_cast<uint8_t>(10);
static const uint8_t TAG_Int_Array = static_cast<uint8_t>(11);
private:
wstring name;
@@ -30,15 +30,15 @@ public:
virtual void write(DataOutput *dos) = 0;
virtual void load(DataInput *dis) = 0;
virtual wstring toString() = 0;
virtual byte getId() = 0;
virtual uint8_t getId() = 0;
void print(ostream out);
void print(char *prefix, wostream out);
wstring getName();
Tag *setName(const wstring& name);
static Tag *readNamedTag(DataInput *dis);
static void writeNamedTag(Tag *tag, DataOutput *dos);
static Tag *newTag(byte type, const wstring &name);
static const wchar_t *getTagName(byte type);
static Tag *newTag(uint8_t type, const wstring &name);
static const wchar_t *getTagName(uint8_t type);
virtual ~Tag() {}
virtual bool equals(Tag *obj); // 4J Brought forward from 1.2
virtual Tag *copy() = 0; // 4J Brought foward from 1.2
@@ -79,7 +79,7 @@ void BufferedOutputStream::write(byteArray b)
//b - the byte to be written.
void BufferedOutputStream::write(unsigned int b)
{
buf[count++] = (byte) b;
buf[count++] = (uint8_t) b;
if( count == buf.length )
{
flush();
@@ -33,7 +33,7 @@ void ByteArrayOutputStream::write(unsigned int b)
if( count + 1 >= buf.length )
buf.resize( buf.length * 2 );
buf[count] = (byte) b;
buf[count] = (uint8_t) b;
count++;
}
+45 -45
View File
@@ -7,8 +7,8 @@
ByteBuffer::ByteBuffer( unsigned int capacity ) : Buffer( capacity )
{
hasBackingArray = false;
buffer = new byte[capacity];
memset( buffer,0,sizeof(byte)*capacity);
buffer = new uint8_t[capacity];
memset( buffer,0,sizeof(uint8_t)*capacity);
byteOrder = BIGENDIAN;
}
@@ -25,7 +25,7 @@ ByteBuffer *ByteBuffer::allocateDirect(int capacity)
}
ByteBuffer::ByteBuffer( unsigned int capacity, byte *backingArray ) : Buffer( capacity )
ByteBuffer::ByteBuffer( unsigned int capacity, uint8_t *backingArray ) : Buffer( capacity )
{
hasBackingArray = true;
buffer = backingArray;
@@ -38,7 +38,7 @@ ByteBuffer::~ByteBuffer()
}
//Wraps a byte array into a buffer.
//The new buffer will be backed by the given byte array; that is, modifications to the buffer will cause the array
//The new buffer will be backed by the given uint8_t array; that is, modifications to the buffer will cause the array
//to be modified and vice versa. The new buffer's capacity and limit will be array.length, its position will be zero,
//and its mark will be undefined. Its backing array will be the given array, and its array offset will be zero.
//
@@ -85,7 +85,7 @@ ByteBuffer *ByteBuffer::flip()
}
// 4J Added so we can write this to a file
byte *ByteBuffer::getBuffer()
uint8_t *ByteBuffer::getBuffer()
{
return buffer;
}
@@ -104,7 +104,7 @@ int ByteBuffer::getSize()
//The byte at the given index
//Throws:
//IndexOutOfBoundsException - If index is negative or not smaller than the buffer's limit
byte ByteBuffer::get(int index)
uint8_t ByteBuffer::get(int index)
{
assert( index < m_limit );
assert( index >= 0 );
@@ -253,7 +253,7 @@ void ByteBuffer::getShortArray(shortArray &s)
//Throws:
//IndexOutOfBoundsException - If index is negative or not smaller than the buffer's limit
//ReadOnlyBufferException - If this buffer is read-only
ByteBuffer *ByteBuffer::put(int index, byte b)
ByteBuffer *ByteBuffer::put(int index, uint8_t b)
{
assert( index < m_limit );
assert( index >= 0 );
@@ -277,17 +277,17 @@ ByteBuffer *ByteBuffer::putInt(int value)
if( byteOrder == BIGENDIAN )
{
buffer[m_position] = static_cast<byte>((value >> 24) & 0xFF);
buffer[m_position+1] = static_cast<byte>((value >> 16) & 0xFF);
buffer[m_position+2] = static_cast<byte>((value >> 8) & 0xFF);
buffer[m_position+3] = static_cast<byte>(value & 0xFF);
buffer[m_position] = static_cast<uint8_t>((value >> 24) & 0xFF);
buffer[m_position+1] = static_cast<uint8_t>((value >> 16) & 0xFF);
buffer[m_position+2] = static_cast<uint8_t>((value >> 8) & 0xFF);
buffer[m_position+3] = static_cast<uint8_t>(value & 0xFF);
}
else if( byteOrder == LITTLEENDIAN )
{
buffer[m_position] = static_cast<byte>(value & 0xFF);
buffer[m_position+1] = static_cast<byte>((value >> 8) & 0xFF);
buffer[m_position+2] = static_cast<byte>((value >> 16) & 0xFF);
buffer[m_position+3] = static_cast<byte>((value >> 24) & 0xFF);
buffer[m_position] = static_cast<uint8_t>(value & 0xFF);
buffer[m_position+1] = static_cast<uint8_t>((value >> 8) & 0xFF);
buffer[m_position+2] = static_cast<uint8_t>((value >> 16) & 0xFF);
buffer[m_position+3] = static_cast<uint8_t>((value >> 24) & 0xFF);
}
m_position += 4;
@@ -309,17 +309,17 @@ ByteBuffer *ByteBuffer::putInt(unsigned int index, int value)
if( byteOrder == BIGENDIAN )
{
buffer[index] = static_cast<byte>((value >> 24) & 0xFF);
buffer[index+1] = static_cast<byte>((value >> 16) & 0xFF);
buffer[index+2] = static_cast<byte>((value >> 8) & 0xFF);
buffer[index+3] = static_cast<byte>(value & 0xFF);
buffer[index] = static_cast<uint8_t>((value >> 24) & 0xFF);
buffer[index+1] = static_cast<uint8_t>((value >> 16) & 0xFF);
buffer[index+2] = static_cast<uint8_t>((value >> 8) & 0xFF);
buffer[index+3] = static_cast<uint8_t>(value & 0xFF);
}
else if( byteOrder == LITTLEENDIAN )
{
buffer[index] = static_cast<byte>(value & 0xFF);
buffer[index+1] = static_cast<byte>((value >> 8) & 0xFF);
buffer[index+2] = static_cast<byte>((value >> 16) & 0xFF);
buffer[index+3] = static_cast<byte>((value >> 24) & 0xFF);
buffer[index] = static_cast<uint8_t>(value & 0xFF);
buffer[index+1] = static_cast<uint8_t>((value >> 8) & 0xFF);
buffer[index+2] = static_cast<uint8_t>((value >> 16) & 0xFF);
buffer[index+3] = static_cast<uint8_t>((value >> 24) & 0xFF);
}
return this;
@@ -339,13 +339,13 @@ ByteBuffer *ByteBuffer::putShort(short value)
if( byteOrder == BIGENDIAN )
{
buffer[m_position] = static_cast<byte>((value >> 8) & 0xFF);
buffer[m_position+1] = static_cast<byte>(value & 0xFF);
buffer[m_position] = static_cast<uint8_t>((value >> 8) & 0xFF);
buffer[m_position+1] = static_cast<uint8_t>(value & 0xFF);
}
else if( byteOrder == LITTLEENDIAN )
{
buffer[m_position] = static_cast<byte>(value & 0xFF);
buffer[m_position+1] = static_cast<byte>((value >> 8) & 0xFF);
buffer[m_position] = static_cast<uint8_t>(value & 0xFF);
buffer[m_position+1] = static_cast<uint8_t>((value >> 8) & 0xFF);
}
m_position += 2;
@@ -379,25 +379,25 @@ ByteBuffer *ByteBuffer::putLong(__int64 value)
if( byteOrder == BIGENDIAN )
{
buffer[m_position] = static_cast<byte>((value >> 56) & 0xFF);
buffer[m_position+1] = static_cast<byte>((value >> 48) & 0xFF);
buffer[m_position+2] = static_cast<byte>((value >> 40) & 0xFF);
buffer[m_position+3] = static_cast<byte>((value >> 32) & 0xFF);
buffer[m_position+4] = static_cast<byte>((value >> 24) & 0xFF);
buffer[m_position+5] = static_cast<byte>((value >> 16) & 0xFF);
buffer[m_position+6] = static_cast<byte>((value >> 8) & 0xFF);
buffer[m_position+7] = static_cast<byte>(value & 0xFF);
buffer[m_position] = static_cast<uint8_t>((value >> 56) & 0xFF);
buffer[m_position+1] = static_cast<uint8_t>((value >> 48) & 0xFF);
buffer[m_position+2] = static_cast<uint8_t>((value >> 40) & 0xFF);
buffer[m_position+3] = static_cast<uint8_t>((value >> 32) & 0xFF);
buffer[m_position+4] = static_cast<uint8_t>((value >> 24) & 0xFF);
buffer[m_position+5] = static_cast<uint8_t>((value >> 16) & 0xFF);
buffer[m_position+6] = static_cast<uint8_t>((value >> 8) & 0xFF);
buffer[m_position+7] = static_cast<uint8_t>(value & 0xFF);
}
else if( byteOrder == LITTLEENDIAN )
{
buffer[m_position] = static_cast<byte>((value & 0xFF));
buffer[m_position+1] = static_cast<byte>((value >> 8) & 0xFF);
buffer[m_position+2] = static_cast<byte>((value >> 16) & 0xFF);
buffer[m_position+3] = static_cast<byte>((value >> 24) & 0xFF);
buffer[m_position+4] = static_cast<byte>((value >> 32) & 0xFF);
buffer[m_position+5] = static_cast<byte>((value >> 40) & 0xFF);
buffer[m_position+6] = static_cast<byte>((value >> 48) & 0xFF);
buffer[m_position+7] = static_cast<byte>((value >> 56) & 0xFF);
buffer[m_position] = static_cast<uint8_t>((value & 0xFF));
buffer[m_position+1] = static_cast<uint8_t>((value >> 8) & 0xFF);
buffer[m_position+2] = static_cast<uint8_t>((value >> 16) & 0xFF);
buffer[m_position+3] = static_cast<uint8_t>((value >> 24) & 0xFF);
buffer[m_position+4] = static_cast<uint8_t>((value >> 32) & 0xFF);
buffer[m_position+5] = static_cast<uint8_t>((value >> 40) & 0xFF);
buffer[m_position+6] = static_cast<uint8_t>((value >> 48) & 0xFF);
buffer[m_position+7] = static_cast<uint8_t>((value >> 56) & 0xFF);
}
return this;
@@ -464,9 +464,9 @@ 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(capacity, (byte*)RenderManager.allocIOMem(capacity, 64))
: ByteBuffer(capacity, (uint8_t*)RenderManager.allocIOMem(capacity, 64))
{
memset( buffer,0,sizeof(byte)*capacity);
memset( buffer,0,sizeof(uint8_t)*capacity);
byteOrder = BIGENDIAN;
}
+5 -5
View File
@@ -9,29 +9,29 @@ class FloatBuffer;
class ByteBuffer : public Buffer
{
protected:
byte *buffer;
uint8_t *buffer;
ByteOrder byteOrder;
public:
ByteBuffer(unsigned int capacity);
static ByteBuffer *allocateDirect(int capacity);
ByteBuffer( unsigned int capacity, byte *backingArray );
ByteBuffer( unsigned int capacity, uint8_t *backingArray );
virtual ~ByteBuffer();
static ByteBuffer *wrap(byteArray &b);
static ByteBuffer *allocate(unsigned int capacity);
void order(ByteOrder a);
ByteBuffer *flip();
byte *getBuffer();
uint8_t *getBuffer();
int getSize();
int getInt();
int getInt(unsigned int index);
void get(byteArray) {} // 4J - TODO
byte get(int index);
uint8_t get(int index);
__int64 getLong();
short getShort();
void getShortArray(shortArray &s);
ByteBuffer *put(int index, byte b);
ByteBuffer *put(int index, uint8_t b);
ByteBuffer *putInt(int value);
ByteBuffer *putInt(unsigned int index, int value);
ByteBuffer *putShort(short value);
+1 -1
View File
@@ -7,7 +7,7 @@ public:
virtual int read(byteArray b) = 0;
virtual int read(byteArray b, unsigned int offset, unsigned int length) = 0;
virtual bool readBoolean() = 0;
virtual byte readByte() = 0;
virtual uint8_t readByte() = 0;
virtual unsigned char readUnsignedByte() = 0;
virtual bool readFully(byteArray a) = 0;
virtual double readDouble() = 0;
@@ -60,7 +60,7 @@ int DataInputStream::read(byteArray b)
//This method blocks until input data is available, end of file is detected, or an exception is thrown.
//
//If len is zero, then no bytes are read and 0 is returned; otherwise, there is an attempt to read at least one byte.
//If no byte is available because the stream is at end of file, the value -1 is returned; otherwise, at least one byte is read and stored into b.
//If no uint8_t is available because the stream is at end of file, the value -1 is returned; otherwise, at least one byte is read and stored into b.
//
//The first byte read is stored into element b[off], the next one into b[off+1], and so on. The number of bytes read is,
//at most, equal to len. Let k be the number of bytes actually read; these bytes will be stored in elements b[off] through b[off+k-1],
@@ -115,14 +115,14 @@ bool DataInputStream::readBoolean()
//This method is suitable for reading the byte written by the writeByte method of interface DataOutput.
//Returns:
//the 8-bit value read.
byte DataInputStream::readByte()
uint8_t DataInputStream::readByte()
{
if (stream == NULL)
{
app.DebugPrintf("DataInputStream::readByte() but underlying stream is NULL\n");
return 0;
}
return (byte) stream->read();
return (uint8_t) stream->read();
}
unsigned char DataInputStream::readUnsignedByte()
@@ -183,7 +183,7 @@ bool DataInputStream::readFully(byteArray b)
}
else
{
b[i] = static_cast<byte>(byteRead);
b[i] = static_cast<uint8_t>(byteRead);
}
}
return true;
+1 -1
View File
@@ -16,7 +16,7 @@ public:
virtual int read(byteArray b, unsigned int offset, unsigned int length);
virtual void close();
virtual bool readBoolean();
virtual byte readByte();
virtual uint8_t readByte();
virtual unsigned char readUnsignedByte();
virtual wchar_t readChar();
virtual bool readFully(byteArray b);
+1 -1
View File
@@ -6,7 +6,7 @@ public:
virtual void write(unsigned int b) = 0;
virtual void write(byteArray b) = 0;
virtual void write(byteArray b, unsigned int offset, unsigned int length) = 0;
virtual void writeByte(byte a) = 0;
virtual void writeByte(uint8_t a) = 0;
virtual void writeDouble(double a) = 0;
virtual void writeFloat(float a) = 0;
virtual void writeInt(int a) = 0;
+11 -11
View File
@@ -66,7 +66,7 @@ void DataOutputStream::close()
//Writes out a byte to the underlying output stream as a 1-byte value. If no exception is thrown, the counter written is incremented by 1.
//Parameters:
//v - a byte value to be written.
void DataOutputStream::writeByte(byte a)
void DataOutputStream::writeByte(uint8_t a)
{
stream->write( static_cast<unsigned int>(a) );
}
@@ -170,7 +170,7 @@ void DataOutputStream::writeChars(const wstring& str)
}
//Writes a boolean to the underlying output stream as a 1-byte value.
//The value true is written out as the value (byte)1; the value false is written out as the value (byte)0.
//The value true is written out as the value (uint8_t)1; the value false is written out as the value (uint8_t)0.
//If no exception is thrown, the counter written is incremented by 1.
//Parameters:
//v - a boolean value to be written.
@@ -219,15 +219,15 @@ void DataOutputStream::writeUTF(const wstring& str)
byteArray bytearr(utflen+2);
bytearr[count++] = (byte) ((utflen >> 8) & 0xFF);
bytearr[count++] = (byte) ((utflen >> 0) & 0xFF);
bytearr[count++] = (uint8_t) ((utflen >> 8) & 0xFF);
bytearr[count++] = (uint8_t) ((utflen >> 0) & 0xFF);
int i=0;
for (i=0; i<strlen; i++)
{
c = str.at(i);
if (!((c >= 0x0001) && (c <= 0x007F))) break;
bytearr[count++] = (byte) c;
bytearr[count++] = (uint8_t) c;
}
for (;i < strlen; i++)
@@ -235,19 +235,19 @@ void DataOutputStream::writeUTF(const wstring& str)
c = str.at(i);
if ((c >= 0x0001) && (c <= 0x007F))
{
bytearr[count++] = (byte) c;
bytearr[count++] = (uint8_t) c;
}
else if (c > 0x07FF)
{
bytearr[count++] = (byte) (0xE0 | ((c >> 12) & 0x0F));
bytearr[count++] = (byte) (0x80 | ((c >> 6) & 0x3F));
bytearr[count++] = (byte) (0x80 | ((c >> 0) & 0x3F));
bytearr[count++] = (uint8_t) (0xE0 | ((c >> 12) & 0x0F));
bytearr[count++] = (uint8_t) (0x80 | ((c >> 6) & 0x3F));
bytearr[count++] = (uint8_t) (0x80 | ((c >> 0) & 0x3F));
}
else
{
bytearr[count++] = (byte) (0xC0 | ((c >> 6) & 0x1F));
bytearr[count++] = (byte) (0x80 | ((c >> 0) & 0x3F));
bytearr[count++] = (uint8_t) (0xC0 | ((c >> 6) & 0x1F));
bytearr[count++] = (uint8_t) (0x80 | ((c >> 0) & 0x3F));
}
}
write(bytearr, 0, utflen+2);
@@ -22,7 +22,7 @@ public:
virtual void write(byteArray b);
virtual void write(byteArray b, unsigned int offset, unsigned int length);
virtual void close();
virtual void writeByte(byte a);
virtual void writeByte(uint8_t a);
virtual void writeDouble(double a);
virtual void writeFloat(float a);
virtual void writeInt(int a);
+2 -2
View File
@@ -139,7 +139,7 @@ shared_ptr<ItemInstance> ItemInstance::useTimeDepleted(Level *level, shared_ptr<
CompoundTag *ItemInstance::save(CompoundTag *compoundTag)
{
compoundTag->putShort(L"id", (short) id);
compoundTag->putByte(L"Count", (byte) count);
compoundTag->putByte(L"Count", (uint8_t) count);
compoundTag->putShort(L"Damage", (short) auxValue);
if (this->tag != NULL) compoundTag->put(L"tag", tag->copy());
return compoundTag;
@@ -622,7 +622,7 @@ void ItemInstance::enchant(const Enchantment *enchantment, int level)
ListTag<CompoundTag> *list = (ListTag<CompoundTag> *) tag->get(L"ench");
CompoundTag *ench = new CompoundTag();
ench->putShort((wchar_t *)TAG_ENCH_ID, (short) enchantment->id);
ench->putShort((wchar_t *)TAG_ENCH_LEVEL, (byte) level);
ench->putShort((wchar_t *)TAG_ENCH_LEVEL, (uint8_t) level);
list->add(ench);
}
+4 -4
View File
@@ -74,7 +74,7 @@ shared_ptr<MapItemSavedData> MapItem::getSavedData(shared_ptr<ItemInstance> item
mapItemSavedData->x = Math::round((float) level->getLevelData()->getXSpawn() / scale) * scale;
mapItemSavedData->z = Math::round(level->getLevelData()->getZSpawn() / scale) * scale;
#endif
mapItemSavedData->dimension = (byte) level->dimension->id;
mapItemSavedData->dimension = (uint8_t) level->dimension->id;
mapItemSavedData->setDirty();
@@ -243,8 +243,8 @@ void MapItem::update(Level *level, shared_ptr<Entity> player, shared_ptr<MapItem
{
continue;
}
byte oldColor = data->colors[x + z * w];
byte newColor = (byte) (col * 4 + br);
uint8_t oldColor = data->colors[x + z * w];
uint8_t newColor = (uint8_t) (col * 4 + br);
if (oldColor != newColor)
{
if (yd0 > z) yd0 = z;
@@ -331,7 +331,7 @@ void MapItem::onCraftedBy(shared_ptr<ItemInstance> itemInstance, Level *level, s
// 4J-PB - for Xbox maps, we'll centre them on the origin of the world, since we can fit the whole world in our map
data->x = centreXC;
data->z = centreZC;
data->dimension = (byte) level->dimension->id;
data->dimension = (uint8_t) level->dimension->id;
data->setDirty();
}
+1 -1
View File
@@ -8,7 +8,7 @@ void BlockReplacements::staticCtor()
{
for (int i = 0; i < 256; i++)
{
byte b = (byte) i;
uint8_t b = (uint8_t) i;
if (b != 0 && Tile::tiles[b & 0xff] == NULL)
{
b = 0;
+10 -10
View File
@@ -202,11 +202,11 @@ void CustomLevelSource::prepareHeights(int xOffs, int zOffs, byteArray blocks)
// 4J - this comparison used to just be with 0.0f but is now varied by block above
if (yc * CHUNK_HEIGHT + y < mapHeight)
{
tileId = (byte) Tile::rock_Id;
tileId = (uint8_t) Tile::rock_Id;
}
else if (yc * CHUNK_HEIGHT + y < waterHeight)
{
tileId = (byte) Tile::calmWater_Id;
tileId = (uint8_t) Tile::calmWater_Id;
}
// 4J - more extra code to make sure that the column at the edge of the world is just water & rock, to match the infinite sea that
@@ -264,8 +264,8 @@ void CustomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi
int run = -1;
byte top = b->topMaterial;
byte material = b->material;
uint8_t top = b->topMaterial;
uint8_t material = b->material;
LevelGenerationOptions *lgo = app.getLevelGenerationOptions();
if(lgo != NULL)
@@ -288,7 +288,7 @@ void CustomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi
if (y <= 1 + random->nextInt(2)) // 4J - changed to make the bedrock not have bits you can get stuck in
// if (y <= 0 + random->nextInt(5))
{
blocks[offs] = (byte) Tile::unbreakable_Id;
blocks[offs] = (uint8_t) Tile::unbreakable_Id;
}
else
{
@@ -305,7 +305,7 @@ void CustomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi
if (runDepth <= 0)
{
top = 0;
material = (byte) Tile::rock_Id;
material = (uint8_t) Tile::rock_Id;
}
else if (y >= waterHeight - 4 && y <= waterHeight + 1)
{
@@ -319,8 +319,8 @@ void CustomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi
if (y < waterHeight && top == 0)
{
if (temp < 0.15f) top = (byte) Tile::ice_Id;
else top = (byte) Tile::calmWater_Id;
if (temp < 0.15f) top = (uint8_t) Tile::ice_Id;
else top = (uint8_t) Tile::calmWater_Id;
}
run = runDepth;
@@ -337,7 +337,7 @@ void CustomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi
if (run == 0 && material == Tile::sand_Id)
{
run = random->nextInt(4);
material = (byte) Tile::sandStone_Id;
material = (uint8_t) Tile::sandStone_Id;
}
}
}
@@ -366,7 +366,7 @@ LevelChunk *CustomLevelSource::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 blocksSize = Level::maxBuildHeight * 16 * 16;
byte *tileData = (byte *)XPhysicalAlloc(blocksSize, MAXULONG_PTR, 4096, PAGE_READWRITE);
uint8_t *tileData = (uint8_t *)XPhysicalAlloc(blocksSize, MAXULONG_PTR, 4096, PAGE_READWRITE);
XMemSet128(tileData,0,blocksSize);
byteArray blocks = byteArray(tileData,blocksSize);
// byteArray blocks = byteArray(16 * level->depth * 16);
@@ -19,9 +19,9 @@ void HellDimension::init()
Vec3 *HellDimension::getFogColor(float td, float a) const
{
int colour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Nether_Fog_Colour );
byte redComponent = ((colour>>16)&0xFF);
byte greenComponent = ((colour>>8)&0xFF);
byte blueComponent = ((colour)&0xFF);
uint8_t redComponent = ((colour>>16)&0xFF);
uint8_t greenComponent = ((colour>>8)&0xFF);
uint8_t blueComponent = ((colour)&0xFF);
float rr = (float)redComponent/256;//0.2f;
float gg = (float)greenComponent/256;//0.03f;
+1 -1
View File
@@ -184,7 +184,7 @@ int EmptyLevelChunk::getBlocksAndData(byteArray data, int x0, int y0, int z0, in
}
Arrays::fill(data, p, p + len, (byte) 0);
Arrays::fill(data, p, p + len, (uint8_t) 0);
return len;
}
+1 -1
View File
@@ -4425,7 +4425,7 @@ bool Level::mayInteract(shared_ptr<Player> player, int xt, int yt, int zt, int c
}
void Level::broadcastEntityEvent(shared_ptr<Entity> e, byte event)
void Level::broadcastEntityEvent(shared_ptr<Entity> e, uint8_t event)
{
}
+1 -1
View File
@@ -458,7 +458,7 @@ public:
void setSpawnPos(Pos *spawnPos);
void ensureAdded(shared_ptr<Entity> entity);
virtual bool mayInteract(shared_ptr<Player> player, int xt, int yt, int zt, int content);
virtual void broadcastEntityEvent(shared_ptr<Entity> e, byte event);
virtual void broadcastEntityEvent(shared_ptr<Entity> e, uint8_t event);
ChunkSource *getChunkSource();
virtual void tileEvent(int x, int y, int z, int tile, int b0, int b1);
LevelStorage *getLevelStorage();
+5 -5
View File
@@ -525,7 +525,7 @@ void LevelChunk::recalcHeightmapOnly()
blocks = (y-1) >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT?upperBlocks : lowerBlocks;
}
#endif
heightmap[z << 4 | x] = (byte) y;
heightmap[z << 4 | x] = (uint8_t) y;
if (y < min) min = y;
}
@@ -581,7 +581,7 @@ void LevelChunk::recalcHeightmap()
blocks = (y-1) >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT?upperBlocks : lowerBlocks;
}
#endif
heightmap[z << 4 | x] = (byte) y;
heightmap[z << 4 | x] = (uint8_t) y;
if (y < min) min = y;
if (!level->dimension->hasCeiling)
@@ -803,7 +803,7 @@ void LevelChunk::recalcHeight(int x, int yStart, int z)
if (y == yOld) return;
// level->lightColumnChanged(x, z, y, yOld); // 4J - this call moved below & corrected - see comment further down
heightmap[z << 4 | x] = (byte) y;
heightmap[z << 4 | x] = (uint8_t) y;
if (y < minHeight)
{
@@ -910,7 +910,7 @@ int LevelChunk::getTile(int x, int y, int z)
bool LevelChunk::setTileAndData(int x, int y, int z, int _tile, int _data)
{
byte tile = (byte) _tile;
uint8_t tile = (uint8_t) _tile;
// Optimisation brought forward from 1.8.2, change from int to unsigned char & this special value changed from -999 to 255
int slot = z << 4 | x;
@@ -1984,7 +1984,7 @@ Biome *LevelChunk::getBiome(int x, int z, BiomeSource *biomeSource)
{
Biome *biome = biomeSource->getBiome((this->x << 4) + x, (this->z << 4) + z);
value = biome->id;
biomes[(z << 4) | x] = (byte) (value & 0xff);
biomes[(z << 4) | x] = (uint8_t) (value & 0xff);
}
if (Biome::biomes[value] == NULL)
{
+10 -10
View File
@@ -200,11 +200,11 @@ void RandomLevelSource::prepareHeights(int xOffs, int zOffs, byteArray blocks)
// 4J - this comparison used to just be with 0.0f but is now varied by block above
if ((val += vala) > comp)
{
tileId = (byte) Tile::rock_Id;
tileId = (uint8_t) Tile::rock_Id;
}
else if (yc * CHUNK_HEIGHT + y < waterHeight)
{
tileId = (byte) Tile::calmWater_Id;
tileId = (uint8_t) Tile::calmWater_Id;
}
// 4J - more extra code to make sure that the column at the edge of the world is just water & rock, to match the infinite sea that
@@ -266,8 +266,8 @@ void RandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi
int run = -1;
byte top = b->topMaterial;
byte material = b->material;
uint8_t top = b->topMaterial;
uint8_t material = b->material;
LevelGenerationOptions *lgo = app.getLevelGenerationOptions();
if(lgo != NULL)
@@ -282,7 +282,7 @@ void RandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi
if (y <= 1 + random->nextInt(2)) // 4J - changed to make the bedrock not have bits you can get stuck in
// if (y <= 0 + random->nextInt(5))
{
blocks[offs] = (byte) Tile::unbreakable_Id;
blocks[offs] = (uint8_t) Tile::unbreakable_Id;
}
else
{
@@ -299,7 +299,7 @@ void RandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi
if (runDepth <= 0)
{
top = 0;
material = (byte) Tile::rock_Id;
material = (uint8_t) Tile::rock_Id;
}
else if (y >= waterHeight - 4 && y <= waterHeight + 1)
{
@@ -313,8 +313,8 @@ void RandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi
if (y < waterHeight && top == 0)
{
if (temp < 0.15f) top = (byte) Tile::ice_Id;
else top = (byte) Tile::calmWater_Id;
if (temp < 0.15f) top = (uint8_t) Tile::ice_Id;
else top = (uint8_t) Tile::calmWater_Id;
}
run = runDepth;
@@ -331,7 +331,7 @@ void RandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi
if (run == 0 && material == Tile::sand_Id)
{
run = random->nextInt(4);
material = (byte) Tile::sandStone_Id;
material = (uint8_t) Tile::sandStone_Id;
}
}
}
@@ -355,7 +355,7 @@ LevelChunk *RandomLevelSource::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 blocksSize = Level::genDepth * 16 * 16;
byte *tileData = (byte *)XPhysicalAlloc(blocksSize, MAXULONG_PTR, 4096, PAGE_READWRITE);
uint8_t *tileData = (uint8_t *)XPhysicalAlloc(blocksSize, MAXULONG_PTR, 4096, PAGE_READWRITE);
XMemSet128(tileData,0,blocksSize);
byteArray blocks = byteArray(tileData,blocksSize);
// byteArray blocks = byteArray(16 * level->depth * 16);
+3 -3
View File
@@ -40,10 +40,10 @@ void DataLayer::set(int x, int y, int z, int val)
if (part == 0)
{
data[slot] = (byte) ((data[slot] & 0xf0) | (val & 0xf));
data[slot] = (uint8_t) ((data[slot] & 0xf0) | (val & 0xf));
} else
{
data[slot] = (byte) ((data[slot] & 0x0f) | ((val & 0xf) << 4));
data[slot] = (uint8_t) ((data[slot] & 0x0f) | ((val & 0xf) << 4));
}
}
@@ -54,7 +54,7 @@ bool DataLayer::isValid()
void DataLayer::setAll(int br)
{
byte val = (byte) (br & (br << 4));
uint8_t val = (uint8_t) (br & (br << 4));
for (unsigned int i = 0; i < data.length; i++)
{
data[i] = val;
@@ -19,7 +19,7 @@ _MapDataMappings::_MapDataMappings()
#ifndef _DURANGO
ZeroMemory(xuids,sizeof(PlayerUID)*MAXIMUM_MAP_SAVE_DATA);
#endif
ZeroMemory(dimensions,sizeof(byte)*(MAXIMUM_MAP_SAVE_DATA/4));
ZeroMemory(dimensions,sizeof(uint8_t)*(MAXIMUM_MAP_SAVE_DATA/4));
}
int _MapDataMappings::getDimension(int id)
@@ -84,7 +84,7 @@ _MapDataMappings_old::_MapDataMappings_old()
#ifndef _DURANGO
ZeroMemory(xuids,sizeof(PlayerUID)*MAXIMUM_MAP_SAVE_DATA);
#endif
ZeroMemory(dimensions,sizeof(byte)*(MAXIMUM_MAP_SAVE_DATA/8));
ZeroMemory(dimensions,sizeof(uint8_t)*(MAXIMUM_MAP_SAVE_DATA/8));
}
int _MapDataMappings_old::getDimension(int id)
@@ -36,7 +36,7 @@ class ConsoleSaveFile;
typedef struct _MapDataMappings
{
PlayerUID xuids[MAXIMUM_MAP_SAVE_DATA];
byte dimensions[MAXIMUM_MAP_SAVE_DATA/4];
uint8_t dimensions[MAXIMUM_MAP_SAVE_DATA/4];
_MapDataMappings();
int getDimension(int id);
@@ -47,7 +47,7 @@ typedef struct _MapDataMappings
typedef struct _MapDataMappings_old
{
PlayerUID xuids[MAXIMUM_MAP_SAVE_DATA];
byte dimensions[MAXIMUM_MAP_SAVE_DATA/8];
uint8_t dimensions[MAXIMUM_MAP_SAVE_DATA/8];
_MapDataMappings_old();
int getDimension(int id);
@@ -302,10 +302,10 @@ void MapItemSavedData::tickCarriedBy(shared_ptr<Player> player, shared_ptr<ItemI
if (xd < -size || yd < -size || xd > size || yd > size)
{
if (xd <= -size) x = (byte) (size * 2 + 2.5);
if (yd <= -size) y = (byte) (size * 2 + 2.5);
if (xd >= size) x = (byte) (size * 2 + 1);
if (yd >= size) y = (byte) (size * 2 + 1);
if (xd <= -size) x = (uint8_t) (size * 2 + 2.5);
if (yd <= -size) y = (uint8_t) (size * 2 + 2.5);
if (xd >= size) x = (uint8_t) (size * 2 + 1);
if (yd >= size) y = (uint8_t) (size * 2 + 1);
}
#endif
//decorations.push_back(new MapDecoration(4, x, y, 0));
@@ -339,10 +339,10 @@ void MapItemSavedData::tickCarriedBy(shared_ptr<Player> player, shared_ptr<ItemI
if (xd < -size || yd < -size || xd > size || yd > size)
{
if (xd <= -size) x = (byte) (size * 2 + 2.5);
if (yd <= -size) y = (byte) (size * 2 + 2.5);
if (xd >= size) x = (byte) (size * 2 + 1);
if (yd >= size) y = (byte) (size * 2 + 1);
if (xd <= -size) x = (uint8_t) (size * 2 + 2.5);
if (yd <= -size) y = (uint8_t) (size * 2 + 2.5);
if (xd >= size) x = (uint8_t) (size * 2 + 1);
if (yd >= size) y = (uint8_t) (size * 2 + 1);
}
#endif
//decorations.push_back(new MapDecoration(7, x, y, 0));
@@ -373,10 +373,10 @@ void MapItemSavedData::tickCarriedBy(shared_ptr<Player> player, shared_ptr<ItemI
if (xd < -size || yd < -size || xd > size || yd > size)
{
if (xd <= -size) x = (byte) (size * 2 + 2.5);
if (yd <= -size) y = (byte) (size * 2 + 2.5);
if (xd >= size) x = (byte) (size * 2 + 1);
if (yd >= size) y = (byte) (size * 2 + 1);
if (xd <= -size) x = (uint8_t) (size * 2 + 2.5);
if (yd <= -size) y = (uint8_t) (size * 2 + 2.5);
if (xd >= size) x = (uint8_t) (size * 2 + 1);
if (yd >= size) y = (uint8_t) (size * 2 + 1);
}
#endif
//decorations.push_back(new MapDecoration(7, x, y, 0));
@@ -432,10 +432,10 @@ void MapItemSavedData::tickCarriedBy(shared_ptr<Player> player, shared_ptr<ItemI
rot = 0;
size--; // Added to match the old adjusted size
if (xd <= -size) x = (byte) (size * 2 + 2.5);
if (yd <= -size) y = (byte) (size * 2 + 2.5);
if (xd >= size) x = (byte) (size * 2 + 1);
if (yd >= size) y = (byte) (size * 2 + 1);
if (xd <= -size) x = (uint8_t) (size * 2 + 2.5);
if (yd <= -size) y = (uint8_t) (size * 2 + 2.5);
if (xd >= size) x = (uint8_t) (size * 2 + 1);
if (yd >= size) y = (uint8_t) (size * 2 + 1);
}
#endif
@@ -546,8 +546,8 @@ void MapItemSavedData::mergeInMapData(shared_ptr<MapItemSavedData> dataToAdd)
for (int z = 0; z < h; z++)
{
byte oldColor = colors[x + z * w];
byte newColor = dataToAdd->colors[x + z * w];
uint8_t oldColor = colors[x + z * w];
uint8_t newColor = dataToAdd->colors[x + z * w];
if (oldColor == 0 && oldColor != newColor)
{
if (yd0 > z) yd0 = z;
@@ -50,7 +50,7 @@ public:
public:
int x, z;
char dimension;
byte scale;
uint8_t scale;
byteArray colors;
int step;
vector<shared_ptr<HoldingPlayer> > carriedBy;
+8 -8
View File
@@ -57,10 +57,10 @@ RegionFile::RegionFile(ConsoleSaveFile *saveFile, File *path)
//if ((GetFileSize(file,NULL) & 0xfff) != 0)
if ((fileEntry->getFileSize() & 0xfff) != 0)
{
//byte zero = 0;
//uint8_t zero = 0;
DWORD numberOfBytesWritten = 0;
DWORD bytesToWrite = 0x1000 - (fileEntry->getFileSize() & 0xfff);
byte *zeroBytes = new byte[ bytesToWrite ];
uint8_t *zeroBytes = new uint8_t[ bytesToWrite ];
ZeroMemory(zeroBytes, bytesToWrite);
/* the file size is not a multiple of 4KB, grow it */
@@ -233,8 +233,8 @@ DataInputStream *RegionFile::getChunkDataInputStream(int x, int z) // TODO - was
}
MemSect(50);
byte *data = new byte[length];
byte *decomp = new byte[decompLength];
uint8_t *data = new uint8_t[length];
uint8_t *decomp = new uint8_t[decompLength];
MemSect(0);
readDecompLength = decompLength;
m_saveFile->readFile(fileEntry,data,length,&numberOfBytesRead);
@@ -273,10 +273,10 @@ DataOutputStream *RegionFile::getChunkDataOutputStream(int x, int z)
}
/* write a chunk at (x,z) with length bytes of data to disk */
void RegionFile::write(int x, int z, byte *data, int length) // TODO - was synchronized
void RegionFile::write(int x, int z, uint8_t *data, int length) // TODO - was synchronized
{
// 4J Stu - Do the compression here so that we know how much space we need to store the compressed data
byte *compData = new byte[length + 2048]; // presuming compression is going to make this smaller... UPDATE - for some really small things this isn't the case. Added 2K on here to cover those.
uint8_t *compData = new uint8_t[length + 2048]; // presuming compression is going to make this smaller... UPDATE - for some really small things this isn't the case. Added 2K on here to cover those.
unsigned int compLength = length;
Compression::getCompression()->CompressLZXRLE(compData,&compLength,data,length);
@@ -403,7 +403,7 @@ void RegionFile::write(int x, int z, byte *data, int length) // TODO - was sync
}
/* write a chunk data to the region file at specified sector number */
void RegionFile::write(int sectorNumber, byte *data, int length, unsigned int compLength)
void RegionFile::write(int sectorNumber, uint8_t *data, int length, unsigned int compLength)
{
DWORD numberOfBytesWritten = 0;
//SetFilePointer(file,sectorNumber * SECTOR_BYTES,0,FILE_BEGIN);
@@ -451,7 +451,7 @@ void RegionFile::insertInitialSectors()
{
m_saveFile->setFilePointer( fileEntry, 0, NULL, FILE_BEGIN );
DWORD numberOfBytesWritten = 0;
byte zeroBytes[ SECTOR_BYTES ];
uint8_t zeroBytes[ SECTOR_BYTES ];
ZeroMemory(zeroBytes, SECTOR_BYTES);
/* we need to write the chunk offset table */
+2 -2
View File
@@ -71,11 +71,11 @@ public:
/* write a chunk at (x,z) with length bytes of data to disk */
protected:
void write(int x, int z, byte *data, int length);
void write(int x, int z, uint8_t *data, int length);
/* write a chunk data to the region file at specified sector number */
private:
void write(int sectorNumber, byte *data, int length, unsigned int compLength);
void write(int sectorNumber, uint8_t *data, int length, unsigned int compLength);
void zero(int sectorNumber, int length); // 4J added
/* is this an invalid chunk coordinate? */
@@ -16,8 +16,8 @@ void AddEntityPacket::_init(shared_ptr<Entity> e, int type, int data, int xp, in
x = xp;//(int) floor(e->x * 32);
y = yp;//(int) floor(e->y * 32);
z = zp;//(int) floor(e->z * 32);
yRot = static_cast<byte>(yRotp);
xRot = static_cast<byte>(xRotp);
yRot = static_cast<uint8_t>(yRotp);
xRot = static_cast<uint8_t>(xRotp);
this->type = type;
this->data = data;
if (data > -1) // 4J - changed "no data" value to be -1, we can have a valid entity id of 0
@@ -79,7 +79,7 @@ void AddEntityPacket::read(DataInputStream *dis) // throws IOException TODO 4J
void AddEntityPacket::write(DataOutputStream *dos) // throws IOException TODO 4J JEV add throws statement
{
dos->writeShort(id);
dos->writeByte(static_cast<byte>(type));
dos->writeByte(static_cast<uint8_t>(type));
#ifdef _LARGE_WORLDS
dos->writeInt(x);
dos->writeInt(y);
@@ -37,7 +37,7 @@ public:
int xa, ya, za;
int type;
int data;
byte yRot,xRot; // 4J added
uint8_t yRot,xRot; // 4J added
private:
void _init(shared_ptr<Entity> e, int type, int data, int xp, int yp, int zp, int yRotp, int xRotp );

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