Ignore:
Timestamp:
08/11/13 17:19:03 (12 years ago)
Author:
epyon
Message:
  • warning cleanup for clang and gcc
File:
1 edited

Legend:

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

    r179 r198  
    1515typedef nv::flags<512> cell_set;
    1616
    17 nv::uint32 nlua_to_cell_id( lua_State* L, int index, nv::map_area* map )
     17static nv::uint32 nlua_to_cell_id( lua_State* L, int index, nv::map_area* map )
    1818{
    1919        if ( lua_type( L, index ) == LUA_TSTRING )
    2020                return map->string_to_id( lua_tostring( L, index ) );
    2121        else
    22                 return (nv::uint32)lua_tointeger( L, index );
    23 }
    24 
    25 cell_set nlua_to_cell_set( lua_State* L, int index, nv::map_area* map )
    26 {
    27         cell_set result;
    28         switch ( lua_type( L, index ) )
    29         {
    30         case LUA_TTABLE :       
    31                 {
    32                         lua_pushnil( L );
    33                         while ( lua_next( L, index ) != 0 )
    34                         {
    35                                 if ( lua_type( L, -1 ) == LUA_TSTRING )
    36                                         result.set( map->string_to_id( lua_tostring( L, -1 ) ), true );
    37                                 else
    38                                         result.set( lua_tointeger( L, -1 ), true );
    39                                 lua_pop( L, 1 );
    40                         }
    41                 } break;
    42         case LUA_TSTRING : result.set( map->string_to_id( lua_tostring( L, index ) ), true ); break;
    43         case LUA_TNUMBER : result.set( lua_tointeger( L, index ), true ); break;
    44         }
    45         return result;
    46 }
     22                return lua_tounsigned( L, index );
     23}
     24
     25// static cell_set nlua_to_cell_set( lua_State* L, int index, nv::map_area* map )
     26// {
     27//      cell_set result;
     28//      switch ( lua_type( L, index ) )
     29//      {
     30//      case LUA_TTABLE :       
     31//              {
     32//                      lua_pushnil( L );
     33//                      while ( lua_next( L, index ) != 0 )
     34//                      {
     35//                              if ( lua_type( L, -1 ) == LUA_TSTRING )
     36//                                      result.set( map->string_to_id( lua_tostring( L, -1 ) ), true );
     37//                              else
     38//                                      result.set( lua_tounsigned( L, -1 ), true );
     39//                              lua_pop( L, 1 );
     40//                      }
     41//              } break;
     42//      case LUA_TSTRING : result.set( map->string_to_id( lua_tostring( L, index ) ), true ); break;
     43//      case LUA_TNUMBER : result.set( lua_tounsigned( L, index ), true ); break;
     44//      }
     45//      return result;
     46// }
    4747
    4848bool nlua_is_map_area( lua_State* L, int index )
     
    118118{
    119119        nv::map_area* ma = nlua_to_map_area( L, 1 );
    120         lua_pushinteger( L, ma->get_cell( nlua_to_coord( L, 2 ) ) );
     120        lua_pushunsigned( L, ma->get_cell( nlua_to_coord( L, 2 ) ) );
    121121        return 1;
    122122}
     
    125125{
    126126        nv::map_area* ma = nlua_to_map_area( L, 1 );
    127         ma->set_cell( nlua_to_coord( L, 2 ), lua_tointeger( L, 3 ) );
     127        ma->set_cell( nlua_to_coord( L, 2 ), lua_tounsigned( L, 3 ) );
    128128        return 0;
    129129}
     
    140140        else
    141141        {
    142                 lua_pushinteger( L, ma->get_cell( nlua_to_coord( L, 2 ) ) );
     142                lua_pushunsigned( L, ma->get_cell( nlua_to_coord( L, 2 ) ) );
    143143        }
    144144        return 1;
     
    148148{
    149149        nv::map_area* ma = nlua_to_map_area( L, 1 );
    150         ma->set_cell( nlua_to_coord( L, 2 ), lua_tointeger( L, 3 ) );
     150        ma->set_cell( nlua_to_coord( L, 2 ), lua_tounsigned( L, 3 ) );
    151151        return 0;
    152152}
     
    179179};
    180180
    181 int luaopen_map_area( lua_State * L )
     181static int luaopen_map_area( lua_State * L )
    182182{
    183183        luaL_newmetatable( L, NLUA_MAP_AREA_METATABLE );
Note: See TracChangeset for help on using the changeset viewer.