Changeset 323 for trunk/src/lua/lua_map_tile.cc
- Timestamp:
- 08/26/14 04:03:10 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lua/lua_map_tile.cc
r319 r323 27 27 28 28 29 bool nlua_is_map_tile( lua_State* L, int index )30 {31 return luaL_testudata( L, index, NLUA_MAP_TILE_METATABLE ) != 0;32 }33 34 map_tile nlua_to_map_tile( lua_State* L, int index )35 {36 return *(map_tile*)luaL_checkudata( L, index, NLUA_MAP_TILE_METATABLE );37 }38 39 map_tile* nlua_to_pmap_tile( lua_State* L, int index )29 // static bool nlua_is_map_tile( lua_State* L, int index ) 30 // { 31 // return luaL_testudata( L, index, NLUA_MAP_TILE_METATABLE ) != 0; 32 // } 33 // 34 // static map_tile nlua_to_map_tile( lua_State* L, int index ) 35 // { 36 // return *(map_tile*)luaL_checkudata( L, index, NLUA_MAP_TILE_METATABLE ); 37 // } 38 39 static map_tile* nlua_to_pmap_tile( lua_State* L, int index ) 40 40 { 41 41 return (map_tile*)luaL_checkudata( L, index, NLUA_MAP_TILE_METATABLE ); 42 42 } 43 43 44 void nlua_push_map_tile( lua_State* L, const map_tile& tile )44 static void nlua_push_map_tile( lua_State* L, const map_tile& tile ) 45 45 { 46 46 map_tile* result = (map_tile*)lua_newuserdata( L, sizeof(map_tile) ); … … 79 79 if ( lua_isstring( L, -2 ) && lua_objlen( L, -2 ) == 1 ) 80 80 { 81 translation[ lua_tostring( L, -2 )[0]] = nv::uint8( map_area->string_to_id( lua_tostring( L, -1 ) ) );81 translation[ (nv::uint8)( lua_tostring( L, -2 )[0] ) ] = nv::uint8( map_area->string_to_id( lua_tostring( L, -1 ) ) ); 82 82 } 83 83 // removes 'value'; keeps 'key' for next iteration */ … … 86 86 } 87 87 88 for ( intline = 0; line < tile.size_x; line++ )89 for ( introw = 0; row < tile.size_y; row++ )90 { 91 nv::char8 gylph = code[ row * ( tile.size_x + 1 ) + line ];88 for ( nv::uint16 line = 0; line < tile.size_x; line++ ) 89 for ( nv::uint16 row = 0; row < tile.size_y; row++ ) 90 { 91 nv::char8 gylph = (nv::char8)code[ row * ( tile.size_x + 1 ) + line ]; 92 92 // TODO: check for errors 93 93 tile.data[ row * tile.size_x + line ] = translation[ gylph ]; … … 203 203 switch ( nv::random::get().urand( 4 ) ) 204 204 { 205 case 1 : nlua_map_tile_flip_x( L ); 206 case 2 : nlua_map_tile_flip_y( L ); 207 case 3 : nlua_map_tile_flip_xy( L ); 205 case 1 : nlua_map_tile_flip_x( L ); break; 206 case 2 : nlua_map_tile_flip_y( L ); break; 207 case 3 : nlua_map_tile_flip_xy( L ); break; 208 208 default: 209 209 break;
Note: See TracChangeset
for help on using the changeset viewer.