Changeset 323 for trunk/src/lua
- Timestamp:
- 08/26/14 04:03:10 (11 years ago)
- Location:
- trunk/src/lua
- Files:
-
- 2 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; -
trunk/src/lua/lua_nova.cc
r319 r323 9 9 #include "nv/lua/lua_raw.hh" 10 10 11 const char* NV_STATE = "NV_STATE";12 const char* NV_BLUEPRINTS = "NV_BLUEPRINTS";11 static const char* NV_STATE = "NV_STATE"; 12 static const char* NV_BLUEPRINTS = "NV_BLUEPRINTS"; 13 13 14 14 // static nv::lua::state* nova_get_state( lua_State * L ) … … 73 73 return true; 74 74 } 75 break; 75 76 case LUA_TSTRING : 76 77 if ( lua_type( L, ivalue ) != LUA_TTABLE ) … … 86 87 lua_concat( L, 3 ); 87 88 lua_call( L, 3, 0 ); 89 break; 88 90 case LUA_TNUMBER : 89 91 if (lua_tointeger( L, itype ) != lua_type( L, ivalue ) && lua_tointeger( L, itype ) > 0) … … 91 93 luaL_error( L, "lua.nova - \"%s.%s\" - type mismatch, %s expected, %s found!", lua_tolstring( L, iid, 0 ), lua_tolstring( L, ifield, 0 ), lua_typename( L, lua_tointeger( L, itype ) ), lua_typename( L, lua_type( L, ivalue ) ) ); 92 94 } 93 95 break; 96 default : return false; 94 97 } 95 98 return false; … … 784 787 785 788 786 int luaopen_nova( lua_State * L )789 static int luaopen_nova( lua_State * L ) 787 790 { 788 791 lua_createtable( L, 0, 0 );
Note: See TracChangeset
for help on using the changeset viewer.