diff --git a/src/entities/evilBlobs/pistolBlob.c b/src/entities/evilBlobs/pistolBlob.c index 8d7a7cd..dbb35a4 100644 --- a/src/entities/evilBlobs/pistolBlob.c +++ b/src/entities/evilBlobs/pistolBlob.c @@ -21,8 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "pistolBlob.h" static int canFire(Entity *target); -static void (*superSave)(cJSON *root); -static void save(cJSON *root); Entity *initPistolBlob(void) { @@ -32,6 +30,8 @@ Entity *initPistolBlob(void) initEvilBlob(u); + u->unitType = "PistolBlob"; + u->sprite[FACING_LEFT] = getSprite("PistolBlobLeft"); u->sprite[FACING_RIGHT] = getSprite("PistolBlobRight"); u->sprite[FACING_DIE] = getSprite("PistolBlobSpin"); @@ -39,11 +39,8 @@ Entity *initPistolBlob(void) u->weaponType = WPN_AIMED_PISTOL; u->maxShotsToFire = 3; - - superSave = u->save; u->canFire = canFire; - u->save = save; return (Entity*)u; } @@ -52,10 +49,3 @@ static int canFire(Entity *target) { return 1; } - -static void save(cJSON *root) -{ - superSave(root); - - cJSON_AddStringToObject(root, "type", "PistolBlob"); -} diff --git a/src/entities/eyeDroids/pistolDroid.c b/src/entities/eyeDroids/pistolDroid.c index 1b5332a..4a1cb4b 100644 --- a/src/entities/eyeDroids/pistolDroid.c +++ b/src/entities/eyeDroids/pistolDroid.c @@ -30,6 +30,8 @@ Entity *initPistolDroid(void) initEyeDroid(u); + u->unitType = "PistolEyeDroid"; + u->sprite[FACING_LEFT] = getSprite("PistolDroidLeft"); u->sprite[FACING_RIGHT] = getSprite("PistolDroidRight"); u->sprite[FACING_DIE] = getSprite("PistolDroidDie"); diff --git a/src/entities/structures/horizontalDoor.h b/src/entities/structures/horizontalDoor.h index c7f62e6..a1bba85 100644 --- a/src/entities/structures/horizontalDoor.h +++ b/src/entities/structures/horizontalDoor.h @@ -21,5 +21,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "../../common.h" extern Sprite *getSprite(char *name); -extern Structure *createStructure(void); extern Entity *initDoor(void); diff --git a/src/entities/unit.c b/src/entities/unit.c index cf2b706..0bce343 100644 --- a/src/entities/unit.c +++ b/src/entities/unit.c @@ -244,7 +244,7 @@ static void save(cJSON *root) u = (Unit*)self; - cJSON_AddStringToObject(root, "type", "Unit"); + cJSON_AddStringToObject(root, "type", u->unitType); cJSON_AddNumberToObject(root, "canCarryItem", u->canCarryItem); cJSON_AddNumberToObject(root, "startX", u->startX); cJSON_AddNumberToObject(root, "startY", u->startY); diff --git a/src/structs.h b/src/structs.h index a153b8f..78f168d 100644 --- a/src/structs.h +++ b/src/structs.h @@ -161,6 +161,7 @@ struct EntityExt { struct Unit { struct EntityExt; + char *unitType; int weaponType; int canCarryItem; int reload;