diff libmlk-adventure/adventure/state/map.c @ 260:60a214ec1ab4

adventure: change the way states are stored
author David Demelier <markand@malikania.fr>
date Sun, 06 Dec 2020 22:50:48 +0100
parents 16be1ad3ddba
children bfde372bf152
line wrap: on
line diff
--- a/libmlk-adventure/adventure/state/map.c	Sun Dec 06 11:22:03 2020 +0100
+++ b/libmlk-adventure/adventure/state/map.c	Sun Dec 06 22:50:48 2020 +0100
@@ -31,6 +31,7 @@
 #include <rpg/map.h>
 #include <rpg/map-file.h>
 
+#include <adventure/actions/spawner.h>
 #include <adventure/actions/teleport.h>
 
 #include "molko.h"
@@ -46,6 +47,18 @@
 };
 
 static void
+load_spawner(struct map *map, int x, int y, int w, int h, const char *value)
+{
+	(void)x;
+	(void)y;
+	(void)w;
+	(void)h;
+	(void)value;
+
+	action_stack_add(&map->astack_par, spawner_new(map, 100, 300));
+}
+
+static void
 load_teleport(struct map *map, int x, int y, int w, int h, const char *value)
 {
 	char name[128] = {0};
@@ -62,7 +75,8 @@
 		const char *name;
 		void (*load)(struct map *, int, int, int, int, const char *);
 	} table[] = {
-		{ "teleport|", load_teleport }
+		{ "teleport|",  load_teleport },
+		{ "spawner|",   load_spawner }
 	};
 
 	for (size_t i = 0; i < NELEM(table); ++i) {