Changeset 323 for trunk/src/lua


Ignore:
Timestamp:
08/26/14 04:03:10 (11 years ago)
Author:
epyon
Message:
  • nova now compiles again under all three compilers with -Winsane and no warnings
Location:
trunk/src/lua
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lua/lua_map_tile.cc

    r319 r323  
    2727
    2828
    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
     39static map_tile* nlua_to_pmap_tile( lua_State* L, int index )
    4040{
    4141        return (map_tile*)luaL_checkudata( L, index, NLUA_MAP_TILE_METATABLE );
    4242}
    4343
    44 void nlua_push_map_tile( lua_State* L, const map_tile& tile )
     44static void nlua_push_map_tile( lua_State* L, const map_tile& tile )
    4545{
    4646        map_tile* result = (map_tile*)lua_newuserdata( L, sizeof(map_tile) );
     
    7979                        if ( lua_isstring( L, -2 ) && lua_objlen( L, -2 ) == 1 )
    8080                        {
    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 ) ) );
    8282                        }
    8383                        // removes 'value'; keeps 'key' for next iteration */
     
    8686        }
    8787
    88         for ( int line = 0; line < tile.size_x; line++ )
    89                 for ( int row = 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 ];
    9292                        // TODO: check for errors
    9393                        tile.data[ row * tile.size_x + line ] = translation[ gylph ];
     
    203203        switch ( nv::random::get().urand( 4 ) )
    204204        {
    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;
    208208        default:
    209209                break;
  • trunk/src/lua/lua_nova.cc

    r319 r323  
    99#include "nv/lua/lua_raw.hh"
    1010
    11 const char* NV_STATE      = "NV_STATE";
    12 const char* NV_BLUEPRINTS = "NV_BLUEPRINTS";
     11static const char* NV_STATE      = "NV_STATE";
     12static const char* NV_BLUEPRINTS = "NV_BLUEPRINTS";
    1313
    1414// static nv::lua::state* nova_get_state( lua_State * L )
     
    7373                        return true;
    7474                }
     75                break;
    7576        case LUA_TSTRING :
    7677                if ( lua_type( L, ivalue ) != LUA_TTABLE )
     
    8687                lua_concat( L, 3 );
    8788                lua_call( L, 3, 0 );
     89                break;
    8890        case LUA_TNUMBER :
    8991                if (lua_tointeger( L, itype ) != lua_type( L, ivalue ) && lua_tointeger( L, itype ) > 0)
     
    9193                        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 ) ) );
    9294                }
    93 
     95                break;
     96        default : return false;
    9497        }
    9598        return false;
     
    784787
    785788
    786 int luaopen_nova( lua_State * L )
     789static int luaopen_nova( lua_State * L )
    787790{
    788791        lua_createtable( L, 0, 0 );
Note: See TracChangeset for help on using the changeset viewer.