medfall

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 01ec5d0435c43892e2131f4d3b0448aa31fe6cb0
parent 8fb50d4771d25d3f62cb63deec6d4ffff0ac5571
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Sat Nov  5 16:37:16 +0200

Use new macros

Diffstat:
pp.cc | 13+++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/pp.cc b/pp.cc @@ -53,8 +53,8 @@ static void compute_horizons( MemoryArena * arena, const array2d< u8 > heightmap, array2d< float > horizons ) { - assert( heightmap.w == horizons.w ); - assert( heightmap.h == horizons.h ); + ASSERT( heightmap.w == horizons.w ); + ASSERT( heightmap.h == horizons.h ); for( size_t y = 0; y < heightmap.h; y++ ) { compute_row_of_horizons( arena, heightmap, horizons, y ); @@ -100,10 +100,10 @@ static void write_compressed_file( const void * data, size_t len, const char * f // write FILE * file = fopen( path.c_str(), "wb" ); - assert( file != NULL ); + ASSERT( file != NULL ); fwrite( compressed, 1, compressed_len, file ); fclose( file ); - assert( ferror( file ) == 0 ); + ASSERT( ferror( file ) == 0 ); // clean up delete[] compressed; @@ -156,13 +156,13 @@ static void write_tile( static u8 arena_memory[ megabytes( 16 ) ]; int main( int argc, char ** argv ) { MemoryArena arena; - memarena_init( &arena, arena_memory, array_count( arena_memory ) ); + memarena_init( &arena, arena_memory, ARRAY_COUNT( arena_memory ) ); const std::string path = argc == 2 ? argv[ 1 ] : "terrains/mountains512.png"; int w, h; printf( "decoding\n" ); u8 * heightmap_memory = stbi_load( path.c_str(), &w, &h, NULL, 1 ); - assert( heightmap_memory != NULL ); + ASSERT( heightmap_memory != NULL ); const std::string dir = path + ".parts"; @@ -171,6 +171,7 @@ int main( int argc, char ** argv ) { FILE * dims = fopen( ( dir + "/dims.txt" ).c_str(), "w" ); fprintf( dims, "%d %d", w, h ); fclose( dims ); + ASSERT( ferror( dims ) == 0 ); float * horizons_memory = new float[ w * h ]; v3 * normals_memory = new v3[ w * h ];