summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gui/chatwindow.cpp5
-rw-r--r--src/gui/serverdialog.cpp2
-rw-r--r--src/gui/serverdialog.h2
-rw-r--r--src/gui/skilldialog.cpp2
-rw-r--r--src/gui/widgets/scrollarea.cpp4
-rw-r--r--src/map.cpp2
-rw-r--r--src/resources/beinginfo.cpp13
-rw-r--r--src/resources/beinginfo.h2
-rw-r--r--src/resources/imagewriter.cpp2
-rw-r--r--src/resources/iteminfo.h2
-rw-r--r--src/utils/translation/translationmanager.cpp2
-rw-r--r--src/utils/translation/translationmanager.h2
12 files changed, 24 insertions, 16 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", "");
diff --git a/src/map.cpp b/src/map.cpp
index df49b2eb9..07d28b164 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -892,7 +892,7 @@ Path Map::findPath(const int startX, const int startY,
// The basic walking cost of a tile.
static const int basicCost = 100;
const int basicCost2 = 100 * 362 / 256;
- const float basicCostF = 100 * 362 / 256;
+ const float basicCostF = 100.0 * 362 / 256;
// Path to be built up (empty by default)
Path path;
diff --git a/src/resources/beinginfo.cpp b/src/resources/beinginfo.cpp
index 48e8b8493..84d32f623 100644
--- a/src/resources/beinginfo.cpp
+++ b/src/resources/beinginfo.cpp
@@ -77,7 +77,7 @@ BeingInfo::~BeingInfo()
delete_all(mDisplay.sprites);
}
-void BeingInfo::setDisplay(SpriteDisplay display)
+void BeingInfo::setDisplay(const SpriteDisplay &display)
{
mDisplay = display;
}
@@ -119,8 +119,15 @@ const SoundInfo &BeingInfo::getSound(const SoundEvent event) const
static SoundInfo emptySound("", 0);
const SoundEvents::const_iterator i = mSounds.find(event);
- return (i == mSounds.end() || !i->second || i->second->empty())
- ? emptySound : i->second->at(rand() % i->second->size());
+
+ if (i == mSounds.end())
+ return emptySound;
+
+ const SoundInfoVect *const vect = i->second;
+ if (!vect || vect->empty())
+ return emptySound;
+ else
+ return vect->at(rand() % vect->size());
}
const Attack *BeingInfo::getAttack(const int id) const
diff --git a/src/resources/beinginfo.h b/src/resources/beinginfo.h
index 7437e464d..d465dfa64 100644
--- a/src/resources/beinginfo.h
+++ b/src/resources/beinginfo.h
@@ -101,7 +101,7 @@ class BeingInfo final
const std::string &getName() const A_WARN_UNUSED
{ return mName; }
- void setDisplay(SpriteDisplay display);
+ void setDisplay(const SpriteDisplay &display);
const SpriteDisplay &getDisplay() const A_WARN_UNUSED
{ return mDisplay; }
diff --git a/src/resources/imagewriter.cpp b/src/resources/imagewriter.cpp
index 9bdde319b..1db9f139d 100644
--- a/src/resources/imagewriter.cpp
+++ b/src/resources/imagewriter.cpp
@@ -84,12 +84,14 @@ bool ImageWriter::writePNG(SDL_Surface *const surface,
png_set_packing(png_ptr);
png_bytep *const row_pointers = new png_bytep[surface->h];
+/*
if (!row_pointers)
{
logger->log1("Had trouble converting surface to row pointers");
fclose(fp);
return false;
}
+*/
for (int i = 0; i < surface->h; i++)
{
diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h
index 01522ef7b..292089dc5 100644
--- a/src/resources/iteminfo.h
+++ b/src/resources/iteminfo.h
@@ -124,7 +124,7 @@ class ItemInfo final
std::string getParticleEffect() const A_WARN_UNUSED
{ return mParticle; }
- void setDisplay(SpriteDisplay display)
+ void setDisplay(const SpriteDisplay &display)
{ mDisplay = display; }
const SpriteDisplay &getDisplay() const A_WARN_UNUSED
diff --git a/src/utils/translation/translationmanager.cpp b/src/utils/translation/translationmanager.cpp
index 551511571..0a5e7bca5 100644
--- a/src/utils/translation/translationmanager.cpp
+++ b/src/utils/translation/translationmanager.cpp
@@ -53,7 +53,7 @@ void TranslationManager::close()
translator = nullptr;
}
-PoDict *TranslationManager::loadLang(LangVect lang,
+PoDict *TranslationManager::loadLang(const LangVect &lang,
const std::string &subName,
PoDict *const dict)
{
diff --git a/src/utils/translation/translationmanager.h b/src/utils/translation/translationmanager.h
index 8d890fbd7..682d6ceb3 100644
--- a/src/utils/translation/translationmanager.h
+++ b/src/utils/translation/translationmanager.h
@@ -30,7 +30,7 @@ class PoDict;
class TranslationManager final
{
public:
- static PoDict *loadLang(StringVect lang,
+ static PoDict *loadLang(const StringVect &lang,
const std::string &subName,
PoDict *const dict = nullptr);