]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
exit fixes, faster dialog
authorClyne Sullivan <tullivan99@gmail.com>
Thu, 3 Dec 2015 12:26:22 +0000 (07:26 -0500)
committerClyne Sullivan <tullivan99@gmail.com>
Thu, 3 Dec 2015 12:26:22 +0000 (07:26 -0500)
src/entities.cpp
src/ui.cpp
src/world.cpp

index 9c5e3cb3b859cc4e9c5408aa69bedc537b37678f..f0e7d169b0cd8287359373f0bf04baf7bf975a32 100644 (file)
@@ -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;
 }
index e10ed466ca16e63c0012a98c898432536fc2d9e7..f01dab8ecdd504bd0e836443027148766eb66329 100644 (file)
@@ -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<size)linc++;
+                       if(linc<size)
+                               linc++;
+                       else typeOutDone = true;
                }
                
                return ret;             //      The buffered string.
@@ -533,6 +539,12 @@ namespace ui {
                                break;
                        case SDL_MOUSEBUTTONDOWN:
                                if((e.button.button&SDL_BUTTON_RIGHT)&&dialogBoxExists){
+                               
+                                       if(!typeOutDone){
+                                               typeOutDone = true;
+                                               break;
+                                       }
+                               
                                        for(i=0;i<dialogOptCount;i++){
                                                if(mouse.x > dialogOptLoc[i][0] &&
                                                   mouse.x < dialogOptLoc[i][2] &&
index d81d8de696ca39cf1a570675763ce48f2e011027..3557121c4d32140266956c02abad8b291de64cf2 100644 (file)
@@ -95,11 +95,9 @@ void World::deleteEntities(void){
 }
 
 World::~World(void){
-       
-       if(behind){
+       if(behind)
                delete behind;
-       }
-
+       
        delete bgTex;
        delete[] star;
        delete[] line;