From 6b44ecd9da08087f4a44dd3daef211e763eb1c61 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Thu, 3 Dec 2015 07:26:22 -0500 Subject: exit fixes, faster dialog --- src/entities.cpp | 8 +++++--- src/ui.cpp | 16 ++++++++++++++-- src/world.cpp | 6 ++---- 3 files changed, 21 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/entities.cpp b/src/entities.cpp index 9c5e3cb..f0e7d16 100644 --- a/src/entities.cpp +++ b/src/entities.cpp @@ -120,11 +120,13 @@ Structures::Structures(){ //sets the structure type tex = new Texturec(1,"assets/house1.png"); inWorld = NULL; + name = NULL; } Structures::~Structures(){ - delete inv; + //delete inv; delete tex; - delete[] name; + if(name) + delete[] name; } Mob::Mob(int sub){ @@ -177,7 +179,7 @@ Object::Object(ITEM_ID id, bool qo, const char *pd){ Object::~Object(){ delete[] pickupDialog; - delete inv; + //delete inv; delete tex; delete[] name; } diff --git a/src/ui.cpp b/src/ui.cpp index e10ed46..f01dab8 100644 --- a/src/ui.cpp +++ b/src/ui.cpp @@ -48,6 +48,7 @@ static char *dialogBoxText = NULL; static char *dialogOptText[4]; static float dialogOptLoc[4][3]; static unsigned char dialogOptCount = 0; +static bool typeOutDone = true; extern void mainLoop(void); @@ -318,18 +319,23 @@ namespace ui { size=strlen(str); // Set the new target string size linc=0; // Reset the incrementers sinc=1; + typeOutDone = false; } /* * Draw the next letter if necessary. */ - if(++sinc==2){ + if(typeOutDone) + return str; + else if(++sinc==2){ sinc=0; strncpy(ret+linc,str+linc,1); // Get next character - if(linc dialogOptLoc[i][0] && mouse.x < dialogOptLoc[i][2] && diff --git a/src/world.cpp b/src/world.cpp index d81d8de..3557121 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -95,11 +95,9 @@ void World::deleteEntities(void){ } World::~World(void){ - - if(behind){ + if(behind) delete behind; - } - + delete bgTex; delete[] star; delete[] line; -- cgit v1.2.3