Zero_master
New Member
- Joined
- Sep 13, 2013
- Messages
- 33
- Reaction score
- 2
Sure, edited last post
void ProtocolGame::AddMapDescription(NetworkMessage_ptr msg, const Position& pos)
{
msg->AddByte(0x64);
msg->AddPosition(player->getPosition());
int32_t x = (pos.x - 10), y = (pos.y - 9), z = (pos.z), width = 22, height = 20, offset = 0, skip = -1;
GetFloorDescription(msg, x, y, z, width, height, offset, skip);
}
int32_t x = (pos.x - 10), y = (pos.y - 9), z = (pos.z), width = 40, height = 30, offset = 0, skip = -1;
GetFloorDescription(msg, x, y, z, width, height, offset, skip);
int32_t x = (pos.x + 1), y = (pos.y + 1), z = (pos.z), width = 10, height = 10, offset = 0, skip = -1;
GetFloorDescription(msg, x, y, z, width, height, offset, skip);
int32_t x = (pos.x - 10), y = (pos.y - 10), z = (pos.z), width = 11, height = 11, offset = 0, skip = -1;
GetFloorDescription(msg, x, y, z, width, height, offset, skip);
>..\protocolgame.cpp(3359): error C2374: 'x' : redefinition; multiple initialization
1> ..\protocolgame.cpp(3355) : see declaration of 'x'
1>..\protocolgame.cpp(3359): error C2374: 'y' : redefinition; multiple initialization
1> ..\protocolgame.cpp(3355) : see declaration of 'y'
1>..\protocolgame.cpp(3359): error C2374: 'z' : redefinition; multiple initialization
1> ..\protocolgame.cpp(3355) : see declaration of 'z'
1>..\protocolgame.cpp(3359): error C2374: 'width' : redefinition; multiple initialization
1> ..\protocolgame.cpp(3355) : see declaration of 'width'
1>..\protocolgame.cpp(3359): error C2374: 'height' : redefinition; multiple initialization
1> ..\protocolgame.cpp(3355) : see declaration of 'height'
1>..\protocolgame.cpp(3359): error C2374: 'offset' : redefinition; multiple initialization
1> ..\protocolgame.cpp(3355) : see declaration of 'offset'
1>..\protocolgame.cpp(3359): error C2374: 'skip' : redefinition; multiple initialization
1> ..\protocolgame.cpp(3355) : see declaration of 'skip'
---////////////// Add common messages
void ProtocolGame::AddMapDescription(NetworkMessage_ptr msg, const Position& pos)
{
msg->AddByte(0x64);
msg->AddPosition(player->getPosition());
int32_t x = (pos.x + 1), y = (pos.y + 1), z = (pos.z), width = 10, height = 10, offset = 0, skip = -1;
GetFloorDescription(msg, x, y, z, width, height, offset, skip);
int32_t x = (pos.x - 10), y = (pos.y - 10), z = (pos.z), width = 11, height = 11, offset = 0, skip = -1;
GetFloorDescription(msg, x, y, z, width, height, offset, skip);
}
---////////////// Add common messages
void ProtocolGame::AddMapDescription(NetworkMessage_ptr msg, const Position& pos)
{msg->AddByte(0x64);msg->AddPosition(player->getPosition());
int32_t x = (pos.x + 1), y = (pos.y + 1), z = (pos.z), width = 10, height = 10, offset = 0, skip = -1;
GetFloorDescription(msg, x, y, z, width, height, offset, skip);
int32_t xa = (pos.x - 10), ya = (pos.y - 10), za = (pos.z), widtha = 11, heighta = 11, offseta = 0, skipa = -1;
GetFloorDescription(msg, xa, ya, za, widtha, heighta, offseta, skipa);
}
static const int32_t maxViewportX = 18; //min value: maxClientViewportX + 1
static const int32_t maxViewportY = 18; //min value: maxClientViewportY + 1
static const int32_t maxClientViewportX = 15;
static const int32_t maxClientViewportY = 11;
void ProtocolGame::AddMapDescription(NetworkMessage_ptr msg, const Position& pos)
{
msg->put<char>(0x64);
msg->putPosition(player->getPosition());
GetMapDescription(pos.x - 15, pos.y - 11, pos.z, 32, 24, msg);
}
void ProtocolGame::AddMapDescription(NetworkMessage_ptr msg, const Position& pos)
{
msg->put<char>(0x64);
msg->putPosition(player->getPosition());
GetMapDescription(pos.x - 1, pos.y - 1, pos.z, 2, 2, msg);
msg->put<char>(0x65);
GetMapDescription(oldPos.x - 8, newPos.y - 6, newPos.z, 18, 1, msg);
msg->put<char>(0x67);
GetMapDescription(oldPos.x - 8, newPos.y + 7, newPos.z, 18, 1, msg);
msg->put<char>(0x66);
GetMapDescription(newPos.x + 9, newPos.y - 6, newPos.z, 1, 14, msg);
msg->put<char>(0x68);
GetMapDescription(newPos.x - 8, newPos.y - 6, newPos.z, 1, 14, msg);
msg->put<char>(0x65);
GetMapDescription(oldPos.x - 10, newPos.y - 8, newPos.z, 22, 1, msg);
msg->put<char>(0x67);
GetMapDescription(oldPos.x - 10, newPos.y + 9, newPos.z, 22, 1, msg);
msg->put<char>(0x66);
GetMapDescription(newPos.x + 11, newPos.y - 8, newPos.z, 1, 18, msg);
msg->put<char>(0x68);
GetMapDescription(newPos.x - 10, newPos.y - 8, newPos.z, 1, 18, msg);
}
void ProtocolGame::AddMapDescription(NetworkMessage_ptr msg, const Position& pos)
{
msg->put<char>(0x64);
msg->putPosition(player->getPosition());
GetMapDescription(pos.x - 1, pos.y - 1, pos.z, 2, 2, msg);
msg->put<char>(0x65);
GetMapDescription(oldPos.x - 8, pos.y - 6, pos.z, 18, 1, msg);
msg->put<char>(0x67);
GetMapDescription(oldPos.x - 8, pos.y + 7, pos.z, 18, 1, msg);
msg->put<char>(0x66);
GetMapDescription(pos.x + 9, pos.y - 6, pos.z, 1, 14, msg);
msg->put<char>(0x68);
GetMapDescription(pos.x - 8, pos.y - 6, pos.z, 1, 14, msg);
msg->put<char>(0x65);
GetMapDescription(oldPos.x - 10, pos.y - 8, pos.z, 22, 1, msg);
msg->put<char>(0x67);
GetMapDescription(oldPos.x - 10, pos.y + 9, pos.z, 22, 1, msg);
msg->put<char>(0x66);
GetMapDescription(pos.x + 11, pos.y - 8, pos.z, 1, 18, msg);
msg->put<char>(0x68);
GetMapDescription(pos.x - 10, pos.y - 8, pos.z, 1, 18, msg);
}
GetMapDescription(pos.x - 1, pos.y - 1, pos.z, 2, 2, msg);
GetMapDescription(pos.x - 1, pos.y - 1, pos.z, 2, 132, msg);
void ProtocolGame::sendAddCreature(const Creature* creature, const Position& pos, uint32_t stackpos)
{
if(!canSee(creature))
return;
if(!g_game.isSightClear(player->getPosition(), pos, false))
return;
NetworkMessage_ptr msg = getOutputBuffer();
if(!msg)
return;
TRACK_MESSAGE(msg);
if(creature != player)
{
AddTileCreature(msg, pos, stackpos, creature);
return;
}
msg->put<char>(0x17);
msg->put<uint32_t>(player->getID());
msg->put<uint16_t>(0x32); // beat duration (50)
msg->putDouble(Creature::speedA, 3);
msg->putDouble(Creature::speedB, 3);
msg->putDouble(Creature::speedC, 3);
msg->put<char>(player->hasFlag(PlayerFlag_CanReportBugs));
sendEnterWorld();
AddMapDescription(msg, pos);
for(int32_t i = SLOT_FIRST; i < SLOT_LAST; ++i)
AddInventoryItem(msg, (slots_t)i, player->getInventoryItem((slots_t)i));
AddPlayerStats(msg);
AddPlayerSkills(msg);
LightInfo lightInfo;
g_game.getWorldLightInfo(lightInfo);
AddWorldLight(msg, lightInfo);
AddCreatureLight(msg, creature);
player->sendIcons();
//Need to fix this so normal players can't see ghosted staff
for(VIPMap::iterator it = player->VIPList.begin(); it != player->VIPList.end(); ++it)
{
std::string vipName;
if(IOLoginData::getInstance()->getNameByGuid((*it).first, vipName))
{
VipStatus_t vipStatus;
if(Player* tmpPlayer = g_game.getPlayerByName(vipName))
vipStatus = player->canSeeCreature(tmpPlayer) ? VIPSTATUS_ONLINE : VIPSTATUS_OFFLINE;
else
vipStatus = VIPSTATUS_OFFLINE;
sendVIP((*it).first, vipName, (*it).second.description, (*it).second.icon, (*it).second.notify, vipStatus);
}
}
}