Pfade in Mock so angepasst, dass sie mit dem Hauptcode zusammenpassen.
authorWintermute <wintermute@hannover.ccc.de>
Sun, 13 Oct 2013 18:25:32 +0000 (20:25 +0200)
committerWintermute <wintermute@hannover.ccc.de>
Sun, 13 Oct 2013 18:25:32 +0000 (20:25 +0200)
badge/jumpnrun/levels.txt [new file with mode: 0644]
badge/jumpnrun/smb.lv
mock/badge_main_loop.c
mock/tools/level-converter.cc

diff --git a/badge/jumpnrun/levels.txt b/badge/jumpnrun/levels.txt
new file mode 100644 (file)
index 0000000..f1f803c
--- /dev/null
@@ -0,0 +1,2 @@
+smb
+mean
index 4096b36..18af4d8 100644 (file)
@@ -8,8 +8,8 @@
                                                                                                                                                                                         #####        #    ###
                ?   #?#?#                     01         01                  #?#              #     ##    ?  ?  ?     #          ##      #  #          ##  #            ##?#            ######        #    ###
                                      01      23         23                                                                             ##  ##        ###  ##                          #######        #   #####
-   P                       01        23      23         23                                                                            ###  ###      ####  ###     01              01 ########   D    #   #####
-                     C     23        23C     23   C C   23                                      C C       C      C C      C C  C C   ####  ####    #####  ####    23         C C  23#########        #   #####
+   P                       01        23      23         23                                                M                           ###  ###      ####  ###     01              01 ########   D    #   #####
+                     K     23        23C     23   C C   23                                      C C              C C      C C  C C   ####  ####    #####  ####    23         C C  23#########        #   #####
 ####################################################################  ###############   ################################################################  #####################################################                 #########
 
 [tiles]
@@ -25,3 +25,5 @@ D doc
 
 [enemies]
 C cat
+M mushroom
+K kaninchen
index 9c7a59d..0f8b880 100644 (file)
 void badge_main_loop(void) {
 
   for(;;) {
-    FILE *fd = fopen("jumpnrun/levels.txt", "r");
+    FILE *fd = fopen("../badge/jumpnrun/levels.txt", "r");
     char buf[12];
 
     while(fgets(buf, sizeof(buf), fd)) {
       buf[strlen(buf) - 1] = '\0';
-      char lvname[30];
-      sprintf(lvname, "jumpnrun/%s.lvl", buf);
+      char lvname[256];
+      sprintf(lvname, "../badge/jumpnrun/%s.lvl", buf);
       while(jumpnrun_play(lvname) != JUMPNRUN_WON)
         ;
     }
index d99928c..922d090 100644 (file)
@@ -21,6 +21,8 @@ enum {
   LEVEL_LINE_COUNT = 13
 };
 
+#define PATH_PREFIX "../badge/jumpnrun/"
+
 namespace jnrcpp {
   struct descriptors {
     descriptors() {
@@ -51,10 +53,10 @@ namespace jnrcpp {
 
   struct level_name_map {
     level_name_map() {
-      std::ifstream in("jumpnrun/levels.txt");
+      std::ifstream in(PATH_PREFIX "levels.txt");
 
       if(!in) {
-        throw std::logic_error("jumpnrun/levels.txt konnte nicht geöffnet werden.");
+        throw std::logic_error(PATH_PREFIX "levels.txt konnte nicht geöffnet werden.");
       }
 
       std::string name;
@@ -74,7 +76,7 @@ namespace jnrcpp {
       : name(name),
         level_lines(LEVEL_LINE_COUNT)
     {
-      std::ifstream in(("jumpnrun/" + name + ".lv").c_str());
+      std::ifstream in((PATH_PREFIX + name + ".lv").c_str());
 
       if(!in) {
         throw std::invalid_argument("Could not open file: " + name + ".lv");
@@ -238,7 +240,7 @@ namespace jnrcpp {
 void jumpnrun_level_dump(size_t level) {
   std::string name = jnrcpp::level_names.names[level];
   jnrcpp::level lv(name);
-  std::ofstream out(("jumpnrun/" + name + ".lvl").c_str());
+  std::ofstream out((PATH_PREFIX + name + ".lvl").c_str());
 
   lv.dump(out);
 }
This page took 0.02708 seconds and 4 git commands to generate.