Permalink
Browse files

Added some missing casts causing race conditions when opening workben…

…ches.
  • Loading branch information...
1 parent 328cd4a commit 07dff3db18eae8c5865afd48684fcccfa3d9453f @fredreichbier fredreichbier committed Apr 7, 2012
Showing with 5 additions and 5 deletions.
  1. +1 −1 src/blocks/basic.cpp
  2. +4 −4 src/packets.cpp
@@ -243,5 +243,5 @@ void BlockBasic::revertBlock(User* user, int32_t x, int8_t y, int32_t z, int map
{
unsigned char block, meta;
Mineserver::get()->map(map)->getBlock((int)x, (int)y, (int)z, &block, &meta);
- user->buffer << PACKET_BLOCK_CHANGE << (int32_t)x << (int8_t)y << (int32_t)z << (int8_t)block << (int8_t)meta;
+ user->buffer << (int8_t)PACKET_BLOCK_CHANGE << (int32_t)x << (int8_t)y << (int32_t)z << (int8_t)block << (int8_t)meta;
}
View
@@ -941,7 +941,7 @@ int PacketHandler::player_block_placement(User* user)
int32_t EID = Mineserver::generateEID();
Packet pkt;
// MINECART
- pkt << PACKET_ADD_OBJECT << (int32_t)EID << (int8_t)10 << (int32_t)(x * 32 + 16) << (int32_t)(y * 32) << (int32_t)(z * 32 + 16);
+ pkt << (int8_t)PACKET_ADD_OBJECT << (int32_t)EID << (int8_t)10 << (int32_t)(x * 32 + 16) << (int32_t)(y * 32) << (int32_t)(z * 32 + 16);
user->sendAll(pkt);
}
@@ -1310,13 +1310,13 @@ int PacketHandler::use_entity(User* user)
//Attach
if (user->attachedTo == 0)
{
- pkt << PACKET_ATTACH_ENTITY << (int32_t)user->UID << (int32_t)target;
+ pkt << (int8_t)PACKET_ATTACH_ENTITY << (int32_t)user->UID << (int32_t)target;
user->attachedTo = target;
}
//Detach
else
{
- pkt << PACKET_ATTACH_ENTITY << (int32_t)user->UID << (int32_t) - 1;
+ pkt << (int8_t)PACKET_ATTACH_ENTITY << (int32_t)user->UID << (int32_t) - 1;
user->attachedTo = 0;
}
user->sendAll(pkt);
@@ -1339,7 +1339,7 @@ int PacketHandler::use_entity(User* user)
if ((*it)->health <= 0)
{
Packet pkt;
- pkt << PACKET_DEATH_ANIMATION << (int32_t)(*it)->UID << (int8_t)3;
+ pkt << (int8_t)PACKET_DEATH_ANIMATION << (int32_t)(*it)->UID << (int8_t)3;
(*it)->sendOthers(pkt);
}
break;

0 comments on commit 07dff3d

Please sign in to comment.