world.io = NULL;
}
+static void map_reclassify( v2i start, v2i end );
static int map_load( const char *str )
{
map_free();
c ++;
}
+ map_reclassify( NULL, NULL );
vg_success( "Map loaded! (%u:%u)\n", world.w, world.h );
return 1;
}
return 1;
}
-// Entire world: 2 -> worldx/y-2
-
-static void fl_world_update( v2i start, v2i end )
+static void map_reclassify( v2i start, v2i end )
{
- for( int y = start[1]; y < end[1]; y ++ )
+ v2i full_start = { 2,2 };
+ v2i full_end = { world.w-2, world.h-2 };
+
+ if( !start || !end )
+ {
+ start = full_start;
+ end = full_end;
+ }
+
+ for( int y = vg_max( start[1], full_start[1] ); y < vg_min( end[1], full_end[1] ); y ++ )
{
- for( int x = start[0]; x < end[0]; x ++ )
+ for( int x = vg_max( start[0], full_start[0] ); x < vg_min( end[0], full_end[0] ); x ++ )
{
v2i dirs[] = {{1,0},{0,1},{-1,0},{0,-1}};
if( neighbour->state & (FLAG_CANAL|FLAG_INPUT|FLAG_OUTPUT) )
config |= 0x1 << i;
}
-
-
- } else config = 0xF;
+ }
+ else config = 0xF;
pcell((v2i){x,y})->config = config;
}
sfx_set_playrnd( &audio_tile_mod, &audio_system_sfx, 3, 6 );
else
sfx_set_playrnd( &audio_tile_mod, &audio_system_sfx, 0, 3 );
+
+ map_reclassify( (v2i){ tile_x -2, tile_y -2 }, (v2i){ tile_x +2, tile_y +2 } );
}
}
else
}
}
- // There was world reconfiguarion here previously...
- fl_world_update( (v2i){2,2}, (v2i){world.w-2,world.h-2} );
-
// Fish ticks
if( world.simulating )
{