From a0616c8d7cb67755f3b41e5ea7c8bc816a806a3c Mon Sep 17 00:00:00 2001 From: Mordred Date: Sat, 3 Nov 2018 23:44:43 +0100 Subject: [PATCH] Small refactors --- src/common/Common.h | 11 +++++------ src/servers/sapphire_zone/Zone/Land.cpp | 12 ++++++------ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/common/Common.h b/src/common/Common.h index 5d1fce2a..e1bbd877 100644 --- a/src/common/Common.h +++ b/src/common/Common.h @@ -777,15 +777,14 @@ namespace Core::Common uint16_t pos_z; }; - enum HouseSizeType : uint8_t + enum HouseSize : uint8_t { - //noneHouse, - smallHouse, - mediumHouse, - bigHouse + small, + medium, + big }; - enum HouseStateType : uint8_t + enum HouseState : uint8_t { none, forSale, diff --git a/src/servers/sapphire_zone/Zone/Land.cpp b/src/servers/sapphire_zone/Zone/Land.cpp index bffd3335..ce913113 100644 --- a/src/servers/sapphire_zone/Zone/Land.cpp +++ b/src/servers/sapphire_zone/Zone/Land.cpp @@ -45,7 +45,7 @@ Core::Land::~Land() void Core::Land::load() { m_land.houseSize = 1; - m_land.houseState = 1; + m_land.houseState = HouseState::forSale; // setPreset( 262145 ); /* auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >(); auto res = pDb->query( "SELECT * FROM land WHERE Id = " + std::to_string( m_landKey ) ); @@ -218,15 +218,15 @@ void Core::Land::init() switch( getHouseSize() ) { - case HouseSizeType::smallHouse: + case HouseSize::small: m_initPrice = 3750000; m_maxItems = 20; break; - case HouseSizeType::mediumHouse: + case HouseSize::medium: m_initPrice = 20000000; m_maxItems = 30; break; - case HouseSizeType::bigHouse: + case HouseSize::big: m_initPrice = 50000000; m_maxItems = 40; break; @@ -248,13 +248,13 @@ void Core::Land::UpdateDatabase() void Core::Land::Update( uint32_t currTime ) { - if( m_currentPrice == 0 && getState() == HouseStateType::forSale ) + if( m_currentPrice == 0 && getState() == HouseState::forSale ) { m_currentPrice = m_initPrice; m_nextDrop = 0; UpdateDatabase(); } - if( m_nextDrop < currTime && getState() == HouseStateType::forSale ) + if( m_nextDrop < currTime && getState() == HouseState::forSale ) { m_currentPrice = ( m_currentPrice / 100 ) * 90; m_nextDrop = currTime + 86400;