mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-25 05:57:45 +00:00
cleanup old house apperance crap
This commit is contained in:
parent
c345ac2c4e
commit
40e3865782
2 changed files with 4 additions and 74 deletions
|
@ -197,7 +197,7 @@ void Sapphire::Db::ZoneDbConnection::doPrepareStatements()
|
|||
CONNECTION_BOTH );
|
||||
|
||||
prepareStatement( HOUSING_HOUSE_UP,
|
||||
"UPDATE house SET BuildTime = ?, Aetheryte = ?, Comment = ?, HouseName = ?, Endorsements = ?, HousePartModels = ?, HousePartColours = ?, HouseInteriorModels = ? WHERE HouseId = ?;",
|
||||
"UPDATE house SET BuildTime = ?, Aetheryte = ?, Comment = ?, HouseName = ?, Endorsements = ? WHERE HouseId = ?;",
|
||||
CONNECTION_BOTH );
|
||||
|
||||
prepareStatement( LAND_INV_SEL_ALL,
|
||||
|
|
|
@ -21,47 +21,7 @@ Sapphire::House::House( uint32_t houseId, uint32_t landSetId, Common::LandIdent
|
|||
m_estateName( estateName ),
|
||||
m_estateComment( estateComment )
|
||||
{
|
||||
// auto pDB = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
//
|
||||
// // todo: convert to prepared statement
|
||||
// auto res = pDB->query( "SELECT * FROM house WHERE HouseId = " + std::to_string( houseId ) );
|
||||
//
|
||||
// if( !res->next() )
|
||||
// {
|
||||
// g_fw.get< Sapphire::Logger >()->info( "Creating house House#" + std::to_string( houseId ) + " in LandSet#" + std::to_string( landSetId ) );
|
||||
//
|
||||
// auto stmt = pDB->getPreparedStatement( Db::HOUSING_HOUSE_INS );
|
||||
//
|
||||
// stmt->setUInt( 1, m_landSetId );
|
||||
// stmt->setUInt( 2, m_houseId );
|
||||
//
|
||||
// pDB->execute( stmt );
|
||||
//
|
||||
// // todo: make this nicer/configurable?
|
||||
// m_estateName = "Estate #" + std::to_string( m_landIdent.landId + 1 );
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// m_estateComment = res->getString( "Comment" );
|
||||
// m_estateName = res->getString( "HouseName" );
|
||||
//
|
||||
// auto housePartModels = res->getBlobVector( "HousePartModels" );
|
||||
// auto housePartColours = res->getBlobVector( "HousePartColours" );
|
||||
//
|
||||
// auto models = reinterpret_cast< uint32_t* >( &housePartModels[ 0 ] );
|
||||
// for( auto i = 0; i < 8; i++ )
|
||||
// {
|
||||
// m_houseModelsCache[ i ] = { models[ i ], housePartColours[ i ] };
|
||||
// }
|
||||
//
|
||||
// auto houseInteriorModels = res->getBlobVector( "HouseInteriorModels" );
|
||||
//
|
||||
// auto interiorModels = reinterpret_cast< uint32_t* >( &houseInteriorModels[ 0 ] );
|
||||
// for( auto i = 0; i < 10; i++ )
|
||||
// {
|
||||
// m_houseInteriorModels[ i ] = interiorModels[ i ];
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
Sapphire::House::~House() = default;
|
||||
|
@ -70,10 +30,9 @@ void Sapphire::House::updateHouseDb()
|
|||
{
|
||||
auto pDB = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
|
||||
// BuildTime = 1, Aetheryte = 2, Comment = 3, HouseName = 4, Endorsements = 5,
|
||||
// HousePartModels = 6, HousePartColours = 7, HouseId = 8
|
||||
// BuildTime = 1, Aetheryte = 2, Comment = 3, HouseName = 4, Endorsements = 5, HouseId = 6
|
||||
auto stmt = pDB->getPreparedStatement( Db::HOUSING_HOUSE_UP );
|
||||
stmt->setUInt( 9, m_houseId );
|
||||
stmt->setUInt( 6, m_houseId );
|
||||
|
||||
stmt->setInt64( 1, m_buildTime );
|
||||
stmt->setInt( 2, 0 );
|
||||
|
@ -83,35 +42,6 @@ void Sapphire::House::updateHouseDb()
|
|||
|
||||
stmt->setUInt64( 5, 0 );
|
||||
|
||||
std::vector< uint32_t > models;
|
||||
std::vector< uint8_t > colours;
|
||||
|
||||
for( auto i = 0; i < 8; i++ )
|
||||
{
|
||||
auto& part = m_houseModelsCache[ i ];
|
||||
models.push_back( part.first );
|
||||
colours.push_back( part.second );
|
||||
}
|
||||
|
||||
// todo: this is shit
|
||||
std::vector< uint8_t > tmpModels( models.size() * 4 );
|
||||
memcpy( tmpModels.data(), models.data(), tmpModels.size() );
|
||||
|
||||
stmt->setBinary( 6, tmpModels );
|
||||
stmt->setBinary( 7, colours );
|
||||
|
||||
models.clear();
|
||||
|
||||
for( auto i = 0; i < 10; i++ )
|
||||
{
|
||||
models.push_back( m_houseInteriorModels[ i ] );
|
||||
}
|
||||
|
||||
std::vector< uint8_t > tmp2Models( models.size() * 4 );
|
||||
memcpy( tmp2Models.data(), models.data(), tmp2Models.size() );
|
||||
|
||||
stmt->setBinary( 8, tmp2Models );
|
||||
|
||||
pDB->execute( stmt );
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue