Skip to content

Commit

Permalink
Added some missing casts causing race conditions when opening workben…
Browse files Browse the repository at this point in the history
…ches.
  • Loading branch information
fredreichbier committed Apr 7, 2012
1 parent 328cd4a commit 07dff3d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/blocks/basic.cpp
Expand Up @@ -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;
}
8 changes: 4 additions & 4 deletions src/packets.cpp
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
Expand All @@ -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;
Expand Down

0 comments on commit 07dff3d

Please sign in to comment.