Fix flight paths for KoS, DoF clients. Working around by sending the single flight path due to indexing issues with the client.
This commit is contained in:
parent
0f5cfddf89
commit
712b5ebf3f
@ -11827,9 +11827,8 @@ void Client::AttemptStartAutoMount() {
|
|||||||
packet->setDataByName("speed", GetCurrentZone()->GetFlightPathSpeed(GetPendingFlightPath()));
|
packet->setDataByName("speed", GetCurrentZone()->GetFlightPathSpeed(GetPendingFlightPath()));
|
||||||
QueuePacket(packet->serialize());
|
QueuePacket(packet->serialize());
|
||||||
safe_delete(packet);
|
safe_delete(packet);
|
||||||
|
|
||||||
on_auto_mount = true;
|
|
||||||
}
|
}
|
||||||
|
on_auto_mount = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LogWrite(CCLIENT__ERROR, 0, "Client", "OP_ReadyForTakeOffMsg recieved but unable to get an index for path (%u) in zone (%u)", GetPendingFlightPath(), GetCurrentZone()->GetZoneID());
|
LogWrite(CCLIENT__ERROR, 0, "Client", "OP_ReadyForTakeOffMsg recieved but unable to get an index for path (%u) in zone (%u)", GetPendingFlightPath(), GetCurrentZone()->GetZoneID());
|
||||||
@ -11837,7 +11836,7 @@ void Client::AttemptStartAutoMount() {
|
|||||||
EndAutoMount();
|
EndAutoMount();
|
||||||
}
|
}
|
||||||
|
|
||||||
SetPendingFlightPath(0);
|
//SetPendingFlightPath(0);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -11888,6 +11887,7 @@ void Client::EndAutoMount() {
|
|||||||
player->SetMountColor(&mount_color);
|
player->SetMountColor(&mount_color);
|
||||||
player->SetMountSaddleColor(&saddle_color);
|
player->SetMountSaddleColor(&saddle_color);
|
||||||
player->SetTempMount(0);
|
player->SetTempMount(0);
|
||||||
|
SetPendingFlightPath(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Client::EntityCommandPrecheck(Spawn* spawn, const char* command) {
|
bool Client::EntityCommandPrecheck(Spawn* spawn, const char* command) {
|
||||||
@ -12466,6 +12466,10 @@ void Client::SendFlightAutoMount(int32 path_id, int16 mount_id, int8 mount_red_c
|
|||||||
((Player*)player)->SetTempMountColor(((Entity*)player)->GetMountColor());
|
((Player*)player)->SetTempMountColor(((Entity*)player)->GetMountColor());
|
||||||
((Player*)player)->SetTempMountSaddleColor(((Entity*)player)->GetMountSaddleColor());
|
((Player*)player)->SetTempMountSaddleColor(((Entity*)player)->GetMountSaddleColor());
|
||||||
|
|
||||||
|
int32 index = GetCurrentZone()->GetFlightPathIndex(GetPendingFlightPath());
|
||||||
|
if(GetVersion() <= 561) {
|
||||||
|
GetCurrentZone()->SendFlightPathsPackets(this, index);
|
||||||
|
}
|
||||||
PacketStruct* packet = configReader.getStruct("WS_ReadyForTakeOff", GetVersion());
|
PacketStruct* packet = configReader.getStruct("WS_ReadyForTakeOff", GetVersion());
|
||||||
if (packet) {
|
if (packet) {
|
||||||
QueuePacket(packet->serialize());
|
QueuePacket(packet->serialize());
|
||||||
@ -12475,14 +12479,14 @@ void Client::SendFlightAutoMount(int32 path_id, int16 mount_id, int8 mount_red_c
|
|||||||
if (mount_id)
|
if (mount_id)
|
||||||
((Entity*)GetPlayer())->SetMount(mount_id, mount_red_color, mount_green_color, mount_blue_color);
|
((Entity*)GetPlayer())->SetMount(mount_id, mount_red_color, mount_green_color, mount_blue_color);
|
||||||
|
|
||||||
|
|
||||||
if(GetVersion() <= 561) {
|
if(GetVersion() <= 561) {
|
||||||
PacketStruct* packet = configReader.getStruct("WS_CreateBoatTransportMsg", GetVersion());
|
PacketStruct* packet = configReader.getStruct("WS_CreateBoatTransportMsg", GetVersion());
|
||||||
if (!packet) {
|
if (!packet) {
|
||||||
LogWrite(CCLIENT__ERROR, 0, "Client", "WS_CreateBoatTransportMsg missing for version %u", GetVersion());
|
LogWrite(CCLIENT__ERROR, 0, "Client", "WS_CreateBoatTransportMsg missing for version %u", GetVersion());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int8 index = (int8)GetCurrentZone()->GetFlightPathIndex(GetPendingFlightPath());
|
packet->setDataByName("path_id", 1); // workaround we send the SendFlightPathsPackets based on the index since the structure seems to only honor the first index as every index+1
|
||||||
packet->setDataByName("path_id", index);
|
|
||||||
// packet->PrintPacket();
|
// packet->PrintPacket();
|
||||||
QueuePacket(packet->serialize());
|
QueuePacket(packet->serialize());
|
||||||
safe_delete(packet);
|
safe_delete(packet);
|
||||||
|
@ -8830,19 +8830,37 @@ void ZoneServer::DeleteFlightPaths() {
|
|||||||
m_flightPaths.clear();
|
m_flightPaths.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZoneServer::SendFlightPathsPackets(Client* client) {
|
void ZoneServer::SendFlightPathsPackets(Client* client, int32 index) {
|
||||||
|
if(client->GetVersion() <= 561 && index == 0xFFFFFFFF)
|
||||||
|
return;
|
||||||
|
|
||||||
// Only send a packet if there are flight paths
|
// Only send a packet if there are flight paths
|
||||||
if (m_flightPathRoutes.size() > 0) {
|
if (m_flightPathRoutes.size() > 0) {
|
||||||
PacketStruct* packet = configReader.getStruct("WS_FlightPathsMsg", client->GetVersion());
|
PacketStruct* packet = configReader.getStruct("WS_FlightPathsMsg", client->GetVersion());
|
||||||
if (packet) {
|
if (packet) {
|
||||||
int32 num_routes = m_flightPaths.size();
|
int32 num_routes = m_flightPaths.size();
|
||||||
|
if(index != 0xFFFFFFFF) {
|
||||||
|
num_routes = 1;
|
||||||
|
}
|
||||||
packet->setArrayLengthByName("number_of_routes", num_routes);
|
packet->setArrayLengthByName("number_of_routes", num_routes);
|
||||||
packet->setArrayLengthByName("number_of_routes2", num_routes);
|
packet->setArrayLengthByName("number_of_routes2", num_routes);
|
||||||
packet->setArrayLengthByName("number_of_routes3", num_routes);
|
packet->setArrayLengthByName("number_of_routes3", num_routes);
|
||||||
packet->setArrayLengthByName("number_of_routes4", num_routes);
|
packet->setArrayLengthByName("number_of_routes4", num_routes);
|
||||||
map<int32, FlightPathInfo*>::iterator itr;
|
map<int32, FlightPathInfo*>::iterator itr;
|
||||||
int32 i = 0;
|
int32 i = 0;
|
||||||
|
bool breakout = false;
|
||||||
for (itr = m_flightPaths.begin(); itr != m_flightPaths.end(); itr++, i++) {
|
for (itr = m_flightPaths.begin(); itr != m_flightPaths.end(); itr++, i++) {
|
||||||
|
|
||||||
|
if(index != 0xFFFFFFFF) {
|
||||||
|
if(i != index) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
i = 0;
|
||||||
|
breakout = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
packet->setArrayDataByName("route_length", m_flightPathRoutes[itr->first].size(), i);
|
packet->setArrayDataByName("route_length", m_flightPathRoutes[itr->first].size(), i);
|
||||||
packet->setArrayDataByName("ground_mount", itr->second->flying ? 0 : 1, i);
|
packet->setArrayDataByName("ground_mount", itr->second->flying ? 0 : 1, i);
|
||||||
packet->setArrayDataByName("allow_dismount", itr->second->dismount ? 1 : 0, i);
|
packet->setArrayDataByName("allow_dismount", itr->second->dismount ? 1 : 0, i);
|
||||||
@ -8854,6 +8872,8 @@ void ZoneServer::SendFlightPathsPackets(Client* client) {
|
|||||||
packet->setSubArrayDataByName("y", (*itr2)->Y, i, j);
|
packet->setSubArrayDataByName("y", (*itr2)->Y, i, j);
|
||||||
packet->setSubArrayDataByName("z", (*itr2)->Z, i, j);
|
packet->setSubArrayDataByName("z", (*itr2)->Z, i, j);
|
||||||
}
|
}
|
||||||
|
if(breakout)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
client->QueuePacket(packet->serialize());
|
client->QueuePacket(packet->serialize());
|
||||||
safe_delete(packet);
|
safe_delete(packet);
|
||||||
|
@ -679,7 +679,7 @@ public:
|
|||||||
void AddFlightPath(int32 id, FlightPathInfo* info);
|
void AddFlightPath(int32 id, FlightPathInfo* info);
|
||||||
void AddFlightPathLocation(int32 id, FlightPathLocation* location);
|
void AddFlightPathLocation(int32 id, FlightPathLocation* location);
|
||||||
void DeleteFlightPaths();
|
void DeleteFlightPaths();
|
||||||
void SendFlightPathsPackets(Client* client);
|
void SendFlightPathsPackets(Client* client, int32 index = 0xFFFFFFFF);
|
||||||
int32 GetFlightPathIndex(int32 id);
|
int32 GetFlightPathIndex(int32 id);
|
||||||
float GetFlightPathSpeed(int32 id);
|
float GetFlightPathSpeed(int32 id);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user