From 3bf4e26b1319295532bb4396cbd6406d85cbcae0 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 29 Mar 2012 03:51:37 +0300 Subject: Replace vectors with strings to short names. --- src/resources/beinginfo.cpp | 2 +- src/resources/beinginfo.h | 4 +--- src/resources/emotedb.h | 6 +++--- src/resources/itemdb.cpp | 4 ++-- src/resources/itemdb.h | 6 +++--- src/resources/iteminfo.cpp | 3 +-- src/resources/iteminfo.h | 4 +--- src/resources/resourcemanager.cpp | 6 +++--- src/resources/resourcemanager.h | 10 ++++------ src/resources/spritedef.cpp | 6 +++--- src/resources/spritedef.h | 5 ++--- src/resources/wallpaper.cpp | 3 +-- 12 files changed, 25 insertions(+), 34 deletions(-) (limited to 'src/resources') 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; + 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 #include -#include -#include struct Attack { @@ -60,7 +58,7 @@ enum SoundEvent SOUND_EVENT_SPAWN }; -typedef std::map* > SoundEvents; +typedef std::map 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 #include -#include -#include class AnimatedSprite; @@ -38,7 +38,7 @@ struct EmoteSprite struct EmoteInfo { std::list sprites; - std::vector particles; + StringVect particles; }; typedef std::map 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 mTagNames; + StringVect mTagNames; std::map mTags; } @@ -405,7 +405,7 @@ void ItemDB::load() mLoaded = true; } -const std::vector &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 -#include #include -#include class ItemInfo; @@ -45,7 +45,7 @@ namespace ItemDB */ void unload(); - const std::vector &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 >::const_iterator i; + std::map::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 -#include -#include #include enum EquipmentSoundEvent @@ -292,7 +290,7 @@ class ItemInfo std::map mAnimationFiles; /** Stores the names of sounds to be played at certain event. */ - std::map < EquipmentSoundEvent, std::vector > mSounds; + std::map mSounds; std::map mTags; std::map *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 &lines) + StringVect &lines) { int contentsLength; char *fileContents = static_cast( @@ -654,12 +654,12 @@ bool ResourceManager::loadTextFile(const std::string &fileName, return true; } -std::vector ResourceManager::loadTextFileLocal( +StringVect ResourceManager::loadTextFileLocal( const std::string &fileName) { std::ifstream file; char line[501]; - std::vector 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 #include -#include -#include #include class Image; @@ -219,14 +219,12 @@ class ResourceManager /** * Retrieves the contents of a text file (PhysFS). */ - bool loadTextFile(const std::string &fileName, - std::vector &lines); + bool loadTextFile(const std::string &fileName, StringVect &lines); /** * Retrieves the contents of a text file. */ - std::vector 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 vals; + StringVect vals; splitToStringVector(vals, value, ','); - std::vector::const_iterator it = vals.begin(); - std::vector::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 #include #include -#include -#include class Action; class Animation; @@ -60,7 +59,7 @@ struct SpriteDisplay std::string image; std::string floor; std::vector sprites; - std::vector particles; + StringVect particles; }; typedef std::vector::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 #include #include -#include #include "debug.h" @@ -141,7 +140,7 @@ std::string Wallpaper::getWallpaper(int width, int height) WallpaperData wp; // Wallpaper filename container - std::vector wallPaperVector; + StringVect wallPaperVector; for (iter = wallpaperData.begin(); iter != wallpaperData.end(); ++iter) { -- cgit v1.2.3-70-g09d2