Changeset 198 for trunk/src/lua


Ignore:
Timestamp:
08/11/13 17:19:03 (12 years ago)
Author:
epyon
Message:
  • warning cleanup for clang and gcc
Location:
trunk/src/lua
Files:
6 edited

Legend:

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

    r179 r198  
    3434}
    3535
    36 void nlua_area_construct( lua_State* L, int sidx )
     36static void nlua_area_construct( lua_State* L, int sidx )
    3737{
    3838        if ( nlua_is_coord( L, sidx ) )
     
    412412
    413413
    414 int luaopen_area( lua_State * L )
     414static int luaopen_area( lua_State * L )
    415415{
    416416        static const struct luaL_Reg nlua_area_sf [] = {
  • trunk/src/lua/lua_aux.cc

    r180 r198  
    9595        if ( dice < 1 )  luaL_argerror( L, 1, "die count lower than 1!" );
    9696        if ( sides < 1 ) luaL_argerror( L, 2, "side count lower than 1!" );
    97         lua_pushnumber( L, nv::random::get().dice( dice, sides ) );
     97        lua_pushnumber( L, nv::random::get().dice( static_cast< nv::uint32 >( dice ), static_cast< nv::uint32 >( sides ) ) );
    9898        return 1;
    9999}
     
    111111                        int arg1 = luaL_checkinteger( L, 1 );
    112112                        if ( arg1 < 1 ) arg1 = 1;
    113                         lua_pushunsigned( L, nv::random::get().urange( 1, arg1 ) );
     113                        lua_pushunsigned( L, nv::random::get().urange( 1, static_cast<nv::uint32>( arg1 ) ) );
    114114                }
    115115                else
     
    126126static int nluaaux_math_randomseed( lua_State* L )
    127127{
    128         nv::random::get().set_seed( static_cast< nv::uint32 > ( L, 1 ) );
     128        nv::random::get().set_seed( lua_tounsigned( L, 1 ) );
    129129        return 0;
    130130}
  • trunk/src/lua/lua_function.cc

    r182 r198  
    1111using namespace nv;
    1212
    13 lua::function_base::function_base( lua_State* L, const path& a_path, bool global /*= true*/ ) : L(L)
     13lua::function_base::function_base( lua_State* a_L, const path& a_path, bool a_global /*= true*/ ) : L(a_L)
    1414{
    15         if ( !a_path.resolve( L, global ) )
     15        if ( !a_path.resolve( L, a_global ) )
    1616        {
    1717                lua_pop( L, 1 );
     
    2727}
    2828
    29 lua::function_base::function_base( const function_base& func ) : L(L)
     29lua::function_base::function_base( const function_base& func ) : L(func.L)
    3030{
    3131        lua_rawgeti( L, LUA_REGISTRYINDEX, func.m_ref );
  • 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 );
  • trunk/src/lua/lua_path.cc

    r181 r198  
    2323}
    2424
    25 lua::path::path( int i )
     25lua::path::path( unsigned i )
    2626        : m_count(0)
    2727{
     
    8888                        else
    8989                        {
    90                                 lua_pushinteger( L, m_elements[i].value );
     90                                lua_pushunsigned( L, m_elements[i].value );
    9191                        }
    9292                        lua_gettable( L, -2 );
  • trunk/src/lua/lua_state.cc

    r188 r198  
    257257{
    258258        lua_getfield( L->L, -1, element.c_str() );
    259         int result = lua_type( L->L, -1 ) == LUA_TNUMBER ? lua_tounsigned( L->L, -1 ) : defval;
     259        unsigned result = lua_type( L->L, -1 ) == LUA_TNUMBER ? lua_tounsigned( L->L, -1 ) : defval;
    260260        lua_pop( L->L, 1 );
    261261        return result;
Note: See TracChangeset for help on using the changeset viewer.