summaryrefslogtreecommitdiff
path: root/src/resources
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/resources
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/resources')
-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
12 files changed, 25 insertions, 34 deletions
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)
{