diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-05-08 22:46:48 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-05-08 22:46:48 +0300 |
commit | 6d4da51f0fdcecc2d4398f60dbca43f499fdbe16 (patch) | |
tree | c71c7c6e49ed36a55c6b6a2b1ba70073300634dd /src/gui/windows | |
parent | 4125ac707288a244a7175b755d74dd963e762f56 (diff) | |
download | plus-6d4da51f0fdcecc2d4398f60dbca43f499fdbe16.tar.gz plus-6d4da51f0fdcecc2d4398f60dbca43f499fdbe16.tar.bz2 plus-6d4da51f0fdcecc2d4398f60dbca43f499fdbe16.tar.xz plus-6d4da51f0fdcecc2d4398f60dbca43f499fdbe16.zip |
Fix code style in gui.
Diffstat (limited to 'src/gui/windows')
-rw-r--r-- | src/gui/windows/buydialog.cpp | 4 | ||||
-rw-r--r-- | src/gui/windows/charcreatedialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/windows/chatwindow.cpp | 8 | ||||
-rw-r--r-- | src/gui/windows/killstats.h | 2 | ||||
-rw-r--r-- | src/gui/windows/serverdialog.cpp | 4 | ||||
-rw-r--r-- | src/gui/windows/socialwindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/windows/textcommandeditor.cpp | 5 | ||||
-rw-r--r-- | src/gui/windows/updaterwindow.cpp | 10 | ||||
-rw-r--r-- | src/gui/windows/whoisonline.cpp | 2 | ||||
-rw-r--r-- | src/gui/windows/whoisonline.h | 2 |
10 files changed, 22 insertions, 19 deletions
diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp index e86bf344e..f8e87e846 100644 --- a/src/gui/windows/buydialog.cpp +++ b/src/gui/windows/buydialog.cpp @@ -148,8 +148,8 @@ class SortItemTypeFunctor final if (!item1 || !item2) return false; - const int type1 = item1->getInfo().getType(); - const int type2 = item2->getInfo().getType(); + const ItemType type1 = item1->getInfo().getType(); + const ItemType type2 = item2->getInfo().getType(); if (type1 == type2) return item1->getPrice() < item2->getPrice(); return type1 < type2; diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp index 182ce5f03..c1e8217d8 100644 --- a/src/gui/windows/charcreatedialog.cpp +++ b/src/gui/windows/charcreatedialog.cpp @@ -488,7 +488,7 @@ void CharCreateDialog::setAttributes(const StringVect &labels, { mMaxPoints = available; - for (unsigned i = 0; i < mAttributeLabel.size(); i++) + for (size_t i = 0; i < mAttributeLabel.size(); i++) { remove(mAttributeLabel[i]); delete2(mAttributeLabel[i]) diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index ad646ce82..316b276f3 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -880,11 +880,11 @@ void ChatWindow::keyPressed(KeyEvent &event) { const std::list<std::string> &rows = tab->getRows(); const size_t &tabSize = rows.size(); - if (mChatHistoryIndex + 1 < tabSize) + if (static_cast<size_t>(mChatHistoryIndex) + 1 < tabSize) { mChatHistoryIndex ++; } - else if (mChatHistoryIndex < tabSize) + else if (static_cast<size_t>(mChatHistoryIndex) < tabSize) { mChatHistoryIndex ++; mChatInput->setText(""); @@ -1423,7 +1423,7 @@ bool ChatWindow::resortChatLog(std::string line, Own own, const bool ignoreRecord, const bool tryRemoveColors) { - if (own == -1) + if (own == BY_UNKNOWN) own = BY_SERVER; std::string prefix; @@ -1535,7 +1535,7 @@ void ChatWindow::battleChatLog(const std::string &line, Own own, const bool ignoreRecord, const bool tryRemoveColors) { - if (own == -1) + if (own == BY_UNKNOWN) own = BY_SERVER; if (battleChatTab) battleChatTab->chatLog(line, own, ignoreRecord, tryRemoveColors); diff --git a/src/gui/windows/killstats.h b/src/gui/windows/killstats.h index 1e2da9ada..ae8ce3487 100644 --- a/src/gui/windows/killstats.h +++ b/src/gui/windows/killstats.h @@ -84,7 +84,7 @@ class KillStats final : public Window, private: void validateJacko(); - time_t mKillTimer; /**< Timer for kill stats. */ + int mKillTimer; /**< Timer for kill stats. */ Button *mResetButton; Button *mTimerButton; Label *mLine1; diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp index 015c94f00..2b890a7af 100644 --- a/src/gui/windows/serverdialog.cpp +++ b/src/gui/windows/serverdialog.cpp @@ -719,7 +719,7 @@ void ServerDialog::saveCustomServers(const ServerInfo ¤tServer, // Make sure the current server is mentioned first if (currentServer.isValid()) { - if (index >= 0 && static_cast<unsigned>(index) < mServers.size()) + if (index >= 0 && static_cast<size_t>(index) < mServers.size()) { mServers[index] = currentServer; } @@ -789,7 +789,7 @@ int ServerDialog::downloadUpdate(void *ptr, DownloadStatus status, { finished = true; } - else if (status < 0) + else if (static_cast<int>(status) < 0) { logger->log("Error retreiving server list: %s\n", sd->mDownload->getError()); diff --git a/src/gui/windows/socialwindow.cpp b/src/gui/windows/socialwindow.cpp index 4e22595a6..34a8bcf12 100644 --- a/src/gui/windows/socialwindow.cpp +++ b/src/gui/windows/socialwindow.cpp @@ -802,7 +802,7 @@ public: return; std::vector<Avatar*> *const avatars = mBeings->getMembers(); - if (!avatars || avatars->size() <= num) + if (!avatars || avatars->size() <= static_cast<size_t>(num)) return; const Avatar *const ava = avatars->at(num); diff --git a/src/gui/windows/textcommandeditor.cpp b/src/gui/windows/textcommandeditor.cpp index 2eccb255d..29e1bd81e 100644 --- a/src/gui/windows/textcommandeditor.cpp +++ b/src/gui/windows/textcommandeditor.cpp @@ -138,9 +138,10 @@ TextCommandEditor::TextCommandEditor(TextCommand *const command) : mCommandTextField->setText(command->getCommand()); mCommentTextField->setText(command->getComment()); mManaField->setValue(command->getMana()); - mTypeDropDown->setSelected(command->getTargetType()); + mTypeDropDown->setSelected(static_cast<int>(command->getTargetType())); mMagicLvlField->setValue(command->getBaseLvl()); - mSchoolDropDown->setSelected(command->getSchool() - MAGIC_START_ID); + mSchoolDropDown->setSelected(static_cast<int>(command->getSchool()) + - MAGIC_START_ID); mSchoolLvlField->setValue(command->getSchoolLvl()); ContainerPlacer placer; diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp index dab1a6ebc..249748d43 100644 --- a/src/gui/windows/updaterwindow.cpp +++ b/src/gui/windows/updaterwindow.cpp @@ -512,7 +512,7 @@ size_t UpdaterWindow::memoryWrite(void *ptr, size_t size, UpdaterWindow *const uw = reinterpret_cast<UpdaterWindow *>(stream); const size_t totalMem = size * nmemb; uw->mMemoryBuffer = static_cast<char*>(realloc(uw->mMemoryBuffer, - uw->mDownloadedBytes + totalMem)); + static_cast<size_t>(uw->mDownloadedBytes) + totalMem)); if (uw->mMemoryBuffer) { memcpy(&(uw->mMemoryBuffer[uw->mDownloadedBytes]), ptr, totalMem); @@ -757,7 +757,8 @@ void UpdaterWindow::logic() } mProgressBar->setProgress(mDownloadProgress); - if (mUpdateFiles.size() && mUpdateIndex <= mUpdateFiles.size()) + if (mUpdateFiles.size() + && static_cast<size_t>(mUpdateIndex) <= mUpdateFiles.size()) { mProgressBar->setText(strprintf("%u/%u", mUpdateIndex + mUpdateIndexOffset + 1, static_cast<unsigned>( @@ -853,7 +854,7 @@ void UpdaterWindow::logic() case UPDATE_RESOURCES: if (mDownloadComplete) { - if (mUpdateIndex < mUpdateFiles.size()) + if (static_cast<size_t>(mUpdateIndex) < mUpdateFiles.size()) { UpdateFile thisFile = mUpdateFiles[mUpdateIndex]; if (thisFile.type == "music" @@ -918,7 +919,8 @@ void UpdaterWindow::logic() if (mDownloadComplete) { mValidateXml = false; - if (mUpdateIndex < mTempUpdateFiles.size()) + if (static_cast<size_t>(mUpdateIndex) + < mTempUpdateFiles.size()) { const UpdateFile thisFile = mTempUpdateFiles[mUpdateIndex]; mCurrentFile = thisFile.name; diff --git a/src/gui/windows/whoisonline.cpp b/src/gui/windows/whoisonline.cpp index 0bf05a129..c417e6b37 100644 --- a/src/gui/windows/whoisonline.cpp +++ b/src/gui/windows/whoisonline.cpp @@ -474,7 +474,7 @@ size_t WhoIsOnline::memoryWrite(void *ptr, size_t size, WhoIsOnline *const wio = reinterpret_cast<WhoIsOnline *>(stream); const size_t totalMem = size * nmemb; wio->mMemoryBuffer = static_cast<char*>(realloc(wio->mMemoryBuffer, - wio->mDownloadedBytes + totalMem)); + static_cast<size_t>(wio->mDownloadedBytes) + totalMem)); if (wio->mMemoryBuffer) { memcpy(&(wio->mMemoryBuffer[wio->mDownloadedBytes]), ptr, totalMem); diff --git a/src/gui/windows/whoisonline.h b/src/gui/windows/whoisonline.h index 448321866..35b36fd7e 100644 --- a/src/gui/windows/whoisonline.h +++ b/src/gui/windows/whoisonline.h @@ -189,7 +189,7 @@ private: UPDATE_LIST }; - time_t mUpdateTimer; + int mUpdateTimer; /** A thread that use libcurl to download updates. */ SDL_Thread *mThread; |