Plugins are modules and use dungeon-master module
authorJavier Sancho <jsf@jsancho.org>
Tue, 2 Apr 2019 18:01:48 +0000 (20:01 +0200)
committerJavier Sancho <jsf@jsancho.org>
Tue, 2 Apr 2019 18:01:48 +0000 (20:01 +0200)
README [new file with mode: 0644]
src/main.cpp
src/plugins/default/main.scm

diff --git a/README b/README
new file mode 100644 (file)
index 0000000..a113567
--- /dev/null
+++ b/README
@@ -0,0 +1 @@
+City map generator from https://github.com/watabou/TownGeneratorOS/blob/master/Source/com/watabou/towngenerator/building/Model.hx
index bb5a5f96f707dd19e8cccc676bb69603210382fe..3b1787ebd14ce10c950f6e537df70d7d5a1b7c6d 100644 (file)
@@ -5,16 +5,28 @@ using namespace irr;
 using namespace core;
 using namespace video;
 
-SCM register_generator(SCM name, SCM proc) {
+SCM register_generator(SCM name, SCM proc)
+{
   printf ("Register: %s\n", scm_to_locale_string(name));
-  scm_call_0(proc);
+  scm_call_1(proc, scm_from_int(-1));
   return SCM_UNSPECIFIED;
 }
 
+void init_dungeon_master_module(void *unused)
+{
+  scm_c_define_gsubr("register-generator", 2, 0, 0, (scm_t_subr)register_generator);
+  scm_c_export("register-generator", NULL);
+}
+
+void scm_init_dungeon_master_module()
+{
+  scm_c_define_module("dungeon-master", init_dungeon_master_module, NULL);
+}
+
 int main()
 {
   scm_init_guile();
-  scm_c_define_gsubr("register-generator", 2, 0, 0, (scm_t_subr)register_generator);
+  scm_init_dungeon_master_module();
   scm_primitive_load(scm_from_locale_string("plugins/default/main.scm"));
 
   IrrlichtDevice* device =
index b95e41cfed616e8c252795cbcfc896ad51f48c55..866628b8146affe027db2864a2bde4c1f0017692 100644 (file)
@@ -1,5 +1,13 @@
-(define (hello-world)
-  (display "Hello World!")
-  (newline))
+(define-module (dungeon-master plugins default)
+  #:use-module ((dungeon-master) #:prefix dm:))
 
-(register-generator "hello-world" hello-world)
+(define (random-bool)
+  (= (random 2) 1))
+
+(define (city-map-generator patches)
+  "City generator from https://github.com/watabou/TownGeneratorOS/blob/master/Source/com/watabou/towngenerator/building/Model.hx"
+  (when (= patches -1) (set! patches 15))
+  (display "lalala")(newline))
+  ;(build))
+
+(dm:register-generator "city-map-generator" city-map-generator)