diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-09-20 20:50:50 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-09-20 20:50:50 +0300 |
commit | 4b19b15936faa8e1d5f331cc11147ccfc360bde7 (patch) | |
tree | e601b548c0c55a7e434b30cfff328ca5e3662bee /src/gui | |
parent | 042c4f09e34157522692d6f99f5c51bc04e8f27a (diff) | |
download | manaplus-4b19b15936faa8e1d5f331cc11147ccfc360bde7.tar.gz manaplus-4b19b15936faa8e1d5f331cc11147ccfc360bde7.tar.bz2 manaplus-4b19b15936faa8e1d5f331cc11147ccfc360bde7.tar.xz manaplus-4b19b15936faa8e1d5f331cc11147ccfc360bde7.zip |
improve a bit code speed.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/chatwindow.cpp | 5 | ||||
-rw-r--r-- | src/gui/serverdialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/serverdialog.h | 2 | ||||
-rw-r--r-- | src/gui/skilldialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/scrollarea.cpp | 4 |
5 files changed, 7 insertions, 8 deletions
diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp index 33a621cfe..9fca48e7d 100644 --- a/src/gui/chatwindow.cpp +++ b/src/gui/chatwindow.cpp @@ -861,7 +861,8 @@ void ChatWindow::keyPressed(gcn::KeyEvent &event) const ChatTab *const tab = getFocused(); if (tab && tab->hasRows()) { - const size_t &tabSize = tab->getRows().size(); + const std::list<std::string> &rows = tab->getRows(); + const size_t &tabSize = rows.size(); if (mChatHistoryIndex + 1 < tabSize) { mChatHistoryIndex ++; @@ -880,7 +881,7 @@ void ChatWindow::keyPressed(gcn::KeyEvent &event) unsigned int f = 0; for (std::list<std::string>::const_iterator - it = tab->getRows().begin(), it_end = tab->getRows().end(); + it = rows.begin(), it_end = rows.end(); it != it_end; ++it, f++) { if (f == mChatHistoryIndex) diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index 17d299772..325d43502 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -841,7 +841,7 @@ int ServerDialog::downloadUpdate(void *ptr, DownloadStatus status, return 0; } -void ServerDialog::updateServer(ServerInfo server, const int index) +void ServerDialog::updateServer(const ServerInfo &server, const int index) { saveCustomServers(server, index); } diff --git a/src/gui/serverdialog.h b/src/gui/serverdialog.h index 464947145..c1edb36ad 100644 --- a/src/gui/serverdialog.h +++ b/src/gui/serverdialog.h @@ -125,7 +125,7 @@ class ServerDialog : public Window, void logic() override; - void updateServer(ServerInfo server, const int index); + void updateServer(const ServerInfo &server, const int index); void connectToSelectedServer(); diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp index 92c2ecace..1f36d6de9 100644 --- a/src/gui/skilldialog.cpp +++ b/src/gui/skilldialog.cpp @@ -610,7 +610,7 @@ void SkillDialog::addSkill(const int id, const int level, const int range, skill->id = static_cast<unsigned int>(id); SkillData *const data = skill->data; data->name = "Unknown skill Id: " + toString(id); - data->dispName = "Unknown skill Id: " + toString(id); + data->dispName = data->name; data->description.clear(); data->setIcon(""); skill->modifiable = modifiable; diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index 56fdd299b..061db3333 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -148,10 +148,8 @@ void ScrollArea::init(std::string skinName) skinName = "scroll_background.xml"; Theme *const theme = Theme::instance(); if (theme) - theme->loadRect(background, skinName, "scroll_background.xml"); - - if (theme) { + theme->loadRect(background, skinName, "scroll_background.xml"); theme->loadRect(vMarker, "scroll.xml", ""); theme->loadRect(vMarkerHi, "scroll_highlighted.xml", "scroll.xml"); theme->loadRect(vBackground, "scroll_vbackground.xml", ""); |