diff options
-rw-r--r-- | src/account-server/main-account.cpp | 4 | ||||
-rw-r--r-- | src/game-server/accountconnection.cpp | 52 | ||||
-rw-r--r-- | src/game-server/accountconnection.hpp | 53 |
3 files changed, 56 insertions, 53 deletions
diff --git a/src/account-server/main-account.cpp b/src/account-server/main-account.cpp index f2373d28..90c30a51 100644 --- a/src/account-server/main-account.cpp +++ b/src/account-server/main-account.cpp @@ -142,8 +142,8 @@ static void initialize() Logger::setTeeMode(true); Configuration::initialize(configPath); - LOG_INFO("Using Config File: " << configPath); - LOG_INFO("Using Log File: " << logPath); + LOG_INFO("Using config file: " << configPath); + LOG_INFO("Using log file: " << logPath); // Open database try { diff --git a/src/game-server/accountconnection.cpp b/src/game-server/accountconnection.cpp index 6d6276d8..c2b5a78e 100644 --- a/src/game-server/accountconnection.cpp +++ b/src/game-server/accountconnection.cpp @@ -38,12 +38,14 @@ #include "utils/tokendispenser.hpp" #include "utils/tokencollector.hpp" +AccountConnection::AccountConnection(): + mSyncBuffer(0) +{ +} + AccountConnection::~AccountConnection() { - if (mSyncBuffer) - { - delete (mSyncBuffer); - } + delete mSyncBuffer; } bool AccountConnection::start() @@ -323,7 +325,8 @@ void AccountConnection::syncChanges(bool force) mSyncMessages > SYNC_BUFFER_LIMIT || mSyncBuffer->getLength() > SYNC_BUFFER_SIZE ) { - LOG_DEBUG("Sending GAMSG_PLAYER_SYNC with " << mSyncMessages << " messages." ); + LOG_DEBUG("Sending GAMSG_PLAYER_SYNC with " + << mSyncMessages << " messages." ); // attach end-of-buffer flag mSyncBuffer->writeByte(SYNC_END_OF_BUFFER); @@ -339,42 +342,37 @@ void AccountConnection::syncChanges(bool force) } } -void AccountConnection::updateCharacterPoints(const int CharId, const int CharPoints, - const int CorrPoints, const int AttribId, const int AttribValue ) +void AccountConnection::updateCharacterPoints(int charId, int charPoints, + int corrPoints, + int attribId, + int attribValue) { mSyncMessages++; mSyncBuffer->writeByte(SYNC_CHARACTER_POINTS); - mSyncBuffer->writeLong(CharId); - mSyncBuffer->writeLong(CharPoints); - mSyncBuffer->writeLong(CorrPoints); - mSyncBuffer->writeByte(AttribId); - mSyncBuffer->writeLong(AttribValue); + mSyncBuffer->writeLong(charId); + mSyncBuffer->writeLong(charPoints); + mSyncBuffer->writeLong(corrPoints); + mSyncBuffer->writeByte(attribId); + mSyncBuffer->writeLong(attribValue); syncChanges(); } -void AccountConnection::updateExperience(const int CharId, const int SkillId, - const int SkillValue) +void AccountConnection::updateExperience(int charId, int skillId, + int skillValue) { mSyncMessages++; mSyncBuffer->writeByte(SYNC_CHARACTER_SKILL); - mSyncBuffer->writeLong(CharId); - mSyncBuffer->writeByte(SkillId); - mSyncBuffer->writeLong(SkillValue); + mSyncBuffer->writeLong(charId); + mSyncBuffer->writeByte(skillId); + mSyncBuffer->writeLong(skillValue); syncChanges(); } -void AccountConnection::updateOnlineStatus(const int CharId, const bool Online) +void AccountConnection::updateOnlineStatus(int charId, bool online) { mSyncMessages++; mSyncBuffer->writeByte(SYNC_ONLINE_STATUS); - mSyncBuffer->writeLong(CharId); - if (Online) - { - mSyncBuffer->writeByte(0x01); - } - else - { - mSyncBuffer->writeByte(0x00); - } + mSyncBuffer->writeLong(charId); + mSyncBuffer->writeByte(online ? 0x01 : 0x00); syncChanges(); } diff --git a/src/game-server/accountconnection.hpp b/src/game-server/accountconnection.hpp index 5b21c0ac..6e7bd1b5 100644 --- a/src/game-server/accountconnection.hpp +++ b/src/game-server/accountconnection.hpp @@ -49,10 +49,14 @@ class Character; class AccountConnection : public Connection { public: + /** + * Constructor. + */ + AccountConnection(); /** - * Destructor - */ + * Destructor. + */ ~AccountConnection(); /** @@ -117,34 +121,37 @@ class AccountConnection : public Connection void syncChanges(bool force = false); /** - * Write a modification message about character points to the sync buffer. + * Write a modification message about character points to the sync + * buffer. * - * @param CharId ID of the character - * @param CharPoints Number of character points left for the character - * @param CorrPoints Number of correction points left for the character - * @param AttribId ID of the modified attribute - * @param AttribValue New value of the modified attribute + * @param charId ID of the character + * @param charPoints character points left for the character + * @param corrPoints correction points left for the character + * @param attribId ID of the modified attribute + * @param attribValue New value of the modified attribute */ - void updateCharacterPoints(const int CharId, const int CharPoints, - const int CorrPoints, const int AttribId, - const int AttribValue); + void updateCharacterPoints(int charId, int charPoints, + int corrPoints, int attribId, + int attribValue); /** - * Write a modification message about character skills to the sync buffer. - * @param CharId ID of the character - * @param SkillId ID of the skill - * @param SkillValue new skill points + * Write a modification message about character skills to the sync + * buffer. + * + * @param charId ID of the character + * @param skillId ID of the skill + * @param skillValue new skill points */ - void updateExperience(const int CharId, const int SkillId, - const int SkillValue); + void updateExperience(int charId, int skillId, int skillValue); /** - * Update the status of a character to online (true) or offline (false). + * Update the status of a character to online (true) or offline + * (false). * - * @param CharId Id of the character. - * @param Online True to flag the character as being online. + * @param charId Id of the character. + * @param online True to flag the character as being online. */ - void updateOnlineStatus(const int CharId, const bool Online); + void updateOnlineStatus(int charId, bool online); protected: /** @@ -153,12 +160,10 @@ class AccountConnection : public Connection virtual void processMessage(MessageIn &); private: - MessageOut* mSyncBuffer; /**< Message buffer to store sync data. */ int mSyncMessages; /**< Number of messages in the sync buffer. */ - }; extern AccountConnection *accountHandler; -#endif +#endif // _TMW_ACCOUNTCONNECTION_H_ |