Changeset 323 for trunk/src


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
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/curses/curses_terminal.cc

    r319 r323  
    5858        if ( color > 7 )
    5959        {
    60                 attrset((static_cast<uint32>(color-7) << 24)  & 0xff000000ul | 0x00800000ul);
     60                attrset((static_cast<uint32>(color-7) << 24)  & ( 0xff000000ul | 0x00800000ul ) );
    6161        }
    6262        else
  • trunk/src/engine/particle_engine.cc

    r320 r323  
    577577        case particle_origin::CENTER        : break;
    578578        case particle_origin::TOP_LEFT      : lb = vec2(0.f,-1.f); rt = vec2(1.f,0.f);  break;
    579         case particle_origin::TOP_CENTER    : lb.y = -1.f; rt.y = 0.f; break;  break;
     579        case particle_origin::TOP_CENTER    : lb.y = -1.f; rt.y = 0.f; break;
    580580        case particle_origin::TOP_RIGHT     : lb = vec2(-1.f,-1.f); rt = vec2(); break;
    581581        case particle_origin::CENTER_LEFT   : lb.x = 0.f; rt.x = 1.f; break;
     
    663663{
    664664        if ( info->count > 0 )
    665                 for ( sint32 i = info->count-1; i >= 0; --i )
     665                for ( sint32 i = (sint32)info->count-1; i >= 0; --i )
    666666                {
    667667                        particle& pinfo = info->particles[i];
     
    723723                                        {
    724724                                                float emission_angle = glm::radians( edata.angle );
    725                                                 float cos_theta = r.frange( cos( emission_angle ), 1.0f );
     725                                                float cos_theta = r.frange( glm::cos( emission_angle ), 1.0f );
    726726                                                float sin_theta = glm::sqrt(1.0f - cos_theta * cos_theta );
    727727                                                float phi       = r.frange( 0.0f, 2*glm::pi<float>() );
  • trunk/src/engine/program_manager.cc

    r319 r323  
    5757                for ( uint32 i = 1; i <= count; ++i )
    5858                {
    59                         std::string include( inctable.get<std::string,int>(i) );
     59                        std::string include( inctable.get<std::string,uint32>(i) );
    6060                        if ( i == count ) out += "#line 1\n";
    6161                        out += nv::slurp( include );
  • trunk/src/engine/resource_system.cc

    r319 r323  
    2929        clear();
    3030        lua::table_guard table( m_lua, get_storage_name() );
    31         uint32 count = table.get_integer( "__counter" );
     31        uint32 count = table.get_unsigned( "__counter" );
    3232        for ( auto i : range( count ) )
    3333        {
  • trunk/src/formats/assimp_loader.cc

    r302 r323  
    1414using namespace nv;
    1515
    16 const int MAX_BONES = 64;
     16const unsigned MAX_BONES = 64;
    1717
    1818struct assimp_plain_vtx
     
    9090        m_mesh_count = 0;
    9191        NV_LOG( nv::LOG_NOTICE, "AssImp loading file..." );
    92         int size = (int)source.size();
     92        size_t size = source.size();
    9393        char* data  = new char[ size ];
    9494        source.read( data, size, 1 );
     
    159159                                        if ( v.boneweight[i] <= 0.0f )
    160160                                        {
    161                                                 v.boneindex[i] = m;
     161                                                v.boneindex[i]  = (int)m;
    162162                                                v.boneweight[i] = bone->mWeights[w].mWeight;
    163163                                                found = true;
     
    289289        for ( unsigned int m = 0; m < m_mesh_count; ++m )
    290290        {
    291                 sint16 translate[MAX_BONES];
     291                uint16 translate[MAX_BONES];
    292292                std::vector< mesh_node_data > bones;
    293293                const aiMesh*  mesh  = scene->mMeshes[ m ];
     
    304304                                {
    305305                                        NV_ASSERT( final_bones.size() < MAX_BONES, "Too many bones to merge!" );
    306                                         sint16 index = (sint16)final_bones.size();
     306                                        uint16 index = (uint16)final_bones.size();
    307307                                        final_bones.push_back( bone );
    308308                                        names[ bone.name ] = index;
     
    311311                                else
    312312                                {
    313                                         translate[b] = (sint16)iname->second;
     313                                        translate[b] = iname->second;
    314314                                }
    315315                        }
     
    326326                                                if ( vertex.boneweight[i] > 0.0f )
    327327                                                {
    328                                                         vertex.boneindex[i] = translate[vertex.boneindex[i]];
     328                                                        vertex.boneindex[i] = (int)translate[vertex.boneindex[i]];
    329329                                                }
    330330                                        }
  • trunk/src/formats/md3_loader.cc

    r319 r323  
    234234
    235235md3_loader::md3_loader( bool merge_all )
    236         : m_md3( nullptr ), m_merge_all( merge_all )
     236        : m_merge_all( merge_all ), m_md3( nullptr )
    237237{
    238238        if ( !s_normal_ready )
     
    286286{
    287287        md3_t* md3 = (md3_t*)m_md3;
    288         key_raw_channel* result = key_raw_channel::create<md3_key>( md3->header.num_frames );
     288        key_raw_channel* result = key_raw_channel::create<md3_key>( (uint32)md3->header.num_frames );
    289289        // TODO: is this brain damaged in efficiency (loop nest order) or what?
    290290        for ( sint32 f = 0; f < md3->header.num_frames; ++f )
     
    322322{
    323323        mesh_data* data = new mesh_data;
    324         release_mesh_frame( data, -1, index );
     324        release_mesh_frame( data, -1, (sint32)index );
    325325        return data;
    326326}
     
    329329{
    330330        md3_t* md3 = (md3_t*)m_md3;
    331         sint32 num_surfaces  = md3->header.num_surfaces;
    332         sint32 num_verts     = 0;
    333         sint32 current_frame = ( frame == -1 ? 0 : frame );
    334         sint32 frame_count   = ( frame == -1 ? md3->header.num_frames : 1 );
    335         sint32 current_surf  = ( surface == -1 ? 0 : surface );
    336         sint32 surf_count    = ( surface == -1 ? md3->header.num_surfaces : 1 );
    337         sint32 index_count   = 0;
     331        uint32 num_surfaces  = (uint32)md3->header.num_surfaces;
     332        uint32 num_verts     = 0;
     333        uint32 current_frame = ( frame == -1 ? 0 : (uint32)frame );
     334        uint32 frame_count   = ( frame == -1 ? (uint32)md3->header.num_frames : 1 );
     335        uint32 current_surf  = ( surface == -1 ? 0 : (uint32)surface );
     336        uint32 surf_count    = ( surface == -1 ? (uint32)md3->header.num_surfaces : 1 );
     337        uint32 index_count   = 0;
    338338
    339339        if ( surface >= 0 )
    340340        {
    341                 index_count = md3->surfaces[surface].header.num_triangles * 3;
    342                 num_verts   = md3->surfaces[surface].header.num_verts;
     341                index_count = (uint32)md3->surfaces[(uint32)surface].header.num_triangles * 3;
     342                num_verts   = (uint32)md3->surfaces[(uint32)surface].header.num_verts;
    343343        }
    344344        else
    345                 for ( sint32 i = 0; i < num_surfaces; ++i )
    346                 {
    347                         index_count += md3->surfaces[i].header.num_triangles * 3;
    348                         num_verts   += md3->surfaces[i].header.num_verts;
     345                for ( uint32 i = 0; i < num_surfaces; ++i )
     346                {
     347                        index_count += (uint32)md3->surfaces[i].header.num_triangles * 3;
     348                        num_verts   += (uint32)md3->surfaces[i].header.num_verts;
    349349                }
    350350
     
    362362        while ( surf_count > 0 )
    363363        {
    364                 const md3_surface_t& surface = md3->surfaces[ current_surf ];
    365                 const uint32         vcount  = static_cast< uint32 >( surface.header.num_verts );
    366                 const uint32         tcount  = static_cast< uint32 >( surface.header.num_triangles );
     364                const md3_surface_t& sface = md3->surfaces[ current_surf ];
     365                const uint32         vcount = static_cast< uint32 >( sface.header.num_verts );
     366                const uint32         tcount = static_cast< uint32 >( sface.header.num_triangles );
    367367
    368368                for (uint32 j = 0; j < vcount; ++j )
    369369                {
    370                         vtx_t[index++].texcoord = md3_texcoord( surface.st[j] );
     370                        vtx_t[index++].texcoord = md3_texcoord( sface.st[j] );
    371371                }
    372372
    373373                for (size_t j = 0; j < tcount; ++j )
    374374                {
    375                         const md3_triangle_t& t = surface.triangles[j];
     375                        const md3_triangle_t& t = sface.triangles[j];
    376376                        icp[iindex++] = static_cast< uint16 >( index_base + t.indexes[0] );
    377377                        icp[iindex++] = static_cast< uint16 >( index_base + t.indexes[1] );
    378378                        icp[iindex++] = static_cast< uint16 >( index_base + t.indexes[2] );
    379379                }
    380                 index_base += surface.header.num_verts;
     380                index_base += sface.header.num_verts;
    381381                ++current_surf;
    382382                --surf_count;
     
    386386        while ( frame_count > 0 )
    387387        {
    388                 current_surf  = ( surface == -1 ? 0 : surface );
    389                 surf_count    = ( surface == -1 ? md3->header.num_surfaces : 1 );
     388                current_surf  = ( surface == -1 ? 0 : (uint32)surface );
     389                surf_count    = ( surface == -1 ? (uint32)md3->header.num_surfaces : 1 );
    390390
    391391                while ( surf_count > 0 )
    392392                {
    393                         md3_surface_t& surface = md3->surfaces[current_surf];
    394                         sint32         vcount  = surface.header.num_verts;
    395                         sint32         offset = vcount * current_frame;
    396                         sint32         limit   = vcount + offset;
    397                         for (sint32 j = offset; j < limit; ++j )
     393                        md3_surface_t& sface = md3->surfaces[current_surf];
     394                        uint32         vcount = (uint32)sface.header.num_verts;
     395                        uint32         offset = vcount * current_frame;
     396                        uint32         limit  = vcount + offset;
     397                        for (uint32 j = offset; j < limit; ++j )
    398398                        {
    399                                 md3_vertex_t& v = surface.vertices[j];
     399                                md3_vertex_t& v = sface.vertices[j];
    400400                                vtx_pn[index].position = vec3( v.x * MD3_XYZ_SCALE, v.z * MD3_XYZ_SCALE, v.y * MD3_XYZ_SCALE );
    401401                                vtx_pn[index].normal   = s_normal_cache[ v.normal ];
     
    418418{
    419419        md3_t* md3 = (md3_t*)m_md3;
    420         uint32 node_count = md3->header.num_tags;
     420        uint32 node_count = (uint32)md3->header.num_tags;
    421421        if ( node_count == 0 ) return nullptr;;
    422422        mesh_node_data* nodes = new mesh_node_data[ node_count ];
     
    451451        else
    452452        {
    453                 count = md3->header.num_surfaces;
     453                count = (uint32)md3->header.num_surfaces;
    454454                data = new mesh_data[ count ];
    455455                for ( uint32 i = 0; i < count; ++i )
    456456                {
    457                         release_mesh_frame( &data[i], -1, i );
     457                        release_mesh_frame( &data[i], -1, (sint32)i );
    458458                        data[i].set_name( (char*)md3->surfaces[i].header.name );
    459459                }
  • trunk/src/formats/md5_loader.cc

    r319 r323  
    135135                        mesh_data* mesh = new mesh_data("md5_mesh");
    136136
    137                         int num_verts   = 0;
    138                         int num_tris    = 0;
    139                         int num_weights = 0;
     137                        uint32 num_verts   = 0;
     138                        uint32 num_tris    = 0;
     139                        uint32 num_weights = 0;
    140140
    141141                        discard( sstream, "{" );
     
    170170                                        next_line( sstream );
    171171                                        std::string line;
    172                                         for ( int i = 0; i < num_verts; ++i )
     172                                        for ( uint32 i = 0; i < num_verts; ++i )
    173173                                        {
    174174                                                size_t weight_count;
     
    194194                                        next_line( sstream );
    195195                                        std::string line;
    196                                         for ( int i = 0; i < num_tris; ++i )
     196                                        for ( uint32 i = 0; i < num_tris; ++i )
    197197                                        {
    198198                                                size_t ti0;
     
    214214                                        next_line( sstream );
    215215                                        std::string line;
    216                                         for ( int i = 0; i < num_weights; ++i )
     216                                        for ( uint32 i = 0; i < num_weights; ++i )
    217217                                        {
    218218                                                md5_weight weight;
     
    368368                        if ( j < weight_count )
    369369                        {
    370                                 vdata.boneindex[j]  = weights[start_weight + j].joint_id;
     370                                vdata.boneindex[j]  = (int)weights[start_weight + j].joint_id;
    371371                                vdata.boneweight[j] = weights[start_weight + j].bias;
    372372                        }
  • trunk/src/formats/nmd_loader.cc

    r319 r323  
    242242
    243243                nmd_node_header nheader;
    244                 nheader.parent_id = (uint16)node->parent_id;
     244                nheader.parent_id = node->parent_id;
    245245                nheader.transform = node->transform;
    246246                stream_out.write( &nheader, sizeof( nheader ), 1 );
  • trunk/src/gfx/image.cc

    r319 r323  
    8989        fill( r, 255 );
    9090
    91         sint32 bpos       = (r.pos.y*m_size.x + r.pos.x ) * static_cast<sint32>( m_depth );
    92         sint32 bline      = m_size.x*static_cast<sint32>( m_depth );
     91        uint32 bpos       = static_cast< uint32 >( r.pos.y*m_size.x + r.pos.x ) * m_depth;
     92        uint32 bline      = static_cast< uint32 >( m_size.x ) * m_depth;
    9393
     94        uint32 rsizex     = static_cast< uint32 >( r.size.x );
     95        uint32 rsizey     = static_cast< uint32 >( r.size.y );
    9496        const uint8* data = idata->get_data();
    95         sint32 depth      = idata->get_depth();
    96         sint32 dstride    = r.size.x * static_cast<sint32>( depth );
     97        size_t depth      = idata->get_depth();
     98        uint32 dstride    = rsizex * depth;
    9799
    98         for( int y = 0; y < r.size.y; ++y )
     100        for( uint32 y = 0; y < rsizey; ++y )
    99101        {
    100                 sint32 pos = bpos + bline * y;
    101                 for( int x = 0; x < r.size.x; ++x )
     102                uint32 pos = bpos + bline * y;
     103                for( uint32 x = 0; x < rsizex; ++x )
    102104                {
    103                         sint32 xy = pos + x * m_depth;
    104                         for( int e = 0; e < depth; ++e )
     105                        uint32 xy = pos + x * m_depth;
     106                        for( size_t e = 0; e < depth; ++e )
    105107                        {
    106108                                m_data[ xy + e ] = data[ y*dstride + x * depth + e ];
  • trunk/src/gfx/mesh_creator.cc

    r302 r323  
    128128                const vertex_descriptor& desc   = channel->desc;
    129129                uint8* raw_data = channel->data;
    130                 int vtx_size = desc.size;
     130                uint32 vtx_size = desc.size;
    131131                int p_offset = -1;
    132132                int n_offset = -1;
     
    135135                        switch ( desc.slots[i].vslot )
    136136                        {
    137                                 case slot::POSITION : if ( desc.slots[i].etype == FLOAT_VECTOR_3 ) p_offset = desc.slots[i].offset; break;
    138                                 case slot::NORMAL   : if ( desc.slots[i].etype == FLOAT_VECTOR_3 ) n_offset = desc.slots[i].offset; break;
    139                                 case slot::TANGENT  : if ( desc.slots[i].etype == FLOAT_VECTOR_4 ) t_offset = desc.slots[i].offset; break;
     137                                case slot::POSITION : if ( desc.slots[i].etype == FLOAT_VECTOR_3 ) p_offset = (int)desc.slots[i].offset; break;
     138                                case slot::NORMAL   : if ( desc.slots[i].etype == FLOAT_VECTOR_3 ) n_offset = (int)desc.slots[i].offset; break;
     139                                case slot::TANGENT  : if ( desc.slots[i].etype == FLOAT_VECTOR_4 ) t_offset = (int)desc.slots[i].offset; break;
    140140                                default             : break;
    141141                        }
     
    173173        size_t n_offset = 0;
    174174        if ( ch_n == -1 ) return;
    175         mesh_raw_channel* channel = m_data->m_channels[ch_n];
     175        mesh_raw_channel* channel = m_data->m_channels[ (unsigned) ch_n ];
    176176        for ( uint32 i = 0; i < channel->desc.count; ++i )
    177177                if ( channel->desc.slots[i].vslot == slot::NORMAL )
     
    211211                                if ( desc.slots[i].etype == FLOAT_VECTOR_3 )
    212212                                {
    213                                         p_offset  = desc.slots[i].offset;
     213                                        p_offset  = (int)desc.slots[i].offset;
    214214                                        p_channel = channel;
    215215                                }
     
    217217                        case slot::NORMAL   : if ( desc.slots[i].etype == FLOAT_VECTOR_3 )
    218218                                {
    219                                         n_offset  = desc.slots[i].offset;
     219                                        n_offset  = (int)desc.slots[i].offset;
    220220                                        n_channel = m_data->m_channels[ c ];
    221221                                        n_channel_index = c;
     
    224224                        case slot::TEXCOORD : if ( desc.slots[i].etype == FLOAT_VECTOR_2 )
    225225                                {
    226                                         t_offset  = desc.slots[i].offset;
     226                                        t_offset  = (int)desc.slots[i].offset;
    227227                                        t_channel = channel;
    228228                                }
     
    420420        int och_ti = other->get_channel_index( slot::TEXCOORD );
    421421        if ( ch_pi == -1 || ch_ti == -1 ) return;
    422         size_t size   = m_data->m_channels[ ch_ti ]->count;
    423         size_t osize  =  other->m_channels[ och_ti ]->count;
    424         size_t count  = m_data->m_channels[ ch_pi ]->count;
    425         size_t ocount =  other->m_channels[ och_pi ]->count;
     422        size_t size   = m_data->m_channels[ (unsigned)ch_ti ]->count;
     423        size_t osize  =  other->m_channels[ (unsigned)och_ti ]->count;
     424        size_t count  = m_data->m_channels[ (unsigned)ch_pi ]->count;
     425        size_t ocount =  other->m_channels[ (unsigned)och_pi ]->count;
    426426        if ( count % size != 0 || ocount % osize != 0 ) return;
    427427        if ( count / size != ocount / osize ) return;
  • trunk/src/gfx/skeletal_mesh.cc

    r319 r323  
    5353                                for ( size_t j = 0; j < 4; ++j )
    5454                                {
    55                                         int   index  = vert.boneindex[j];
    56                                         float weight = vert.boneweight[j];
     55                                        unsigned index = (unsigned)vert.boneindex[j];
     56                                        float weight   = vert.boneweight[j];
    5757                                        const quat& orient      = m_transform[index].get_orientation();
    5858                                        const transform& offset = m_pos_offset[index];
     
    152152                if ( bi != bone_names.end() )
    153153                {
    154                         bone_id = bi->second;
     154                        bone_id = (sint16)bi->second;
    155155                }
    156156                m_bone_ids[n] = bone_id;
  • trunk/src/gl/gl_device.cc

    r319 r323  
    132132        texture result = m_textures.create();
    133133        gl_texture_info* info = m_textures.get( result );
    134         info->format  = aformat;
    135         info->sampler = asampler;
    136         info->size    = size;
    137         info->glid    = glid;
     134        info->format   = aformat;
     135        info->tsampler = asampler;
     136        info->size     = size;
     137        info->glid     = glid;
    138138        return result;
    139139}
  • trunk/src/gl/gl_enum.cc

    r319 r323  
    232232        case BYTE_VECTOR_3  : return GL_INT_VEC3;
    233233        case BYTE_VECTOR_4  : return GL_INT_VEC4;
    234         NV_RETURN_COVERED_DEFAULT( 0 );
     234        default : return 0; // TODO: throw!
    235235        }
    236236}
  • trunk/src/gl/gl_window.cc

    r319 r323  
    1919
    2020#if NV_SDL_VERSION == NV_SDL_20
    21         uint32 ucode = ke.keysym.sym;
    22 #else
    23         uint32 ucode = ke.keysym.unicode;
     21        uint32 ucode = (uint32)ke.keysym.sym;
     22#else
     23        uint32 ucode = (uint32)ke.keysym.unicode;
    2424#endif
    2525
     
    3434                        int capslock = !!(ke.keysym.mod & KMOD_CAPS);
    3535                        if ((shifted ^ capslock) != 0) {
    36                                 kevent.key.ascii = (char8)SDL_toupper(ucode);
     36                                kevent.key.ascii = (char8)SDL_toupper((int)ucode);
    3737                        }
    3838                }
  • trunk/src/lib/gl.cc

    r319 r323  
    1919// for wgl support
    2020#if NV_PLATFORM == NV_WINDOWS
    21 #    ifndef WIN32_LEAN_AND_MEAN
    22 #      define WIN32_LEAN_AND_MEAN 1
    23 #    endif
    2421#include <windows.h>
    25 #    undef WIN32_LEAN_AND_MEAN
    26 #endif
    27 
    28 // extern added for wgl needs only!
    29 #define NV_GL_FUN( rtype, fname, fparams ) extern "C" rtype (NV_GL_APIENTRY *fname) fparams = nullptr;
    30 #define NV_GL_FUN_REN( rtype, fname, rname, fparams ) extern "C" rtype (NV_GL_APIENTRY *rname) fparams = nullptr;
     22#endif
     23
     24#define NV_GL_FUN( rtype, fname, fparams ) rtype (NV_GL_APIENTRY *fname) fparams = nullptr;
     25#define NV_GL_FUN_REN( rtype, fname, rname, fparams ) rtype (NV_GL_APIENTRY *rname) fparams = nullptr;
    3126#define NV_GL_FUN_EXT NV_GL_FUN
    3227#include <nv/lib/detail/gl_functions.inc>
     
    4136static nv::library gl_library;
    4237static nv::gl_extensions gl_loaded_extensions = nv::gl_extensions(0);
    43 extern "C" void* (NV_GL_APIENTRY *gl_ext_loader) ( const char* ) = nullptr;
     38static void* (NV_GL_APIENTRY *gl_ext_loader) ( const char* ) = nullptr;
    4439static bool gl_library_loaded = false;
    4540static bool wgl_library_loaded = false;
     
    5247};
    5348
    54 static const char *gl_extension_ids[] = {
    55         "UNKNOWN",
    56 #define NV_GL_EXTENSION( count, id, name ) #id,
    57 #include <nv/lib/detail/gl_ext/gl_ext_info.inc>
    58 #undef NV_GL_EXTENSION
    59 };
     49// static const char *gl_extension_ids[] = {
     50//      "UNKNOWN",
     51// #define NV_GL_EXTENSION( count, id, name ) #id,
     52// #include <nv/lib/detail/gl_ext/gl_ext_info.inc>
     53// #undef NV_GL_EXTENSION
     54// };
    6055
    6156
     
    184179        wndClass.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
    185180
    186         DWORD err = GetLastError();
     181        /*DWORD err = */GetLastError();
    187182        RegisterClass(&wndClass);
    188         err = GetLastError();
     183        /*err = */GetLastError();
    189184
    190185
     
    235230}
    236231
    237 
    238232bool nv::load_gl_extension( gl_extensions extension )
    239233{
  • 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.