.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
}
};
._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[] =
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
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;
+ }
}
}
}