Creatures are visible

This commit is contained in:
2016-03-29 03:19:17 +11:00
parent 42b37be6f5
commit 8778bfdc4b
4 changed files with 30 additions and 23 deletions
+8 -7
View File
@@ -806,15 +806,16 @@ void ServerApplication::hCharacterMovement(CharacterPacket* const argPacket) {
//TODO: On creature create, etc.
void ServerApplication::hQueryCreatureExists(CreaturePacket* const argPacket) {
//respond with all creature data
CreaturePacket newPacket;
CreatureManager* creatureMgr = roomMgr.Get(argPacket->roomIndex)->GetCreatureMgr();
CreaturePacket newPacket;
for ( auto& it : *(creatureMgr->GetContainer()) ) {
if (distance(argPacket->origin, it.second.GetOrigin()) < 1000) {
copyCreatureToPacket(&newPacket, &(it.second), it.first);
newPacket.type = SerialPacketType::QUERY_CREATURE_EXISTS;
network.SendTo(argPacket->srcAddress, reinterpret_cast<void*>(&newPacket), MAX_PACKET_SIZE);
}
//TODO: move this into the room class
for (auto& it : *(creatureMgr->GetContainer()) ) {
copyCreatureToPacket(&newPacket, &(it.second), it.first);
newPacket.type = SerialPacketType::QUERY_CREATURE_EXISTS;
network.SendTo(argPacket->srcAddress, static_cast<SerialPacket*>(&newPacket));
}
}