From abb3771b86390dda7816cfd4be1733fe01905c06 Mon Sep 17 00:00:00 2001 From: NotAdam Date: Sun, 23 Dec 2018 21:00:00 +1100 Subject: [PATCH] save a newly created house to the db correctly --- src/world/Manager/HousingMgr.cpp | 2 ++ src/world/Manager/HousingMgr.h | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/world/Manager/HousingMgr.cpp b/src/world/Manager/HousingMgr.cpp index f1c4c0f5..fd294cef 100644 --- a/src/world/Manager/HousingMgr.cpp +++ b/src/world/Manager/HousingMgr.cpp @@ -563,6 +563,8 @@ void Sapphire::World::Manager::HousingMgr::buildPresetEstate( Entity::Player& pl if( !initHouseModels( player, pLand, presetItem ) ) return; + createHouse( house ); + pLand->setState( HouseState::privateHouse ); pLand->setLandType( LandType::Private ); hZone->sendLandUpdate( plotNum ); diff --git a/src/world/Manager/HousingMgr.h b/src/world/Manager/HousingMgr.h index 6fcf53b7..82f01262 100644 --- a/src/world/Manager/HousingMgr.h +++ b/src/world/Manager/HousingMgr.h @@ -142,9 +142,17 @@ namespace Sapphire::World::Manager */ bool initHouseModels( Entity::Player& player, LandPtr land, uint32_t presetCatalogId ); + private: + + /*! + * @brief Creates a house and saves the minimum amount required to persist a house through restarts. + * + * Any other changes will be covered by the usual saving logic and can be safely ignored here. + * + * @param house The house to create in the house table + */ void createHouse( HousePtr house ) const; - private: /*! * @brief Gets the next available house id * @return The next available house id