From 9574819decf6720eb9f886d7a16b55d29eafac23 Mon Sep 17 00:00:00 2001 From: NotAdam Date: Sat, 20 Jul 2019 22:13:24 +1000 Subject: [PATCH] misc api cleanup --- src/api/PlayerMinimal.cpp | 84 +-------------------------------------- src/api/PlayerMinimal.h | 4 +- src/api/main.cpp | 2 +- 3 files changed, 4 insertions(+), 86 deletions(-) diff --git a/src/api/PlayerMinimal.cpp b/src/api/PlayerMinimal.cpp index 3d0bc685..2ea32f5f 100644 --- a/src/api/PlayerMinimal.cpp +++ b/src/api/PlayerMinimal.cpp @@ -14,17 +14,11 @@ namespace Sapphire::Api { using namespace Common; // player constructor -PlayerMinimal::PlayerMinimal( void ) : +PlayerMinimal::PlayerMinimal() : m_id( 0 ) { -} - -// deconstructor -PlayerMinimal::~PlayerMinimal( void ) -{ - } // load player from the db @@ -85,58 +79,6 @@ void PlayerMinimal::load( uint32_t charId ) } } - -std::string PlayerMinimal::getLookString() -{ - - auto it = m_lookMap.begin(); - - std::string lookString; - - for( ; it != m_lookMap.end(); ++it ) - { - - std::string s = std::to_string( it->second ); - - lookString += "\"" + s + "\""; - if( it != m_lookMap.end() ) - { - lookString += ","; - } - } - - return lookString.substr( 0, lookString.size() - 1 ); -} - -std::string PlayerMinimal::getModelString() -{ - std::string modelString = "\"" - + std::to_string( m_modelEquip[ 0 ] ) + "\",\"" - + std::to_string( m_modelEquip[ 1 ] ) + "\",\"" - + std::to_string( m_modelEquip[ 2 ] ) + "\",\"" - + std::to_string( m_modelEquip[ 3 ] ) + "\",\"" - + std::to_string( m_modelEquip[ 4 ] ) + "\",\"" - + std::to_string( m_modelEquip[ 5 ] ) + "\",\"" - + std::to_string( m_modelEquip[ 6 ] ) + "\",\"" - + std::to_string( m_modelEquip[ 7 ] ) + "\",\"" - + std::to_string( m_modelEquip[ 8 ] ) + "\",\"" - + std::to_string( m_modelEquip[ 9 ] ) + "\""; - return modelString; -} - -std::string PlayerMinimal::getLevelsString() -{ - auto levelsArray = nlohmann::json(); - - for( int i = 0; i < Common::CLASSJOB_SLOTS; ++i ) - { - // these must be strings - levelsArray.push_back( std::to_string( m_classMap[ i ] ) ); - } - - return levelsArray.dump(); -} - std::string PlayerMinimal::getInfoJson() { auto payload = nlohmann::json(); @@ -221,30 +163,6 @@ uint8_t PlayerMinimal::getClassLevel() return static_cast< uint8_t >( m_classMap[ classJobIndex ] ); } -std::string PlayerMinimal::getClassString() -{ - - std::map< uint8_t, uint16_t >::iterator it; - - it = m_classMap.begin(); - - std::string classString; - - for( ; it != m_classMap.end(); ++it ) - { - - std::string s = std::to_string( it->second ); - - classString += "\"" + s + "\""; - if( it != m_classMap.end() ) - { - classString += ","; - } - } - - return classString.substr( 0, classString.size() - 1 ); -} - void PlayerMinimal::saveAsNew() { diff --git a/src/api/PlayerMinimal.h b/src/api/PlayerMinimal.h index 17318358..39121928 100644 --- a/src/api/PlayerMinimal.h +++ b/src/api/PlayerMinimal.h @@ -11,9 +11,9 @@ namespace Sapphire::Api class PlayerMinimal { public: - PlayerMinimal( void ); + PlayerMinimal(); - ~PlayerMinimal( void ); + ~PlayerMinimal() = default; // write player to the database void write(); diff --git a/src/api/main.cpp b/src/api/main.cpp index 5d661387..004233ba 100644 --- a/src/api/main.cpp +++ b/src/api/main.cpp @@ -699,7 +699,7 @@ void defaultGet( shared_ptr< HttpServer::Response > response, shared_ptr< HttpSe catch( const exception& ) { string content = "Path not found: " + request->path; - *response << buildHttpResponse( 400, content ); + *response << buildHttpResponse( 404, content ); } }