diff options
Diffstat (limited to 'src/entities.cpp')
-rw-r--r-- | src/entities.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/entities.cpp b/src/entities.cpp index 1c364a4..4291b0a 100644 --- a/src/entities.cpp +++ b/src/entities.cpp @@ -179,10 +179,9 @@ Structures::Structures(){ //sets the structure type } Structures::~Structures(){ delete tex; + if(name) delete[] name; - if(inside) - delete[] inside; } Mob::Mob(int sub){ @@ -505,16 +504,20 @@ unsigned int Structures::spawn(BUILD_SUB sub, float x, float y){ */ //unsigned int tempN = (getRand() % 5 + 2); + + if ( textureLoc.empty() ) + textureLoc = inWorld->sTexLoc[sub]; + switch(sub){ case STALL_MARKET: - tex = new Texturec(1, textureLoc ? textureLoc : inWorld->sTexLoc[sub].c_str()); - dim = Texture::imageDim(textureLoc ? textureLoc : inWorld->sTexLoc[sub].c_str()); + tex = new Texturec({ textureLoc }); + dim = Texture::imageDim( textureLoc ); width = dim.x; height = dim.y; break; default: - tex = new Texturec(1, textureLoc ? textureLoc : inWorld->sTexLoc[sub].c_str()); - dim = Texture::imageDim(textureLoc ? textureLoc : inWorld->sTexLoc[sub].c_str()); + tex = new Texturec({ textureLoc }); + dim = Texture::imageDim( textureLoc ); width = dim.x; height = dim.y; inv = NULL; |