1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-24 13:47:46 +00:00

Fixed eobjects getting incorrect ids, fixed actors not properly removing from cells

This commit is contained in:
Mordred 2018-02-28 00:03:26 +01:00
parent 40797f425e
commit fae163eafa
6 changed files with 7 additions and 5 deletions

View file

@ -17,7 +17,7 @@ using namespace Core::Network::Packets::Server;
extern Core::Logger g_log; extern Core::Logger g_log;
Core::Entity::EventObject::EventObject( uint32_t objectId, uint32_t mapLinkId, Core::Entity::EventObject::EventObject( uint32_t actorId, uint32_t objectId, uint32_t mapLinkId,
uint8_t initialState, Common::FFXIVARR_POSITION3 pos, uint8_t initialState, Common::FFXIVARR_POSITION3 pos,
const std::string& givenName ) : const std::string& givenName ) :
Core::Entity::Actor( ObjKind::EventObj ), Core::Entity::Actor( ObjKind::EventObj ),
@ -26,7 +26,7 @@ Core::Entity::EventObject::EventObject( uint32_t objectId, uint32_t mapLinkId,
m_objectId( objectId ), m_objectId( objectId ),
m_name( givenName ) m_name( givenName )
{ {
m_id = objectId; m_id = actorId;
m_pos.x = pos.x; m_pos.x = pos.x;
m_pos.y = pos.y; m_pos.y = pos.y;
m_pos.z = pos.z; m_pos.z = pos.z;

View file

@ -10,7 +10,7 @@ namespace Entity
class EventObject : public Actor class EventObject : public Actor
{ {
public: public:
EventObject( uint32_t objectId, uint32_t mapLinkId, uint8_t initialState, Common::FFXIVARR_POSITION3 pos, EventObject( uint32_t actorId, uint32_t objectId, uint32_t mapLinkId, uint8_t initialState, Common::FFXIVARR_POSITION3 pos,
const std::string& givenName = "none" ); const std::string& givenName = "none" );
using OnTalkEventHandler = std::function< void( Entity::Player&, Entity::EventObjectPtr, InstanceContentPtr, uint64_t ) >; using OnTalkEventHandler = std::function< void( Entity::Player&, Entity::EventObjectPtr, InstanceContentPtr, uint64_t ) >;

View file

@ -55,7 +55,8 @@ Core::Zone::Zone() :
} }
Core::Zone::Zone( uint16_t territoryId, uint32_t guId, const std::string& internalName, const std::string& placeName ) : Core::Zone::Zone( uint16_t territoryId, uint32_t guId, const std::string& internalName, const std::string& placeName ) :
m_currentWeather( Weather::FairSkies ) m_currentWeather( Weather::FairSkies ),
m_nextEObjId( 0x400D0000 )
{ {
m_guId = guId; m_guId = guId;
@ -539,6 +540,7 @@ void Core::Zone::updateActorPosition( Entity::Actor &actor )
pOldCell->removeActor( actor.shared_from_this() ); pOldCell->removeActor( actor.shared_from_this() );
pCell->addActor( actor.shared_from_this() ); pCell->addActor( actor.shared_from_this() );
actor.setCell( pCell );
pOldCell = pCell; pOldCell = pCell;
// if player we need to update cell activity // if player we need to update cell activity
@ -692,7 +694,7 @@ uint32_t Core::Zone::getNextEObjId()
Core::Entity::EventObjectPtr Core::Zone::registerEObj( const std::string &name, uint32_t objectId, uint32_t mapLink, Core::Entity::EventObjectPtr Core::Zone::registerEObj( const std::string &name, uint32_t objectId, uint32_t mapLink,
uint8_t state, FFXIVARR_POSITION3 pos, float scale ) uint8_t state, FFXIVARR_POSITION3 pos, float scale )
{ {
auto eObj = Entity::make_EventObject( objectId, mapLink, state, pos, name ); auto eObj = Entity::make_EventObject( getNextEObjId(), objectId, mapLink, state, pos, name );
eObj->setScale( scale ); eObj->setScale( scale );
registerEObj( eObj ); registerEObj( eObj );