]> git.mxchange.org Git - quix0rs-blobwars.git/blobdiff - src/mias.cpp
Cleanup .desktop file
[quix0rs-blobwars.git] / src / mias.cpp
index e8df50d56c758b5fd39486c81e789ce92c07d2bb..4a98dee1b4dfe041c37730364086880ebc485b83 100644 (file)
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 2004 Parallel Realities
+Copyright (C) 2004-2010 Parallel Realities
 
 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
@@ -22,20 +22,20 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 void initMIAPhrases()
 {
-       strncpy(mia_scared[0], "help me...", sizeof mia_scared[0]);
-       strncpy(mia_scared[1], "i don't wanna die...", sizeof mia_scared[1]);
-       strncpy(mia_scared[2], "please... someone help...", sizeof mia_scared[2]);
-       strncpy(mia_scared[3], "i... i'm scared...", sizeof mia_scared[3]);
-       strncpy(mia_scared[4], "i wanna go home...", sizeof mia_scared[4]);
-       strncpy(mia_scared[5], "what was that?!", sizeof mia_scared[5]);
-       strncpy(mia_scared[6], "i don't like it here...", sizeof mia_scared[6]);
+       strlcpy(mia_scared[0], "help me...", sizeof mia_scared[0]);
+       strlcpy(mia_scared[1], "i don't wanna die...", sizeof mia_scared[1]);
+       strlcpy(mia_scared[2], "please... someone help...", sizeof mia_scared[2]);
+       strlcpy(mia_scared[3], "i... i'm scared...", sizeof mia_scared[3]);
+       strlcpy(mia_scared[4], "i wanna go home...", sizeof mia_scared[4]);
+       strlcpy(mia_scared[5], "what was that?!", sizeof mia_scared[5]);
+       strlcpy(mia_scared[6], "i don't like it here...", sizeof mia_scared[6]);
 }
 
 void addMIA(const char *name, int x, int y, int type)
 {
        Entity *mia = new Entity();
 
-       strncpy(mia->name, name, sizeof mia->name);
+       strlcpy(mia->name, name, sizeof mia->name);
        mia->id = type;
        mia->baseThink = 60;
        mia->health = 180;
@@ -62,7 +62,7 @@ void doMIAs()
 
        int x, y;
 
-       char message[100];
+       char message[256];
 
        while (mia->next != NULL)
        {
@@ -99,8 +99,9 @@ void doMIAs()
 
                                if ((mia->value != 100) && (!(mia->flags & ENT_DYING)))
                                {
+                                       static Graphics::SurfaceCache cache;
                                        graphics.setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
-                                       graphics.drawString(_((char*)mia_scared[mia->value]), x + 10, y - 10, true, graphics.screen);
+                                       graphics.drawString(_((char*)mia_scared[mia->value]), x + 10, y - 10, true, graphics.screen, cache);
                                }
 
                                graphics.blit(mia->getFaceImage(), x, y, graphics.screen, false);