]> jfr.im git - irc/gameservirc.git/blobdiff - gameserv/c_forest.cpp
Implemented the myString class in the player and monster classes. This should make...
[irc/gameservirc.git] / gameserv / c_forest.cpp
index e737607c060d78882994c9b749adfd7d04f4b759..b72586d090ea1a3ca6a5e21f11503a0b3c63c8e2 100644 (file)
@@ -73,7 +73,7 @@ void do_forest(char *u)
            if (eventnum >= 12)
            {
                p->fight = new Monster(levels[p->level - 1].randomMonster());
-               notice(s_GameServ, u, "You have found \ 2%s\ 2!", p->fight->name);
+               notice(s_GameServ, u, "You have found \ 2%s\ 2!", p->fight->name.getString());
                if (p->fight->hp < p->fight->maxhp)
                    p->fight->hp = p->fight->maxhp;
 
@@ -179,22 +179,9 @@ Monster *getNewMonster(Monster *m)
     Monster *newguy;
     newguy = new Monster;
 
-    if (m->name)
-    {
-       newguy->name = new char[strlen(m->name)];
-       strcpy(newguy->name, m->name);
-    }
-    if (m->weapon)
-    {
-       newguy->weapon = new char[strlen(m->weapon)];
-       strcpy(newguy->weapon, m->weapon);
-    }
-    if (m->death)
-    {
-       newguy->death = new char[strlen(m->death)];
-       strcpy(newguy->death, m->death);
-    }
-
+    newguy->name = m->name;
+    newguy->weapon = m->weapon;
+    newguy->death = m->death;
     newguy->strength = m->strength;
     newguy->gold = m->gold;
     newguy->exp = m->exp;