new maps (dev)
[fishladder.git] / fishladder_resources.h
index 90303019e2c7aa2e9a286b5f9e7ce7d555ba21ce..929d4a4565b5b79e81b52dbd7d375665958f38ef 100644 (file)
@@ -636,11 +636,11 @@ static struct cmp_level cmp_levels_tutorials[] =
                .is_tutorial = 1
        },
    {
-      .serial_id = 25,
+      .serial_id = 26,
       .title = "PRINCIPLE 7",
       .map_name = "cmp_p7",
       .description = "Emitters",
-      ._unlock = 26,
+      ._unlock = 27,
       .is_tutorial = 1
    }
 };
@@ -767,7 +767,35 @@ static struct cmp_level cmp_levels_basic[] =
 
                ._unlock = 25,
                .achievement = "GRADUATE"
-       }
+       },
+   {
+      .serial_id = 27,
+      .title = "EXPAND",
+      .map_name = "cmp_expander",
+      .description = "",
+
+      ._unlock = 28
+   },
+   {
+      .serial_id = 28,
+      .title = "PATTERNS 3",
+      .map_name = "cmp_pattern3",
+      .description = "",
+      ._linked = 29
+   },
+   {
+      .serial_id = 29,
+      .title = "ROUTING PROBLEM 2",
+      .map_name = "cmp_routing2",
+      .description = "Spaghetti!",
+      ._linked = 30
+   },
+   {
+      .serial_id = 30,
+      .title = "EXACTLY 5",
+      .map_name = "cmp_exact5",
+      .description = ""
+   }
 };
 
 static struct cmp_level cmp_levels_grad[] =
@@ -927,14 +955,23 @@ career_packs[] =
 static void career_local_data_init(void)
 {
        struct cmp_level *level_ptrs[ NUM_CAMPAIGN_LEVELS ];
-       
+       for( int i = 0; i < NUM_CAMPAIGN_LEVELS; i ++ )
+      level_ptrs[i] = NULL;
+
        // COllect pointers
        for( int i = 0; i < vg_list_size( career_packs ); i ++ )
        {
                struct career_level_pack *set = &career_packs[i];
                
                for( int j = 0; j < set->count; j ++ )
-                       level_ptrs[ set->pack[j].serial_id ] = &set->pack[j];
+      {
+         int id = set->pack[j].serial_id;
+
+         if( level_ptrs[ id ] )
+            vg_error( "Serial id %u already used!\n", id );
+         else
+                          level_ptrs[ set->pack[j].serial_id ] = &set->pack[j];
+      }
        }
        
        // Apply
@@ -945,8 +982,18 @@ static void career_local_data_init(void)
                for( int j = 0; j < set->count; j ++ )
                {
                        struct cmp_level *lvl = &set->pack[j];
-                       lvl->unlock = lvl->_unlock? level_ptrs[ lvl->_unlock ]: NULL;
-                       lvl->linked = lvl->_linked? level_ptrs[ lvl->_linked ]: NULL;
+
+         if( lvl->_unlock >= NUM_CAMPAIGN_LEVELS ||
+             lvl->_linked >= NUM_CAMPAIGN_LEVELS )
+         {
+            vg_error( "_unlock / _linked out of range (%d, %d)\n",
+               lvl->_unlock, lvl->_linked );
+         }
+         else
+         {
+                          lvl->unlock = lvl->_unlock? level_ptrs[ lvl->_unlock ]: NULL;
+                          lvl->linked = lvl->_linked? level_ptrs[ lvl->_linked ]: NULL;
+         }
                }
        }
 }