diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2016-03-03 09:26:06 -0500 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2016-03-03 09:26:06 -0500 |
commit | 90f3d2ff9fe7297dae0bdcee9c441e53177a0fb7 (patch) | |
tree | 3f89437e059b33dc2c78766e17c21e62fb1489e6 /include | |
parent | e879b257b9512816f2ff579a7444fe600a74ed91 (diff) |
efficiency stuffs
Diffstat (limited to 'include')
-rw-r--r-- | include/Texture.h | 3 | ||||
-rw-r--r-- | include/entities.h | 4 | ||||
-rwxr-xr-x | include/tinyxml2.h | 7 | ||||
-rw-r--r-- | include/world.h | 11 |
4 files changed, 15 insertions, 10 deletions
diff --git a/include/Texture.h b/include/Texture.h index 659c32d..7201a4c 100644 --- a/include/Texture.h +++ b/include/Texture.h @@ -58,7 +58,7 @@ public: * Contains an array of the GLuints returned from Texture::loadTexture(). */ - GLuint *image = NULL; + std::vector<GLuint> image; /** * Populates the image array from a list of strings, with each string as a @@ -73,6 +73,7 @@ public: Texturec(uint amt,const char **paths); Texturec(std::vector<std::string>vec); + Texturec( std::initializer_list<std::string> l ); /** * Frees memory taken by the image array. diff --git a/include/entities.h b/include/entities.h index 545f0a4..3b8a19b 100644 --- a/include/entities.h +++ b/include/entities.h @@ -228,8 +228,8 @@ class Structures : public Entity{ public: BUILD_SUB bsubtype; World *inWorld; - char *inside; - char *textureLoc; + std::string inside; + std::string textureLoc; Structures(); ~Structures(); diff --git a/include/tinyxml2.h b/include/tinyxml2.h index fb7464a..4282642 100755 --- a/include/tinyxml2.h +++ b/include/tinyxml2.h @@ -38,6 +38,8 @@ distribution. # include <cstring>
#endif
+#include <string>
+
/*
TODO: intern strings instead of allocation.
*/
@@ -1187,6 +1189,11 @@ public: */
const char* Attribute( const char* name, const char* value=0 ) const;
+ /** Functions the same as Attribute(), but returns the result
+ as a std::string.
+ */
+ std::string StrAttribute( const char* name, const char* value=0 ) const;
+
/** Given an attribute name, IntAttribute() returns the value
of the attribute interpreted as an integer. 0 will be
returned if there is an error. For a method with error
diff --git a/include/world.h b/include/world.h index b3d1071..7b9383a 100644 --- a/include/world.h +++ b/include/world.h @@ -279,7 +279,7 @@ public: * A vector of all particles in this world. */ - std::vector<Particles *> particles; + std::vector<Particles> particles; std::vector<Village *> village; @@ -294,7 +294,7 @@ public: * Vector of all building textures for the current world style */ - std::vector<std::string > sTexLoc; + std::vector<std::string> sTexLoc; /** * NULLifies pointers and allocates necessary memory. This should be @@ -317,8 +317,7 @@ public: * the structure. */ - void addStructure(BUILD_SUB subtype,float x,float y, char* tex, const char *inside); - //void addVillage(int buildingCount, int npcMin, int npcMax,const char *inside); + void addStructure(BUILD_SUB subtype,float x,float y, std::string tex, std::string inside); /** * Adds a Mob to the world with the specified type and coordinates. @@ -346,7 +345,7 @@ public: * upon object interaction. */ - void addObject(/*ITEM_ID id*/std::string in,const char *pickupDialog, float x, float y); + void addObject(std::string in, const char *pickupDialog, float x, float y); /** * Adds a particle to the world with the specified coordinates, dimensions, @@ -479,8 +478,6 @@ public: class Arena : public World { private: - //vec2 pxy; - //World *exit; Mob *mmob; public: Arena(World *leave,Player *p,Mob *m); |