Additional efforts to lock down spawns from moving this is looking to address remaining corner cases for Fix #5
This commit is contained in:
parent
e82f2c5eb7
commit
108371a077
@ -868,7 +868,7 @@ uchar* Spawn::spawn_pos_changes(Player* player, int16 version, int16* pos_packet
|
|||||||
player->pos_mutex.writelock(__FUNCTION__, __LINE__);
|
player->pos_mutex.writelock(__FUNCTION__, __LINE__);
|
||||||
uchar* orig_packet = player->GetSpawnPosPacketForXOR(id);
|
uchar* orig_packet = player->GetSpawnPosPacketForXOR(id);
|
||||||
packet->ResetData();
|
packet->ResetData();
|
||||||
InitializePosPacketData(player, packet, true);
|
InitializePosPacketData(player, packet, version > 561 ? true : false);
|
||||||
string* data = packet->serializeString();
|
string* data = packet->serializeString();
|
||||||
int32 size = data->length();
|
int32 size = data->length();
|
||||||
uchar* xor_pos_packet = player->GetTempPosPacketForXOR();
|
uchar* xor_pos_packet = player->GetTempPosPacketForXOR();
|
||||||
|
@ -337,13 +337,14 @@ public:
|
|||||||
strcpy(field, value);
|
strcpy(field, value);
|
||||||
}
|
}
|
||||||
template <class Field, class Value> void SetPos(Field* field, Value value, bool setUpdateFlags = true){
|
template <class Field, class Value> void SetPos(Field* field, Value value, bool setUpdateFlags = true){
|
||||||
|
Set(field, value, false);
|
||||||
if(setUpdateFlags){
|
if(setUpdateFlags){
|
||||||
position_changed = true;
|
position_changed = true;
|
||||||
info_changed = true;
|
info_changed = true;
|
||||||
vis_changed = true;
|
vis_changed = true;
|
||||||
|
changed = true;
|
||||||
AddChangedZoneSpawn();
|
AddChangedZoneSpawn();
|
||||||
}
|
}
|
||||||
Set(field, value, setUpdateFlags);
|
|
||||||
}
|
}
|
||||||
template <class Field, class Value> void SetInfo(Field* field, Value value, bool setUpdateFlags = true){
|
template <class Field, class Value> void SetInfo(Field* field, Value value, bool setUpdateFlags = true){
|
||||||
if(setUpdateFlags){
|
if(setUpdateFlags){
|
||||||
@ -464,7 +465,7 @@ public:
|
|||||||
SetPos(&appearance.pos.Z, z, updateFlags);
|
SetPos(&appearance.pos.Z, z, updateFlags);
|
||||||
}
|
}
|
||||||
void SetHeading(sint16 dir1, sint16 dir2, bool updateFlags = true){
|
void SetHeading(sint16 dir1, sint16 dir2, bool updateFlags = true){
|
||||||
SetPos(&appearance.pos.Dir1, dir1, updateFlags);
|
SetPos(&appearance.pos.Dir1, dir1, false); // we set the update for heading on the second direction do not duplicate the process
|
||||||
SetPos(&appearance.pos.Dir2, dir2, updateFlags);
|
SetPos(&appearance.pos.Dir2, dir2, updateFlags);
|
||||||
}
|
}
|
||||||
void SetHeading(float heading, bool updateFlags = true){
|
void SetHeading(float heading, bool updateFlags = true){
|
||||||
@ -474,18 +475,18 @@ public:
|
|||||||
SetHeading((sint16)heading, (sint16)heading, updateFlags);
|
SetHeading((sint16)heading, (sint16)heading, updateFlags);
|
||||||
}
|
}
|
||||||
void SetPitch(sint16 pitch1, sint16 pitch2, bool updateFlags = true){
|
void SetPitch(sint16 pitch1, sint16 pitch2, bool updateFlags = true){
|
||||||
SetPos(&appearance.pos.Pitch1, (sint16)pitch1, updateFlags);
|
SetPos(&appearance.pos.Pitch1, (sint16)pitch1, false);
|
||||||
SetPos(&appearance.pos.Pitch2, (sint16)pitch2, updateFlags);
|
SetPos(&appearance.pos.Pitch2, (sint16)pitch2, updateFlags);
|
||||||
}
|
}
|
||||||
void SetPitch(float pitch, bool updateFlags = true){
|
void SetPitch(float pitch, bool updateFlags = true){
|
||||||
if (pitch == 0){
|
if (pitch == 0){
|
||||||
SetPos(&appearance.pos.Pitch1, (sint16)0, updateFlags);
|
SetPos(&appearance.pos.Pitch1, (sint16)0, false);
|
||||||
SetPos(&appearance.pos.Pitch2, (sint16)0, updateFlags);
|
SetPos(&appearance.pos.Pitch2, (sint16)0, updateFlags);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (pitch != 180)
|
if (pitch != 180)
|
||||||
pitch = (pitch - 180) * 64;
|
pitch = (pitch - 180) * 64;
|
||||||
SetPos(&appearance.pos.Pitch1, (sint16)pitch, updateFlags);
|
SetPos(&appearance.pos.Pitch1, (sint16)pitch, false);
|
||||||
SetPos(&appearance.pos.Pitch2, (sint16)pitch, updateFlags);
|
SetPos(&appearance.pos.Pitch2, (sint16)pitch, updateFlags);
|
||||||
}
|
}
|
||||||
void SetRoll(float roll, bool updateFlags = true){
|
void SetRoll(float roll, bool updateFlags = true){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user