summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-03-29 03:51:37 +0300
committerAndrei Karas <akaras@inbox.ru>2012-03-29 03:52:16 +0300
commit3bf4e26b1319295532bb4396cbd6406d85cbcae0 (patch)
tree80a4303b29aafa21683e90e45798283a482bf1d1 /src
parent7f607a0f58a9eba53237955c06bf445c71d57b6c (diff)
downloadmv-3bf4e26b1319295532bb4396cbd6406d85cbcae0.tar.gz
mv-3bf4e26b1319295532bb4396cbd6406d85cbcae0.tar.bz2
mv-3bf4e26b1319295532bb4396cbd6406d85cbcae0.tar.xz
mv-3bf4e26b1319295532bb4396cbd6406d85cbcae0.zip
Replace vectors with strings to short names.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/Makefile.am1
-rw-r--r--src/actorsprite.cpp3
-rw-r--r--src/actorspritemanager.cpp6
-rw-r--r--src/actorspritemanager.h6
-rw-r--r--src/being.cpp2
-rw-r--r--src/being.h4
-rw-r--r--src/commandhandler.cpp12
-rw-r--r--src/gui/charcreatedialog.cpp2
-rw-r--r--src/gui/charcreatedialog.h5
-rw-r--r--src/gui/chatwindow.cpp16
-rw-r--r--src/gui/chatwindow.h10
-rw-r--r--src/gui/didyouknowwindow.cpp4
-rw-r--r--src/gui/gui.cpp2
-rw-r--r--src/gui/helpwindow.cpp4
-rw-r--r--src/gui/inventorywindow.cpp2
-rw-r--r--src/gui/itemamountwindow.cpp2
-rw-r--r--src/gui/npcdialog.h6
-rw-r--r--src/gui/setup_relations.cpp7
-rw-r--r--src/gui/setup_video.cpp8
-rw-r--r--src/gui/socialwindow.cpp12
-rw-r--r--src/gui/textcommandeditor.cpp3
-rw-r--r--src/gui/theme.cpp6
-rw-r--r--src/gui/theme.h10
-rw-r--r--src/gui/whoisonline.h12
-rw-r--r--src/gui/widgets/chattab.h4
-rw-r--r--src/gui/widgets/guildchattab.cpp2
-rw-r--r--src/gui/widgets/guildchattab.h2
-rw-r--r--src/gui/widgets/namesmodel.h8
-rw-r--r--src/gui/widgets/whispertab.cpp2
-rw-r--r--src/gui/widgets/whispertab.h2
-rw-r--r--src/guild.cpp2
-rw-r--r--src/guild.h5
-rw-r--r--src/guildmanager.cpp6
-rw-r--r--src/guildmanager.h7
-rw-r--r--src/net/ea/charserverhandler.cpp2
-rw-r--r--src/net/ea/gui/guildtab.cpp2
-rw-r--r--src/net/ea/gui/guildtab.h2
-rw-r--r--src/net/ea/gui/partytab.cpp2
-rw-r--r--src/net/ea/gui/partytab.h2
-rw-r--r--src/net/logindata.h2
-rw-r--r--src/net/manaserv/attributes.cpp4
-rw-r--r--src/net/manaserv/attributes.h5
-rw-r--r--src/net/tmwa/loginhandler.cpp4
-rw-r--r--src/party.cpp2
-rw-r--r--src/party.h5
-rw-r--r--src/playerrelations.cpp15
-rw-r--r--src/playerrelations.h9
-rw-r--r--src/resources/beinginfo.cpp2
-rw-r--r--src/resources/beinginfo.h4
-rw-r--r--src/resources/emotedb.h6
-rw-r--r--src/resources/itemdb.cpp4
-rw-r--r--src/resources/itemdb.h6
-rw-r--r--src/resources/iteminfo.cpp3
-rw-r--r--src/resources/iteminfo.h4
-rw-r--r--src/resources/resourcemanager.cpp6
-rw-r--r--src/resources/resourcemanager.h10
-rw-r--r--src/resources/spritedef.cpp6
-rw-r--r--src/resources/spritedef.h5
-rw-r--r--src/resources/wallpaper.cpp3
-rw-r--r--src/spellmanager.h1
-rw-r--r--src/utils/langs.cpp4
-rw-r--r--src/utils/langs.h2
-rw-r--r--src/utils/stringutils.cpp9
-rw-r--r--src/utils/stringutils.h8
-rw-r--r--src/utils/stringvector.h31
-rw-r--r--src/utils/translation/translationmanager.cpp2
-rw-r--r--src/utils/translation/translationmanager.h7
68 files changed, 184 insertions, 181 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 51609d8eb..57fe19ca0 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -474,6 +474,7 @@ SET(SRCS
utils/process.h
utils/stringutils.cpp
utils/stringutils.h
+ utils/stringvector.h
utils/mutex.h
utils/mkdir.cpp
utils/mkdir.h
diff --git a/src/Makefile.am b/src/Makefile.am
index 31ce74d41..11db85f77 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -483,6 +483,7 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \
utils/specialfolder.h \
utils/stringutils.cpp \
utils/stringutils.h \
+ utils/stringvector.h \
utils/mutex.h \
utils/xml.cpp \
utils/xml.h \
diff --git a/src/actorsprite.cpp b/src/actorsprite.cpp
index 916b599f9..e558e2469 100644
--- a/src/actorsprite.cpp
+++ b/src/actorsprite.cpp
@@ -372,7 +372,8 @@ void ActorSprite::setupSpriteDisplay(const SpriteDisplay &display,
//setup particle effects
if (Particle::enabled && particleEngine)
{
- std::vector<std::string>::const_iterator itr, itr_end;
+ StringVectCIter itr;
+ StringVectCIter itr_end;
for (itr = display.particles.begin(),
itr_end = display.particles.end();
itr != itr_end; ++itr)
diff --git a/src/actorspritemanager.cpp b/src/actorspritemanager.cpp
index 758a452b1..af30b2fa6 100644
--- a/src/actorspritemanager.cpp
+++ b/src/actorspritemanager.cpp
@@ -45,7 +45,6 @@
#include <algorithm>
#include <list>
-#include <vector>
#include "debug.h"
@@ -1216,8 +1215,7 @@ void ActorSpriteManager::printBeingsToChat(std::vector<Being*> beings,
debugChatTab->chatLog("---------------------------------------");
}
-void ActorSpriteManager::getPlayerNames(std::vector<std::string> &names,
- bool npcNames)
+void ActorSpriteManager::getPlayerNames(StringVect &names, bool npcNames)
{
names.clear();
@@ -1242,7 +1240,7 @@ void ActorSpriteManager::getPlayerNames(std::vector<std::string> &names,
}
}
-void ActorSpriteManager::getMobNames(std::vector<std::string> &names)
+void ActorSpriteManager::getMobNames(StringVect &names)
{
names.clear();
diff --git a/src/actorspritemanager.h b/src/actorspritemanager.h
index d30bad426..74ee3b095 100644
--- a/src/actorspritemanager.h
+++ b/src/actorspritemanager.h
@@ -28,7 +28,7 @@
#include "configlistener.h"
#include "flooritem.h"
-#include <vector>
+#include "utils/stringvector.h"
class LocalPlayer;
class Map;
@@ -204,10 +204,10 @@ class ActorSpriteManager: public ConfigListener
void printBeingsToChat(std::vector<Being*> beings,
std::string header) const;
- void getPlayerNames(std::vector<std::string> &names,
+ void getPlayerNames(StringVect &names,
bool npcNames);
- void getMobNames(std::vector<std::string> &names);
+ void getMobNames(StringVect &names);
void updatePlayerNames();
diff --git a/src/being.cpp b/src/being.cpp
index 15d93f251..93199024f 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -2546,7 +2546,7 @@ std::string Being::loadComment(const std::string &name, int type)
str += stringToHexPath(name) + "/comment.txt";
logger->log("load from: %s", str.c_str());
- std::vector<std::string> lines;
+ StringVect lines;
ResourceManager *resman = ResourceManager::getInstance();
if (resman->existsLocal(str))
diff --git a/src/being.h b/src/being.h
index 19b7ccbb7..250073faa 100644
--- a/src/being.h
+++ b/src/being.h
@@ -36,8 +36,6 @@
#include <map>
#include <set>
-#include <string>
-#include <vector>
#define FIRST_IGNORE_EMOTE 14
#define STATUS_EFFECTS 32
@@ -846,7 +844,7 @@ class Being : public ActorSprite, public ConfigListener
Vector mDest; /**< destination coordinates. */
std::vector<int> mSpriteIDs;
- std::vector<std::string> mSpriteColors;
+ StringVect mSpriteColors;
std::vector<int> mSpriteColorsIds;
Gender mGender;
diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp
index 67b03e78c..c19836cc5 100644
--- a/src/commandhandler.cpp
+++ b/src/commandhandler.cpp
@@ -1308,11 +1308,11 @@ void CommandHandler::replaceVars(std::string &str)
}
if (str.find("<PEOPLE>") != std::string::npos)
{
- std::vector<std::string> names;
+ StringVect names;
std::string newStr = "";
actorSpriteManager->getPlayerNames(names, false);
- std::vector<std::string>::const_iterator it = names.begin();
- std::vector<std::string>::const_iterator it_end = names.end();
+ StringVectCIter it = names.begin();
+ StringVectCIter it_end = names.end();
for (; it != it_end; ++ it)
{
if (*it != player_node->getName())
@@ -1327,14 +1327,14 @@ void CommandHandler::replaceVars(std::string &str)
}
if (str.find("<PARTY>") != std::string::npos)
{
- std::vector<std::string> names;
+ StringVect names;
std::string newStr = "";
Party *party = nullptr;
if (player_node->isInParty() && (party = player_node->getParty()))
{
party->getNames(names);
- std::vector<std::string>::const_iterator it = names.begin();
- std::vector<std::string>::const_iterator it_end = names.end();
+ StringVectCIter it = names.begin();
+ StringVectCIter it_end = names.end();
for (; it != it_end; ++ it)
{
if (*it != player_node->getName())
diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp
index 0b20952c8..864ddf0b6 100644
--- a/src/gui/charcreatedialog.cpp
+++ b/src/gui/charcreatedialog.cpp
@@ -396,7 +396,7 @@ int CharCreateDialog::getDistributedPoints() const
return points;
}
-void CharCreateDialog::setAttributes(const std::vector<std::string> &labels,
+void CharCreateDialog::setAttributes(const StringVect &labels,
int available, int min, int max)
{
mMaxPoints = available;
diff --git a/src/gui/charcreatedialog.h b/src/gui/charcreatedialog.h
index 8be421543..15fdf7466 100644
--- a/src/gui/charcreatedialog.h
+++ b/src/gui/charcreatedialog.h
@@ -32,9 +32,6 @@
#include <guichan/actionlistener.hpp>
-#include <string>
-#include <vector>
-
class LocalPlayer;
class PlayerBox;
class TextField;
@@ -64,7 +61,7 @@ class CharCreateDialog : public Window, public gcn::ActionListener
*/
void unlock();
- void setAttributes(const std::vector<std::string> &labels,
+ void setAttributes(const StringVect &labels,
int available,
int min, int max);
diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp
index 528c1e39e..0403b5e17 100644
--- a/src/gui/chatwindow.cpp
+++ b/src/gui/chatwindow.cpp
@@ -331,10 +331,10 @@ void ChatWindow::loadGMCommands()
const char *fileName = "gmcommands.txt";
ResourceManager *resman = ResourceManager::getInstance();
- std::vector<std::string> list;
+ StringVect list;
resman->loadTextFile(fileName, list);
- std::vector<std::string>::const_iterator it = list.begin();
- std::vector<std::string>::const_iterator it_end = list.end();
+ StringVectCIter it = list.begin();
+ StringVectCIter it_end = list.end();
while (it != it_end)
{
@@ -1194,7 +1194,7 @@ void ChatWindow::autoComplete()
return;
ChatTab *cTab = static_cast<ChatTab*>(mChatTabs->getSelectedTab());
- std::vector<std::string> nameList;
+ StringVect nameList;
if (cTab)
cTab->getAutoCompleteList(nameList);
@@ -1243,10 +1243,10 @@ void ChatWindow::autoComplete()
}
}
-std::string ChatWindow::autoComplete(std::vector<std::string> &names,
+std::string ChatWindow::autoComplete(StringVect &names,
std::string partName) const
{
- std::vector<std::string>::const_iterator i = names.begin();
+ StringVectCIter i = names.begin();
toLower(partName);
std::string newName("");
@@ -1282,7 +1282,7 @@ std::string ChatWindow::autoComplete(std::string partName, History *words)
return "";
Commands::const_iterator i = words->begin();
- std::vector<std::string> nameList;
+ StringVect nameList;
while (i != words->end())
{
@@ -1310,7 +1310,7 @@ void ChatWindow::moveTabRight(ChatTab *tab)
std::string ChatWindow::autoCompleteHistory(std::string partName)
{
History::const_iterator i = mHistory.begin();
- std::vector<std::string> nameList;
+ StringVect nameList;
while (i != mHistory.end())
{
diff --git a/src/gui/chatwindow.h b/src/gui/chatwindow.h
index df452f9a7..05882aa69 100644
--- a/src/gui/chatwindow.h
+++ b/src/gui/chatwindow.h
@@ -29,15 +29,15 @@
#include "gui/widgets/window.h"
+#include "utils/stringvector.h"
+
#include <guichan/actionlistener.hpp>
#include <guichan/keylistener.hpp>
#include <guichan/widget.hpp>
#include <guichan/widgetlistener.hpp>
#include <list>
-#include <string>
#include <map>
-#include <vector>
#include <set>
class BrowserBox;
@@ -302,7 +302,7 @@ class ChatWindow : public Window,
std::string autoComplete(std::string partName, History *words);
- std::string autoComplete(std::vector<std::string> &names,
+ std::string autoComplete(StringVect &names,
std::string partName) const;
/** Used for showing item popup on clicking links **/
@@ -341,14 +341,14 @@ class ChatWindow : public Window,
bool mReturnToggles; /**< Marks whether <Return> toggles the chat log
or not */
- std::vector<std::string> mTradeFilter;
+ StringVect mTradeFilter;
gcn::DropDown *mColorPicker;
ColorListModel *mColorListModel;
int mChatColor;
unsigned int mChatHistoryIndex;
std::list<std::string> mAwayLog;
- std::vector<std::string> mHighlights;
+ StringVect mHighlights;
bool mGMLoaded;
bool mHaveMouse;
bool mAutoHide;
diff --git a/src/gui/didyouknowwindow.cpp b/src/gui/didyouknowwindow.cpp
index a071e1ffc..e68f5ab22 100644
--- a/src/gui/didyouknowwindow.cpp
+++ b/src/gui/didyouknowwindow.cpp
@@ -131,12 +131,12 @@ void DidYouKnowWindow::loadData(int num)
void DidYouKnowWindow::loadFile(int num)
{
const std::string file = strprintf("tips/%d", num);
- const std::vector<std::string> langs = getLang();
+ const StringVect langs = getLang();
std::string helpPath = branding.getStringValue("helpPath");
if (helpPath.empty())
helpPath = paths.getStringValue("help");
- std::vector<std::string> lines;
+ StringVect lines;
TranslationManager::translateFile(helpPath + file + ".txt",
translator, lines);
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index f8d68a672..9d111141b 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -106,7 +106,7 @@ Gui::Gui(Graphics *graphics):
Window::setWindowContainer(guiTop);
setTop(guiTop);
- const std::vector<std::string> langs = getLang();
+ const StringVect langs = getLang();
const bool isJapan = (!langs.empty() && langs[0].size() > 3
&& langs[0].substr(0, 3) == "ja_");
diff --git a/src/gui/helpwindow.cpp b/src/gui/helpwindow.cpp
index 0a28855b9..3ae025514 100644
--- a/src/gui/helpwindow.cpp
+++ b/src/gui/helpwindow.cpp
@@ -107,12 +107,12 @@ void HelpWindow::loadHelp(const std::string &helpFile)
void HelpWindow::loadFile(const std::string &file)
{
- const std::vector<std::string> langs = getLang();
+ const StringVect langs = getLang();
std::string helpPath = branding.getStringValue("helpPath");
if (helpPath.empty())
helpPath = paths.getStringValue("help");
- std::vector<std::string> lines;
+ StringVect lines;
TranslationManager::translateFile(helpPath + file + ".txt",
translator, lines);
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index 7ceeb6e34..e21b07f44 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -149,7 +149,7 @@ InventoryWindow::InventoryWindow(Inventory *inventory):
mFilterLabel = new Label(_("Filter:"));
mNameFilter = new TextField("", true, this, "namefilter", true);
- std::vector<std::string> tags = ItemDB::getTags();
+ StringVect tags = ItemDB::getTags();
for (unsigned f = 0; f < tags.size(); f ++)
mFilter->addButton(tags[f]);
diff --git a/src/gui/itemamountwindow.cpp b/src/gui/itemamountwindow.cpp
index 3b01b559f..ef1aad258 100644
--- a/src/gui/itemamountwindow.cpp
+++ b/src/gui/itemamountwindow.cpp
@@ -95,7 +95,7 @@ public:
return mStrings.at(i);
}
private:
- std::vector<std::string> mStrings;
+ StringVect mStrings;
};
void ItemAmountWindow::finish(Item *item, int amount, int price, Usage usage)
diff --git a/src/gui/npcdialog.h b/src/gui/npcdialog.h
index 7bd2ee76d..a779fcc64 100644
--- a/src/gui/npcdialog.h
+++ b/src/gui/npcdialog.h
@@ -27,12 +27,12 @@
#include "gui/widgets/window.h"
+#include "utils/stringvector.h"
+
#include <guichan/actionlistener.hpp>
#include <guichan/listmodel.hpp>
#include <list>
-#include <string>
-#include <vector>
class BrowserBox;
class ItemLinkHandler;
@@ -201,7 +201,7 @@ class NpcDialog : public Window, public gcn::ActionListener,
// Used for choice input
ListBox *mItemList;
gcn::ScrollArea *mListScrollArea;
- std::vector<std::string> mItems;
+ StringVect mItems;
ItemLinkHandler *mItemLinkHandler;
// Used for string and integer input
diff --git a/src/gui/setup_relations.cpp b/src/gui/setup_relations.cpp
index d9f7a362d..d685cf6f5 100644
--- a/src/gui/setup_relations.cpp
+++ b/src/gui/setup_relations.cpp
@@ -42,9 +42,6 @@
#include "utils/dtor.h"
#include "utils/gettext.h"
-#include <string>
-#include <vector>
-
#define COLUMNS_NR 2 // name plus listbox
#define NAME_COLUMN 0
#define RELATION_CHOICE_COLUMN 1
@@ -146,7 +143,7 @@ public:
signalBeforeUpdate();
freeWidgets();
- std::vector<std::string> *player_names = player_relations.getPlayers();
+ StringVect *player_names = player_relations.getPlayers();
if (!player_names)
return;
@@ -201,7 +198,7 @@ public:
}
protected:
- std::vector<std::string> *mPlayers;
+ StringVect *mPlayers;
std::vector<gcn::Widget *> mWidgets;
PlayerRelationListModel *mListModel;
};
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp
index 24d42c83d..a416b2027 100644
--- a/src/gui/setup_video.cpp
+++ b/src/gui/setup_video.cpp
@@ -54,8 +54,6 @@
#include <SDL.h>
#include <algorithm>
-#include <string>
-#include <vector>
#include "debug.h"
@@ -102,7 +100,7 @@ class ModeListModel : public gcn::ListModel
private:
void addCustomMode(std::string mode);
- std::vector<std::string> mVideoModes;
+ StringVect mVideoModes;
};
bool modeSorter(std::string mode1, std::string mode2);
@@ -166,8 +164,8 @@ ModeListModel::ModeListModel()
void ModeListModel::addCustomMode(std::string mode)
{
- std::vector<std::string>::const_iterator it = mVideoModes.begin();
- std::vector<std::string>::const_iterator it_end = mVideoModes.end();
+ StringVectCIter it = mVideoModes.begin();
+ StringVectCIter it_end = mVideoModes.end();
while (it != it_end)
{
if (*it == mode)
diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp
index f0ac9e128..361e94037 100644
--- a/src/gui/socialwindow.cpp
+++ b/src/gui/socialwindow.cpp
@@ -576,7 +576,7 @@ public:
if (actorSpriteManager)
{
- std::vector<std::string> names;
+ StringVect names;
actorSpriteManager->getPlayerNames(names, false);
std::vector<Avatar*>::iterator ai = avatars->begin();
@@ -587,7 +587,7 @@ public:
if (!ava)
break;
- std::vector<std::string>::const_iterator i = names.begin();
+ StringVectCIter i = names.begin();
while (i != names.end())
{
if (ava->getName() == (*i) && (*i) != "")
@@ -609,7 +609,7 @@ public:
}
}
- std::vector<std::string>::const_iterator i = names.begin();
+ StringVectCIter i = names.begin();
while (i != names.end())
{
@@ -1141,7 +1141,7 @@ public:
}
avatars->clear();
- std::vector<std::string> *players
+ StringVect *players
= player_relations.getPlayersByRelation(PlayerRelation::FRIEND);
const std::set<std::string> &players2 = whoIsOnline->getOnlineNicks();
@@ -1149,8 +1149,8 @@ public:
if (!players)
return;
- std::vector<std::string>::iterator it = players->begin();
- std::vector<std::string>::iterator it_end = players->end();
+ StringVectIter it = players->begin();
+ StringVectIter it_end = players->end();
for (; it != it_end; ++ it)
{
Avatar *ava = nullptr;
diff --git a/src/gui/textcommandeditor.cpp b/src/gui/textcommandeditor.cpp
index 3f98b4ea3..fe695e0ea 100644
--- a/src/gui/textcommandeditor.cpp
+++ b/src/gui/textcommandeditor.cpp
@@ -24,7 +24,6 @@
#include <SDL.h>
#include <SDL_thread.h>
-#include <vector>
#include <algorithm>
#include "gui/chatwindow.h"
@@ -103,7 +102,7 @@ public:
return mStrings.at(i);
}
private:
- std::vector<std::string> mStrings;
+ StringVect mStrings;
};
diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp
index 3a09810d0..dad553e81 100644
--- a/src/gui/theme.cpp
+++ b/src/gui/theme.cpp
@@ -533,7 +533,7 @@ bool Theme::tryThemePath(std::string themeName)
return false;
}
-void Theme::fillSkinsList(std::vector<std::string> &list)
+void Theme::fillSkinsList(StringVect &list)
{
char **skins = PHYSFS_enumerateFiles(
branding.getStringValue("guiThemePath").c_str());
@@ -550,7 +550,7 @@ void Theme::fillSkinsList(std::vector<std::string> &list)
PHYSFS_freeList(skins);
}
-void Theme::fillFontsList(std::vector<std::string> &list)
+void Theme::fillFontsList(StringVect &list)
{
PHYSFS_permitSymbolicLinks(1);
char **fonts = PHYSFS_enumerateFiles(
@@ -569,7 +569,7 @@ void Theme::fillFontsList(std::vector<std::string> &list)
PHYSFS_permitSymbolicLinks(0);
}
-void Theme::fillSoundsList(std::vector<std::string> &list)
+void Theme::fillSoundsList(StringVect &list)
{
char **skins = PHYSFS_enumerateFiles(
branding.getStringValue("systemsounds").c_str());
diff --git a/src/gui/theme.h b/src/gui/theme.h
index c30044dc7..c547e5351 100644
--- a/src/gui/theme.h
+++ b/src/gui/theme.h
@@ -30,9 +30,9 @@
#include "gui/palette.h"
+#include "utils/stringvector.h"
+
#include <map>
-#include <string>
-#include <vector>
class DyePalette;
class Image;
@@ -127,11 +127,11 @@ class Theme : public Palette, public ConfigListener
static std::string getThemeName()
{ return mThemeName; }
- static void fillSkinsList(std::vector<std::string> &list);
+ static void fillSkinsList(StringVect &list);
- static void fillFontsList(std::vector<std::string> &list);
+ static void fillFontsList(StringVect &list);
- static void fillSoundsList(std::vector<std::string> &list);
+ static void fillSoundsList(StringVect &list);
/**
* Returns the patch to the given gui resource relative to the theme
diff --git a/src/gui/whoisonline.h b/src/gui/whoisonline.h
index 46fe74f62..4b5b52fe4 100644
--- a/src/gui/whoisonline.h
+++ b/src/gui/whoisonline.h
@@ -23,16 +23,16 @@
#ifndef WHOISONLINE_H
#define WHOISONLINE_H
-#include <string>
-#include <set>
-#include <vector>
-
#include "configlistener.h"
#include "gui/widgets/linkhandler.h"
#include "gui/widgets/window.h"
-#include "../utils/mutex.h"
+#include "utils/stringvector.h"
+
+#include "utils/mutex.h"
+
+#include <set>
#include <guichan/actionlistener.hpp>
@@ -136,7 +136,7 @@ public:
void optionChanged(const std::string &name);
- void updateList(std::vector<std::string> &list);
+ void updateList(StringVect &list);
void readFromWeb();
diff --git a/src/gui/widgets/chattab.h b/src/gui/widgets/chattab.h
index d67f56b54..d11a85138 100644
--- a/src/gui/widgets/chattab.h
+++ b/src/gui/widgets/chattab.h
@@ -28,6 +28,8 @@
#include "gui/widgets/browserbox.h"
#include "gui/widgets/tab.h"
+#include "utils/stringvector.h"
+
#include "localconsts.h"
class ScrollArea;
@@ -175,7 +177,7 @@ class ChatTab : public Tab
virtual void handleCommand(const std::string &msg);
- virtual void getAutoCompleteList(std::vector<std::string>&) const
+ virtual void getAutoCompleteList(StringVect&) const
{}
void addRow(std::string &line);
diff --git a/src/gui/widgets/guildchattab.cpp b/src/gui/widgets/guildchattab.cpp
index bad34cfb3..9fed16e92 100644
--- a/src/gui/widgets/guildchattab.cpp
+++ b/src/gui/widgets/guildchattab.cpp
@@ -113,7 +113,7 @@ void GuildChatTab::showHelp()
chatLog(_("/kick > Kick some one from the guild you are in"));
}
-void GuildChatTab::getAutoCompleteList(std::vector<std::string> &names) const
+void GuildChatTab::getAutoCompleteList(StringVect &names) const
{
if (!guildManager)
return;
diff --git a/src/gui/widgets/guildchattab.h b/src/gui/widgets/guildchattab.h
index e729844f4..358c1f1d4 100644
--- a/src/gui/widgets/guildchattab.h
+++ b/src/gui/widgets/guildchattab.h
@@ -49,7 +49,7 @@ class GuildChatTab : public ChatTab
protected:
void handleInput(const std::string &msg);
- void getAutoCompleteList(std::vector<std::string> &names) const;
+ void getAutoCompleteList(StringVect &names) const;
};
#endif
diff --git a/src/gui/widgets/namesmodel.h b/src/gui/widgets/namesmodel.h
index dc694fc46..e1dbf0a89 100644
--- a/src/gui/widgets/namesmodel.h
+++ b/src/gui/widgets/namesmodel.h
@@ -21,12 +21,10 @@
#ifndef GUI_WIDGETS_NAMESMODEL_H
#define GUI_WIDGETS_NAMESMODEL_H
-//#include "guichanfwd.h"
+#include "utils/stringvector.h"
#include <guichan/listmodel.hpp>
-#include <vector>
-
class NamesModel : public gcn::ListModel
{
public:
@@ -38,14 +36,14 @@ class NamesModel : public gcn::ListModel
virtual std::string getElementAt(int i);
- std::vector<std::string> &getNames()
+ StringVect &getNames()
{ return mNames; }
size_t size()
{ return mNames.size(); }
protected:
- std::vector<std::string> mNames;
+ StringVect mNames;
};
#endif
diff --git a/src/gui/widgets/whispertab.cpp b/src/gui/widgets/whispertab.cpp
index 625c8a392..007002e21 100644
--- a/src/gui/widgets/whispertab.cpp
+++ b/src/gui/widgets/whispertab.cpp
@@ -166,7 +166,7 @@ void WhisperTab::saveToLogFile(std::string &msg)
chatLogger->log(getNick(), msg);
}
-void WhisperTab::getAutoCompleteList(std::vector<std::string> &names) const
+void WhisperTab::getAutoCompleteList(StringVect &names) const
{
names.push_back(mNick);
}
diff --git a/src/gui/widgets/whispertab.h b/src/gui/widgets/whispertab.h
index 72d407ac2..226ebaf40 100644
--- a/src/gui/widgets/whispertab.h
+++ b/src/gui/widgets/whispertab.h
@@ -46,7 +46,7 @@ class WhisperTab : public ChatTab
void saveToLogFile(std::string &msg);
- void getAutoCompleteList(std::vector<std::string> &names) const;
+ void getAutoCompleteList(StringVect &names) const;
protected:
friend class ChatWindow;
diff --git a/src/guild.cpp b/src/guild.cpp
index 238155d32..11817c48d 100644
--- a/src/guild.cpp
+++ b/src/guild.cpp
@@ -306,7 +306,7 @@ bool Guild::isMember(const std::string &name) const
return false;
}
-void Guild::getNames(std::vector<std::string> &names) const
+void Guild::getNames(StringVect &names) const
{
names.clear();
MemberList::const_iterator it = mMembers.begin(),
diff --git a/src/guild.h b/src/guild.h
index 8715c2907..f637009d6 100644
--- a/src/guild.h
+++ b/src/guild.h
@@ -28,10 +28,9 @@
#include "gui/widgets/avatarlistbox.h"
#include "utils/dtor.h"
+#include "utils/stringvector.h"
#include <map>
-#include <string>
-#include <vector>
class Guild;
@@ -162,7 +161,7 @@ public:
bool isMember(const std::string &name) const;
- void getNames(std::vector<std::string> &names) const;
+ void getNames(StringVect &names) const;
void addPos(int id, std::string name);
diff --git a/src/guildmanager.cpp b/src/guildmanager.cpp
index 08af3b2c7..9a4437934 100644
--- a/src/guildmanager.cpp
+++ b/src/guildmanager.cpp
@@ -117,7 +117,7 @@ void GuildManager::chat(std::string msg)
mTab->chatLog(player_node->getName(), msg);
}
-void GuildManager::getNames(std::vector<std::string> &names)
+void GuildManager::getNames(StringVect &names)
{
Guild *guild = createGuild();
if (guild)
@@ -153,8 +153,8 @@ void GuildManager::updateList()
if (guild)
{
guild->setServerGuild(false);
- std::vector<std::string>::const_iterator it = mTempList.begin();
- std::vector<std::string>::const_iterator it_end = mTempList.end();
+ StringVectCIter it = mTempList.begin();
+ StringVectCIter it_end = mTempList.end();
int i = 0;
while (it != it_end)
{
diff --git a/src/guildmanager.h b/src/guildmanager.h
index b415d85e8..460fdef4e 100644
--- a/src/guildmanager.h
+++ b/src/guildmanager.h
@@ -22,10 +22,9 @@
#define GUILDMANAGER_H
#include "utils/dtor.h"
+#include "utils/stringvector.h"
#include <map>
-#include <string>
-#include <vector>
class Guild;
class GuildChatTab;
@@ -45,7 +44,7 @@ class GuildManager
bool processGuildMessage(std::string msg);
- void getNames(std::vector<std::string> &names);
+ void getNames(StringVect &names);
void requestGuildInfo();
@@ -86,7 +85,7 @@ class GuildManager
bool mSentInfoRequest;
bool mSentNameRequest;
bool mHavePower;
- std::vector<std::string> mTempList;
+ StringVect mTempList;
GuildChatTab *mTab;
bool mRequest;
};
diff --git a/src/net/ea/charserverhandler.cpp b/src/net/ea/charserverhandler.cpp
index 67894b0d9..942ba79a6 100644
--- a/src/net/ea/charserverhandler.cpp
+++ b/src/net/ea/charserverhandler.cpp
@@ -62,7 +62,7 @@ void CharServerHandler::setCharCreateDialog(CharCreateDialog *window)
if (!mCharCreateDialog)
return;
- std::vector<std::string> attributes;
+ StringVect attributes;
attributes.push_back(_("Strength:"));
attributes.push_back(_("Agility:"));
attributes.push_back(_("Vitality:"));
diff --git a/src/net/ea/gui/guildtab.cpp b/src/net/ea/gui/guildtab.cpp
index bd1521b21..3ab6a48eb 100644
--- a/src/net/ea/gui/guildtab.cpp
+++ b/src/net/ea/gui/guildtab.cpp
@@ -139,7 +139,7 @@ void GuildTab::showHelp()
chatLog(_("/kick > Kick some one from the guild you are in"));
}
-void GuildTab::getAutoCompleteList(std::vector<std::string> &names) const
+void GuildTab::getAutoCompleteList(StringVect &names) const
{
if (taGuild)
taGuild->getNames(names);
diff --git a/src/net/ea/gui/guildtab.h b/src/net/ea/gui/guildtab.h
index 22a41ce80..6ccf70903 100644
--- a/src/net/ea/gui/guildtab.h
+++ b/src/net/ea/gui/guildtab.h
@@ -52,7 +52,7 @@ class GuildTab : public ChatTab
protected:
void handleInput(const std::string &msg);
- void getAutoCompleteList(std::vector<std::string> &names) const;
+ void getAutoCompleteList(StringVect &names) const;
};
} // namespace Ea
diff --git a/src/net/ea/gui/partytab.cpp b/src/net/ea/gui/partytab.cpp
index e69207842..0e3b51928 100644
--- a/src/net/ea/gui/partytab.cpp
+++ b/src/net/ea/gui/partytab.cpp
@@ -225,7 +225,7 @@ bool PartyTab::handleCommand(const std::string &type, const std::string &args)
return true;
}
-void PartyTab::getAutoCompleteList(std::vector<std::string> &names) const
+void PartyTab::getAutoCompleteList(StringVect &names) const
{
if (!player_node)
return;
diff --git a/src/net/ea/gui/partytab.h b/src/net/ea/gui/partytab.h
index 931b283dd..a92f6e207 100644
--- a/src/net/ea/gui/partytab.h
+++ b/src/net/ea/gui/partytab.h
@@ -52,7 +52,7 @@ class PartyTab : public ChatTab
protected:
void handleInput(const std::string &msg);
- virtual void getAutoCompleteList(std::vector<std::string>&) const;
+ virtual void getAutoCompleteList(StringVect&) const;
};
extern PartyTab *partyTab;
diff --git a/src/net/logindata.h b/src/net/logindata.h
index 0f41b02ae..bf0ac40b1 100644
--- a/src/net/logindata.h
+++ b/src/net/logindata.h
@@ -59,7 +59,7 @@ class LoginData
std::string password;
std::string newPassword;
std::string updateHost;
- std::vector<std::string> updateHosts;
+ StringVect updateHosts;
std::string lastLogin;
int updateType;
diff --git a/src/net/manaserv/attributes.cpp b/src/net/manaserv/attributes.cpp
index 662032e29..9d1e159ff 100644
--- a/src/net/manaserv/attributes.cpp
+++ b/src/net/manaserv/attributes.cpp
@@ -66,7 +66,7 @@ namespace Attributes
static TagMap tags;
/** List of modifiable attribute names used at character's creation. */
- static std::vector<std::string> attributeLabels;
+ static StringVect attributeLabels;
/** Characters creation points. */
static unsigned int creationPoints = 0;
@@ -82,7 +82,7 @@ namespace Attributes
unsigned int getAttributeMaximum()
{ return attributeMaximum; }
- std::vector<std::string>& getLabels()
+ StringVect& getLabels()
{ return attributeLabels; }
/**
diff --git a/src/net/manaserv/attributes.h b/src/net/manaserv/attributes.h
index ba5931b8c..5e0aab38a 100644
--- a/src/net/manaserv/attributes.h
+++ b/src/net/manaserv/attributes.h
@@ -22,8 +22,7 @@
#ifndef NET_MANASERV_ATTRIBUTES_H
#define NET_MANASERV_ATTRIBUTES_H
-#include <string>
-#include <vector>
+#include "utils/stringvector.h"
namespace ManaServ
{
@@ -41,7 +40,7 @@ namespace Attributes
/**
* Returns the list of base attribute labels.
*/
- std::vector<std::string>& getLabels();
+ StringVect& getLabels();
/**
* Give back the corresponding playerinfo Id from the attribute id
diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp
index a2c5034d6..242270d13 100644
--- a/src/net/tmwa/loginhandler.cpp
+++ b/src/net/tmwa/loginhandler.cpp
@@ -197,8 +197,8 @@ void LoginHandler::processUpdateHost2(Net::MessageIn &msg)
std::string updateHost = msg.readString(len);
splitToStringVector(loginData.updateHosts, updateHost, '|');
- std::vector<std::string>::iterator it = loginData.updateHosts.begin();
- std::vector<std::string>::iterator it_end = loginData.updateHosts.end();
+ StringVectIter it = loginData.updateHosts.begin();
+ StringVectIter it_end = loginData.updateHosts.end();
for (; it != it_end; ++ it)
{
if (!checkPath(*it))
diff --git a/src/party.cpp b/src/party.cpp
index 1a693ddd6..6c7934c78 100644
--- a/src/party.cpp
+++ b/src/party.cpp
@@ -266,7 +266,7 @@ bool Party::isMember(const std::string &name) const
return false;
}
-void Party::getNames(std::vector<std::string> &names) const
+void Party::getNames(StringVect &names) const
{
names.clear();
MemberList::const_iterator it = mMembers.begin();
diff --git a/src/party.h b/src/party.h
index 1f616319d..f567d2d64 100644
--- a/src/party.h
+++ b/src/party.h
@@ -27,11 +27,10 @@
#include "gui/widgets/avatarlistbox.h"
#include "utils/dtor.h"
+#include "utils/stringvector.h"
#include <map>
#include <set>
-#include <string>
-#include <vector>
class Party;
@@ -143,7 +142,7 @@ public:
bool isMember(const std::string &name) const;
- void getNames(std::vector<std::string> &names) const;
+ void getNames(StringVect &names) const;
void getNamesSet(std::set<std::string> &names) const;
diff --git a/src/playerrelations.cpp b/src/playerrelations.cpp
index 38062c352..11118aee1 100644
--- a/src/playerrelations.cpp
+++ b/src/playerrelations.cpp
@@ -140,12 +140,9 @@ PlayerRelationsManager::~PlayerRelationsManager()
void PlayerRelationsManager::clear()
{
- std::vector<std::string> *names = getPlayers();
- for (std::vector<std::string>::const_iterator
- it = names->begin(); it != names->end(); ++it)
- {
+ StringVect *names = getPlayers();
+ for (StringVectCIter it = names->begin(); it != names->end(); ++ it)
removePlayer(*it);
- }
delete names;
names = nullptr;
}
@@ -345,9 +342,9 @@ void PlayerRelationsManager::setRelation(const std::string &player_name,
signalUpdate(player_name);
}
-std::vector<std::string> * PlayerRelationsManager::getPlayers()
+StringVect * PlayerRelationsManager::getPlayers()
{
- std::vector<std::string> *retval = new std::vector<std::string>();
+ StringVect *retval = new StringVect();
for (std::map<std::string,
PlayerRelation *>::const_iterator it = mRelations.begin();
@@ -362,10 +359,10 @@ std::vector<std::string> * PlayerRelationsManager::getPlayers()
return retval;
}
-std::vector<std::string> *PlayerRelationsManager::getPlayersByRelation(
+StringVect *PlayerRelationsManager::getPlayersByRelation(
PlayerRelation::Relation rel)
{
- std::vector<std::string> *retval = new std::vector<std::string>();
+ StringVect *retval = new StringVect();
for (std::map<std::string,
PlayerRelation *>::const_iterator it = mRelations.begin();
diff --git a/src/playerrelations.h b/src/playerrelations.h
index 143a82477..91f5c2e9e 100644
--- a/src/playerrelations.h
+++ b/src/playerrelations.h
@@ -23,10 +23,10 @@
#ifndef PLAYER_RELATIONS_H
#define PLAYER_RELATIONS_H
+#include "utils/stringvector.h"
+
#include <list>
#include <map>
-#include <string>
-#include <vector>
class Being;
@@ -200,10 +200,9 @@ class PlayerRelationsManager
* Retrieves a sorted vector of all players for which we have any
* relations recorded.
*/
- std::vector<std::string> *getPlayers();
+ StringVect *getPlayers();
- std::vector<std::string> *getPlayersByRelation(PlayerRelation::Relation
- rel);
+ StringVect *getPlayersByRelation(PlayerRelation::Relation rel);
/**
* Removes all recorded player info.
diff --git a/src/resources/beinginfo.cpp b/src/resources/beinginfo.cpp
index 0fa815181..9c8799bc0 100644
--- a/src/resources/beinginfo.cpp
+++ b/src/resources/beinginfo.cpp
@@ -86,7 +86,7 @@ void BeingInfo::setTargetCursorSize(const std::string &size)
void BeingInfo::addSound(SoundEvent event, const std::string &filename)
{
if (mSounds.find(event) == mSounds.end())
- mSounds[event] = new std::vector<std::string>;
+ mSounds[event] = new StringVect;
if (mSounds[event])
mSounds[event]->push_back("sfx/" + filename);
diff --git a/src/resources/beinginfo.h b/src/resources/beinginfo.h
index 0f62ba5ea..bd2043fba 100644
--- a/src/resources/beinginfo.h
+++ b/src/resources/beinginfo.h
@@ -29,8 +29,6 @@
#include <list>
#include <map>
-#include <string>
-#include <vector>
struct Attack
{
@@ -60,7 +58,7 @@ enum SoundEvent
SOUND_EVENT_SPAWN
};
-typedef std::map<SoundEvent, std::vector<std::string>* > SoundEvents;
+typedef std::map<SoundEvent, StringVect*> SoundEvents;
/**
* Holds information about a certain type of monster. This includes the name
diff --git a/src/resources/emotedb.h b/src/resources/emotedb.h
index f27b45220..24ceb40db 100644
--- a/src/resources/emotedb.h
+++ b/src/resources/emotedb.h
@@ -22,10 +22,10 @@
#ifndef EMOTE_DB_H
#define EMOTE_DB_H
+#include "utils/stringvector.h"
+
#include <list>
#include <map>
-#include <string>
-#include <vector>
class AnimatedSprite;
@@ -38,7 +38,7 @@ struct EmoteSprite
struct EmoteInfo
{
std::list<EmoteSprite*> sprites;
- std::vector<std::string> particles;
+ StringVect particles;
};
typedef std::map<int, EmoteInfo*> EmoteInfos;
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp
index eb6d4a6b8..894ce7984 100644
--- a/src/resources/itemdb.cpp
+++ b/src/resources/itemdb.cpp
@@ -42,7 +42,7 @@ namespace
ItemDB::NamedItemInfos mNamedItemInfos;
ItemInfo *mUnknown;
bool mLoaded = false;
- std::vector<std::string> mTagNames;
+ StringVect mTagNames;
std::map<std::string, int> mTags;
}
@@ -405,7 +405,7 @@ void ItemDB::load()
mLoaded = true;
}
-const std::vector<std::string> &ItemDB::getTags()
+const StringVect &ItemDB::getTags()
{
return mTagNames;
}
diff --git a/src/resources/itemdb.h b/src/resources/itemdb.h
index e56840c16..6fa05ac29 100644
--- a/src/resources/itemdb.h
+++ b/src/resources/itemdb.h
@@ -23,10 +23,10 @@
#ifndef ITEM_MANAGER_H
#define ITEM_MANAGER_H
+#include "utils/stringvector.h"
+
#include <list>
-#include <vector>
#include <map>
-#include <string>
class ItemInfo;
@@ -45,7 +45,7 @@ namespace ItemDB
*/
void unload();
- const std::vector<std::string> &getTags();
+ const StringVect &getTags();
bool exists(int id);
diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp
index 2bf71bcec..57ccfb2e2 100644
--- a/src/resources/iteminfo.cpp
+++ b/src/resources/iteminfo.cpp
@@ -142,8 +142,7 @@ void ItemInfo::addSound(EquipmentSoundEvent event, const std::string &filename)
const std::string &ItemInfo::getSound(EquipmentSoundEvent event) const
{
static const std::string empty;
- std::map< EquipmentSoundEvent,
- std::vector<std::string> >::const_iterator i;
+ std::map<EquipmentSoundEvent, StringVect>::const_iterator i;
i = mSounds.find(event);
diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h
index cd406003d..56a442832 100644
--- a/src/resources/iteminfo.h
+++ b/src/resources/iteminfo.h
@@ -29,8 +29,6 @@
#include "resources/spritedef.h"
#include <map>
-#include <string>
-#include <vector>
#include <set>
enum EquipmentSoundEvent
@@ -292,7 +290,7 @@ class ItemInfo
std::map <int, std::string> mAnimationFiles;
/** Stores the names of sounds to be played at certain event. */
- std::map < EquipmentSoundEvent, std::vector<std::string> > mSounds;
+ std::map <EquipmentSoundEvent, StringVect> mSounds;
std::map <int, int> mTags;
std::map <int, ColorDB::ItemColor> *mColors;
std::string mColorList;
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index ec8764a44..03f0e9770 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -632,7 +632,7 @@ bool ResourceManager::copyFile(const std::string &src, const std::string &dst)
}
bool ResourceManager::loadTextFile(const std::string &fileName,
- std::vector<std::string> &lines)
+ StringVect &lines)
{
int contentsLength;
char *fileContents = static_cast<char*>(
@@ -654,12 +654,12 @@ bool ResourceManager::loadTextFile(const std::string &fileName,
return true;
}
-std::vector<std::string> ResourceManager::loadTextFileLocal(
+StringVect ResourceManager::loadTextFileLocal(
const std::string &fileName)
{
std::ifstream file;
char line[501];
- std::vector<std::string> lines;
+ StringVect lines;
file.open(fileName.c_str(), std::ios::in);
diff --git a/src/resources/resourcemanager.h b/src/resources/resourcemanager.h
index 9df96d354..a941eaf3c 100644
--- a/src/resources/resourcemanager.h
+++ b/src/resources/resourcemanager.h
@@ -25,10 +25,10 @@
#include "main.h"
+#include "utils/stringvector.h"
+
#include <ctime>
#include <map>
-#include <string>
-#include <vector>
#include <set>
class Image;
@@ -219,14 +219,12 @@ class ResourceManager
/**
* Retrieves the contents of a text file (PhysFS).
*/
- bool loadTextFile(const std::string &fileName,
- std::vector<std::string> &lines);
+ bool loadTextFile(const std::string &fileName, StringVect &lines);
/**
* Retrieves the contents of a text file.
*/
- std::vector<std::string> loadTextFileLocal(const std::string
- &fileName);
+ StringVect loadTextFileLocal(const std::string &fileName);
void saveTextFile(std::string path, std::string name,
std::string text);
diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp
index 95e05de93..8daee7e9b 100644
--- a/src/resources/spritedef.cpp
+++ b/src/resources/spritedef.cpp
@@ -324,10 +324,10 @@ void SpriteDef::loadAnimation(XmlNodePtr animationNode,
}
else
{
- std::vector<std::string> vals;
+ StringVect vals;
splitToStringVector(vals, value, ',');
- std::vector<std::string>::const_iterator it = vals.begin();
- std::vector<std::string>::const_iterator it_end = vals.end();
+ StringVectCIter it = vals.begin();
+ StringVectCIter it_end = vals.end();
for (; it != it_end; ++ it)
{
std::string str = *it;
diff --git a/src/resources/spritedef.h b/src/resources/spritedef.h
index 35b066296..e59e4bd1f 100644
--- a/src/resources/spritedef.h
+++ b/src/resources/spritedef.h
@@ -25,13 +25,12 @@
#include "resources/resource.h"
+#include "utils/stringvector.h"
#include "utils/xml.h"
#include <list>
#include <map>
#include <set>
-#include <string>
-#include <vector>
class Action;
class Animation;
@@ -60,7 +59,7 @@ struct SpriteDisplay
std::string image;
std::string floor;
std::vector<SpriteReference*> sprites;
- std::vector<std::string> particles;
+ StringVect particles;
};
typedef std::vector<SpriteReference*>::const_iterator SpriteRefs;
diff --git a/src/resources/wallpaper.cpp b/src/resources/wallpaper.cpp
index 7ebc5a11a..d4537e963 100644
--- a/src/resources/wallpaper.cpp
+++ b/src/resources/wallpaper.cpp
@@ -33,7 +33,6 @@
#include <algorithm>
#include <cstring>
#include <time.h>
-#include <vector>
#include "debug.h"
@@ -141,7 +140,7 @@ std::string Wallpaper::getWallpaper(int width, int height)
WallpaperData wp;
// Wallpaper filename container
- std::vector<std::string> wallPaperVector;
+ StringVect wallPaperVector;
for (iter = wallpaperData.begin(); iter != wallpaperData.end(); ++iter)
{
diff --git a/src/spellmanager.h b/src/spellmanager.h
index ae928ee7a..90f4d23c7 100644
--- a/src/spellmanager.h
+++ b/src/spellmanager.h
@@ -37,6 +37,7 @@ class SpellManager
{
public:
SpellManager();
+
~SpellManager();
TextCommand *getSpell(int spellId);
diff --git a/src/utils/langs.cpp b/src/utils/langs.cpp
index c1f9f7ecf..1aa3e472d 100644
--- a/src/utils/langs.cpp
+++ b/src/utils/langs.cpp
@@ -30,9 +30,9 @@
#include "debug.h"
-std::vector<std::string> getLang()
+LangVect getLang()
{
- std::vector<std::string> langs;
+ LangVect langs;
std::string lang = config.getValue("lang", "").c_str();
if (lang.empty())
diff --git a/src/utils/langs.h b/src/utils/langs.h
index 67c13d8ee..5cde62927 100644
--- a/src/utils/langs.h
+++ b/src/utils/langs.h
@@ -30,7 +30,7 @@
typedef std::vector<std::string> LangVect;
typedef LangVect::const_iterator LangIter;
-std::vector<std::string> getLang();
+LangVect getLang();
std::string getLangSimple();
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index 5a7ea87fd..b1e464005 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -203,12 +203,11 @@ unsigned long findI(std::string str, std::string subStr)
return str.find(subStr);
}
-unsigned long findI(std::string text, std::vector<std::string> &list)
+unsigned long findI(std::string text, StringVect &list)
{
std::string str = toLower(text);
unsigned long idx;
- for (std::vector<std::string>::const_iterator i = list.begin();
- i != list.end(); ++i)
+ for (StringVectCIter i = list.begin(); i != list.end(); ++ i)
{
std::string subStr = *i;
subStr = toLower(subStr);
@@ -447,8 +446,8 @@ std::list<std::string> splitToStringList(const std::string &text,
return tokens;
}
-void splitToStringVector(std::vector<std::string> &tokens,
- const std::string &text, char separator)
+void splitToStringVector(StringVect &tokens, const std::string &text,
+ char separator)
{
std::stringstream ss(text);
std::string item;
diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h
index 31ee6d51f..9fdc0d2f6 100644
--- a/src/utils/stringutils.h
+++ b/src/utils/stringutils.h
@@ -23,11 +23,11 @@
#ifndef UTILS_STRINGUTILS_H
#define UTILS_STRINGUTILS_H
-#include <string>
+#include "utils/stringvector.h"
+
#include <sstream>
#include <list>
#include <set>
-#include <vector>
/**
* Trims spaces off the end and the beginning of the given string.
@@ -136,7 +136,7 @@ bool isWordSeparator(char chr);
unsigned long findI(std::string str, std::string subStr);
-unsigned long findI(std::string text, std::vector<std::string> &list);
+unsigned long findI(std::string text, StringVect &list);
const std::string encodeStr(unsigned int value, unsigned int size = 0);
@@ -179,7 +179,7 @@ std::list<int> splitToIntList(const std::string &text, char separator);
std::list<std::string> splitToStringList(const std::string &text,
char separator);
-void splitToStringVector(std::vector<std::string> &tokens,
+void splitToStringVector(StringVect &tokens,
const std::string &text, char separator);
std::string combineDye(std::string file, std::string dye);
diff --git a/src/utils/stringvector.h b/src/utils/stringvector.h
new file mode 100644
index 000000000..c254bd5de
--- /dev/null
+++ b/src/utils/stringvector.h
@@ -0,0 +1,31 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2012 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef UTILS_VECTORSTRING_H
+#define UTILS_VECTORSTRING_H
+
+#include <string>
+#include <vector>
+
+typedef std::vector<std::string> StringVect;
+typedef StringVect::iterator StringVectIter;
+typedef StringVect::const_iterator StringVectCIter;
+
+#endif
diff --git a/src/utils/translation/translationmanager.cpp b/src/utils/translation/translationmanager.cpp
index 03dd6d100..2a962913a 100644
--- a/src/utils/translation/translationmanager.cpp
+++ b/src/utils/translation/translationmanager.cpp
@@ -88,7 +88,7 @@ PoDict *TranslationManager::loadLang(LangVect lang,
bool TranslationManager::translateFile(const std::string &fileName,
PoDict *dict,
- std::vector<std::string> &lines)
+ StringVect &lines)
{
if (!dict || fileName.empty())
return false;
diff --git a/src/utils/translation/translationmanager.h b/src/utils/translation/translationmanager.h
index 842c5620b..debb555ea 100644
--- a/src/utils/translation/translationmanager.h
+++ b/src/utils/translation/translationmanager.h
@@ -23,15 +23,14 @@
#include "localconsts.h"
-#include <string>
-#include <vector>
+#include "utils/stringvector.h"
class PoDict;
class TranslationManager
{
public:
- static PoDict *loadLang(std::vector<std::string> lang,
+ static PoDict *loadLang(StringVect lang,
std::string subName,
PoDict *dict = nullptr);
@@ -43,7 +42,7 @@ class TranslationManager
static bool translateFile(const std::string &fileName,
PoDict *dict,
- std::vector<std::string> &lines);
+ StringVect &lines);
};
#endif // UTILS_TRANSLATION_MANAGER_H