- Timestamp:
- 08/26/14 04:03:10 (11 years ago)
- Location:
- trunk
- Files:
-
- 44 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nv.lua
r321 r323 5 5 includedirs { "." } 6 6 files { "nv/core/**.hh", "nv/interface/**.hh", "nv/detail/**.inc", "src/core/**.cc" } 7 targetname "nv-core"8 7 9 8 project "nv-lib" … … 14 13 files { "nv/lib/**.hh", "nv/lib/**.inl", "nv/lib/**.inc", "src/lib/**.cc" } 15 14 links { "nv-core" } 16 targetname "nv-lib"17 15 18 16 project "nv-curses" … … 23 21 files { "nv/curses/**.hh", "src/curses/**.cc" } 24 22 links { "nv-core", "nv-lib" } 25 targetname "nv-curses"26 23 27 24 project "nv-fmod" … … 32 29 files { "nv/fmod/**.hh", "src/fmod/**.cc" } 33 30 links { "nv-core", "nv-lib" } 34 targetname "nv-fmod"35 31 36 32 project "nv-sdl" … … 41 37 files { "nv/sdl/**.hh", "src/sdl/**.cc" } 42 38 links { "nv-core", "nv-lib" } 43 targetname "nv-sdl"44 39 45 40 project "nv-gl" … … 50 45 files { "nv/gl/**.hh", "src/gl/**.cc" } 51 46 links { "nv-core", "nv-lib" } 52 targetname "nv-gl"53 47 54 48 project "nv-lua" … … 59 53 files { "nv/lua/**.hh", "src/lua/**.cc" } 60 54 links { "nv-core", "nv-lib" } 61 targetname "nv-lua"62 55 63 56 project "nv-rogue" … … 68 61 files { "nv/rogue/**.hh", "src/rogue/**.cc" } 69 62 links { "nv-core" } 70 targetname "nv-rogue"71 63 72 64 project "nv-io" … … 77 69 files { "nv/io/**.hh", "src/io/**.cc" } 78 70 links { "nv-core" } 79 targetname "nv-io"80 71 81 72 project "nv-gfx" … … 86 77 files { "nv/gfx/**.hh", "src/gfx/**.cc" } 87 78 links { "nv-core" } 88 targetname "nv-gfx"89 79 90 80 project "nv-engine" … … 94 84 includedirs { "." } 95 85 files { "nv/engine/**.hh", "src/engine/**.cc" } 96 links { "nv-core", "nv-lua" } 97 targetname "nv-engine" 86 links { "nv-core", "nv-lib", "nv-lua" } 98 87 99 88 project "nv-formats" … … 104 93 files { "nv/formats/**.hh", "src/formats/**.cc" } 105 94 links { "nv-core", "nv-lib", "nv-io", "nv-gfx" } 106 targetname "nv-formats"107 95 108 96 project "nv-gui" … … 112 100 includedirs { "." } 113 101 files { "nv/gui/**.hh", "src/gui/**.cc" } 114 links { "nv-core", "nv-io", "nv-gfx", "nv-lua" } 115 targetname "nv-gui" 116 117 project "nv" 118 location (_ACTION) 119 language "C++" 120 kind "StaticLib" 121 includedirs { "." } 122 links { "nv-core", "nv-lib", "nv-curses", "nv-sdl", "nv-fmod", "nv-lua", "nv-gl", "nv-rogue", "nv-io", "nv-gfx", "nv-engine", "nv-formats", "nv-gui" } 123 targetname "nv" 102 links { "nv-core", "nv-lib", "nv-io", "nv-gfx", "nv-lua" } 124 103 125 104 -- injection! … … 151 130 -- no reasonable way to fix this with abstract 152 131 -- interfaces. 153 "-Wno-weak-vtables" 132 "-Wno-weak-vtables", 133 -- this can be reenabled if I find a nice solution 134 "-Wno-cast-align", 154 135 } 155 136 --buildoptions { … … 159 140 buildoptions { "-std=c++0x" } 160 141 end 142 configuration { "windows", "gmake" } 143 linkoptions { "-mwindows" } 161 144 162 145 configuration "linux" -
trunk/nv/core/array.hh
r319 r323 16 16 #include <nv/core/common.hh> 17 17 #include <vector> 18 #include <algorithm> 18 19 #include <array> 19 20 20 21 namespace nv 21 22 { 22 namespace detail23 {24 template < typename T >25 class array_base26 {27 public:28 typedef T value_type;29 typedef T* iterator;30 typedef const T* const_iterator;31 typedef T& reference;32 typedef const T& const_reference;33 typedef std::size_t size_type;34 typedef std::ptrdiff_t difference_type;35 36 typedef std::reverse_iterator<iterator> reverse_iterator;37 typedef std::reverse_iterator<const_iterator> const_reverse_iterator;38 };39 }40 41 23 using std::vector; 42 24 using std::array; 43 25 44 26 template< class T, std::size_t N > 45 class static_array : public detail::array_base<T>27 class static_array 46 28 { 47 29 public: 30 typedef T value_type; 31 typedef T* iterator; 32 typedef const T* const_iterator; 33 typedef T& reference; 34 typedef const T& const_reference; 35 typedef std::size_t size_type; 36 typedef std::ptrdiff_t difference_type; 37 38 typedef std::reverse_iterator<iterator> reverse_iterator; 39 typedef std::reverse_iterator<const_iterator> const_reverse_iterator; 40 48 41 iterator begin() { return m_data; } 49 42 const_iterator begin() const { return m_data; } … … 99 92 100 93 template< class T > 101 class dynamic_array : public detail::array_base<T>94 class dynamic_array 102 95 { 103 96 public: 97 typedef T value_type; 98 typedef T* iterator; 99 typedef const T* const_iterator; 100 typedef T& reference; 101 typedef const T& const_reference; 102 typedef std::size_t size_type; 103 typedef std::ptrdiff_t difference_type; 104 105 typedef std::reverse_iterator<iterator> reverse_iterator; 106 typedef std::reverse_iterator<const_iterator> const_reverse_iterator; 107 104 108 dynamic_array() 105 109 : m_data( nullptr ), m_size(0) {} -
trunk/nv/core/array2d.hh
r319 r323 337 337 // The end position is either the size limit or the end of either array, whichever is smaller. 338 338 // Destination start is the beginning of the current destination row (which is dest_start_y + i), offset by dest_start_x. 339 std: copy( source.m_data + ( source_start_y + i ) * source.m_size.x + source_start_x, // Source Start339 std::copy( source.m_data + ( source_start_y + i ) * source.m_size.x + source_start_x, // Source Start 340 340 source.m_data + ( source_start_y + i ) * source.m_size.x + min( source.m_size.x, min( source_start_x + size_x, source_start_x + m_size.x - dest_start_x ) ), // Source End 341 341 m_data + (dest_start_y + i) * m_size.x + dest_start_x ); // Destination Start -
trunk/nv/core/handle.hh
r319 r323 42 42 bool is_valid() const { return !is_nil(); } 43 43 T index() const { return m_index; } 44 size_t hash() const { return std::hash<T>()( m_counter << IBITS | m_index); }44 size_t hash() const { return std::hash<T>()( T( m_counter << IBITS | m_index ) ); } 45 45 protected: 46 46 T m_index : IBITS; … … 81 81 return; 82 82 } 83 m_entries[ m_last_free ].next_free = h.m_index;83 m_entries[ (unsigned)m_last_free ].next_free = h.m_index; 84 84 m_last_free = h.m_index; 85 85 } … … 145 145 T* insert( handle h ) 146 146 { 147 resize_indexes_to( h.index() );148 m_indexes[ h.index() ] = m_data.size();147 resize_indexes_to( (index_type) h.index() ); 148 m_indexes[ h.index() ] = (index_type) m_data.size(); 149 149 m_handles.push_back( h ); 150 150 m_data.emplace_back(); … … 162 162 if ( h.is_nil() || h.index() >= m_indexes.size() ) return nullptr; 163 163 index_type i = m_indexes[ h.index() ]; 164 return i >= 0 ? &(m_data[ i ]) : nullptr;164 return i >= 0 ? &(m_data[ (unsigned)i ]) : nullptr; 165 165 } 166 166 … … 171 171 if ( dead_eindex != (sint32)m_data.size()-1 ) 172 172 { 173 m_data[ dead_eindex ]= m_data.back();174 m_handles[ dead_eindex ]= swap_handle;175 m_indexes[ swap_handle.index() ] = dead_eindex;173 m_data[ (unsigned)dead_eindex ] = m_data.back(); 174 m_handles[ (unsigned)dead_eindex ] = swap_handle; 175 m_indexes[ swap_handle.index() ] = dead_eindex; 176 176 } 177 177 m_data.pop_back(); … … 207 207 if ( size == 0 ) size = 1; 208 208 while ( i >= size ) size = size * 2; 209 m_indexes.resize( size, -1 );209 m_indexes.resize( (size_t)size, -1 ); 210 210 } 211 211 } … … 249 249 if ( h.is_nil() ) return nullptr; 250 250 sint32 eindex = m_indexes.get_index( h ); 251 return eindex >= 0 ? &(m_data[ eindex ]) : nullptr;251 return eindex >= 0 ? &(m_data[ (unsigned)eindex ]) : nullptr; 252 252 } 253 253 … … 256 256 if ( h.is_nil() ) return nullptr; 257 257 sint32 eindex = m_indexes.get_index( h ); 258 return eindex >= 0 ? &(m_data[ eindex ]) : nullptr;258 return eindex >= 0 ? &(m_data[ (unsigned)eindex ]) : nullptr; 259 259 } 260 260 … … 265 265 if ( dead_eindex != (sint32)m_data.size()-1 ) 266 266 { 267 m_data[ dead_eindex ] = m_data.back();268 m_handles[ dead_eindex ] = m_handles.back();267 m_data[ (unsigned)dead_eindex ] = m_data.back(); 268 m_handles[ (unsigned)dead_eindex ] = m_handles.back(); 269 269 } 270 270 m_data.pop_back(); … … 274 274 } 275 275 276 handle get_handle( index_type i ) const { return m_handles[ i]; }277 const value_type& operator[] ( index_type i ) const { return m_data[ i]; }278 value_type& operator[] ( index_type i ) { return m_data[ i]; }276 handle get_handle( index_type i ) const { return m_handles[(unsigned)i]; } 277 const value_type& operator[] ( index_type i ) const { return m_data[(unsigned)i]; } 278 value_type& operator[] ( index_type i ) { return m_data[(unsigned)i]; } 279 279 size_t size() const { return m_data.size(); } 280 280 -
trunk/nv/core/range.hh
r319 r323 47 47 { 48 48 public: 49 range_iterator_base( T value ) : forward_iterator_base( value ) {} 49 typedef forward_iterator_base< T > base_class; 50 51 range_iterator_base( T value ) : forward_iterator_base<T>( value ) {} 50 52 range_iterator_base& operator++ () 51 53 { 52 ++ m_value;54 ++base_class::m_value; 53 55 return *this; 54 56 } … … 66 68 { 67 69 public: 70 typedef forward_iterator_base< glm::detail::tvec2<T> > base_class; 71 68 72 range2d_iterator_base( glm::detail::tvec2<T> value, T min, T max ) 69 : forward_iterator_base ( value ), m_min(min), m_max(max) {}73 : forward_iterator_base< glm::detail::tvec2<T> >( value ), m_min(min), m_max(max) {} 70 74 range2d_iterator_base& operator++ () 71 75 { 72 ++ m_value.x;73 if ( m_value.x > m_max )76 ++base_class::m_value.x; 77 if ( base_class::m_value.x > m_max ) 74 78 { 75 ++ m_value.y;76 m_value.x = m_min;79 ++base_class::m_value.y; 80 base_class::m_value.x = m_min; 77 81 } 78 82 return *this; … … 94 98 public: 95 99 typedef typename base_underlying_type<T>::type base_type; 100 typedef forward_iterator_base< T > base_class; 101 96 102 static const T invalid = T( 0 ); 97 103 98 bits_iterator_base( T value, T current ) : forward_iterator_base ( current ), m_full( value )104 bits_iterator_base( T value, T current ) : forward_iterator_base<T>( current ), m_full( value ) 99 105 { 100 106 if( !( (base_type)value & (base_type)current ) ) … … 117 123 do 118 124 { 119 if ( m_value == invalid || m_full <= m_value ) {m_value = invalid; m_full = invalid; break; }120 m_value = T((base_type)m_value << 1);121 } while ( !( (base_type)m_full & (base_type) m_value ) );125 if ( base_class::m_value == invalid || m_full <= base_class::m_value ) { base_class::m_value = invalid; m_full = invalid; break; } 126 base_class::m_value = T((base_type)base_class::m_value << 1); 127 } while ( !( (base_type)m_full & (base_type)base_class::m_value ) ); 122 128 } 123 129 … … 213 219 auto index( const C& c ) -> range_iterator_provider<decltype( c.size() )> 214 220 { 215 return range_iterator_provider ( 0, c.size() );221 return range_iterator_provider<decltype( c.size() )>( 0, c.size() ); 216 222 } 217 223 -
trunk/nv/core/time.hh
r319 r323 115 115 typedef typename Timer::value_type value_type; 116 116 117 fps_counter_class() : frames(1), last(0) {}117 fps_counter_class() : m_frames(1), m_last(0), m_value(0.0f) {} 118 118 bool tick() 119 119 { 120 120 value_type now = Timer()(); 121 if ( now - last >= Timer::second )121 if ( now - m_last >= Timer::second ) 122 122 { 123 value = (static_cast<float>(frames) /124 static_cast<float>(now - last))*Timer::second;125 frames = 1;126 last = now;123 m_value = (static_cast<float>(m_frames) / 124 static_cast<float>(now - m_last))*Timer::second; 125 m_frames = 1; 126 m_last = now; 127 127 return true; 128 128 } 129 frames++;129 m_frames++; 130 130 return false; 131 131 } 132 132 f32 fps() const 133 133 { 134 return value;134 return m_value; 135 135 } 136 136 private: 137 value_type last;138 uint32 frames;139 f32 value;137 uint32 m_frames; 138 value_type m_last; 139 f32 m_value; 140 140 }; 141 141 -
trunk/nv/core/uid.hh
r319 r323 84 84 public: 85 85 T* get( uid auid ) const { return static_cast<T*>( m_store.get( auid ) ); } 86 bool remove( uid auid ) { m_store.remove( auid ); }86 bool remove( uid auid ) { return m_store.remove( auid ); } 87 87 void insert( T* o, uid auid ) { m_store.insert( o, auid ); } 88 88 uid insert( T* o ) { return m_store.insert( o ); } … … 92 92 * Retrieves an object and casts it to the specified type. 93 93 * 94 * @tparam TThe type to cast to.94 * @tparam U The type to cast to. 95 95 * @param auid The ID the object is stored under. 96 96 * @returns An object of the indicated type that was stored at the indicated ID. -
trunk/nv/curses/curses_terminal.hh
r319 r323 71 71 * Virtual destructor 72 72 */ 73 virtual ~curses_terminal(); ;73 virtual ~curses_terminal(); 74 74 75 75 protected: -
trunk/nv/engine/particle_engine.hh
r320 r323 19 19 namespace nv 20 20 { 21 static const intMAX_PARTICLE_EMMITERS = 8;22 static const intMAX_PARTICLE_AFFECTORS = 8;21 static const unsigned MAX_PARTICLE_EMMITERS = 8; 22 static const unsigned MAX_PARTICLE_AFFECTORS = 8; 23 23 24 24 struct particle_emmiter_data; -
trunk/nv/engine/resource_system.hh
r319 r323 37 37 void load_all(); 38 38 resource_id load_resource( const std::string& id ); 39 virtual ~resource_manager_base() {} 39 40 protected: 40 41 virtual resource_id load_resource( lua::table_guard& table ) = 0; -
trunk/nv/formats/md5_loader.hh
r319 r323 52 52 enum file_type { UNKNOWN, MESH, ANIMATION }; 53 53 54 md5_loader() : m_ nodes( nullptr ), m_type( UNKNOWN) {}54 md5_loader() : m_type( UNKNOWN ), m_nodes( nullptr ) {} 55 55 virtual ~md5_loader(); 56 56 virtual bool load( stream& source ); -
trunk/nv/gfx/animation.hh
r319 r323 86 86 return keyfresult; 87 87 } 88 for ( int i = 1 ; i < (int)count ; i++ )88 for ( unsigned i = 1 ; i < count ; i++ ) 89 89 { 90 if ( time < fdata[ i * keyfsize ] ) { index0 = i - 1; break; }90 if ( time < fdata[ i * keyfsize ] ) { index0 = (int)i - 1; break; } 91 91 } 92 92 NV_ASSERT( index0 >= 0, "animation time fail!"); 93 93 index1 = index0 + 1; 94 float time0 = fdata[ index0 * keyfsize ];95 float time1 = fdata[ index1 * keyfsize ];94 float time0 = fdata[ index0 * (int)keyfsize ]; 95 float time1 = fdata[ index1 * (int)keyfsize ]; 96 96 float delta = time1 - time0; 97 97 factor = glm::clamp( (time - time0) / delta, 0.0f, 1.0f ); … … 104 104 return keyfresult; 105 105 } 106 index0 = glm::clamp<int>( int( time ), 0,count - 2 );106 index0 = glm::clamp<int>( (int) time, 0, (int)count - 2 ); 107 107 index1 = index0 + 1; 108 108 factor = glm::clamp<float> ( time - index0, 0.0f, 1.0f ); … … 113 113 ret += nv::interpolate_raw( 114 114 desc.slots[slot], factor, 115 fdata + index0 * keyfsize + desc.slots[slot].offset / 4,116 fdata + index1 * keyfsize + desc.slots[slot].offset / 4,115 fdata + index0 * (int)keyfsize + desc.slots[slot].offset / 4, 116 fdata + index1 * (int)keyfsize + desc.slots[slot].offset / 4, 117 117 result + ret ); 118 118 } … … 154 154 } 155 155 return extract_matrix_raw( m_final_key, key ); 156 } ;156 } 157 157 158 158 transform get_raw_transform( uint32 index ) const … … 165 165 } 166 166 return extract_transform_raw( m_final_key, key ); 167 } ;167 } 168 168 169 169 mat4 get_matrix( float time ) const … … 176 176 } 177 177 return extract_matrix_raw( m_final_key, key ); 178 } ;178 } 179 179 180 180 transform get_transform( float time ) const … … 187 187 } 188 188 return extract_transform_raw( m_final_key, key ); 189 } ;189 } 190 190 191 191 size_t get_channel_count() const { return m_channels.size(); } -
trunk/nv/gfx/keyframed_mesh.hh
r319 r323 48 48 }; 49 49 50 context* m_context; 51 50 52 const mesh_data* m_mesh_data; 51 53 const mesh_nodes_data* m_tag_map; 52 54 const mesh_raw_channel* m_vchannel; 53 55 54 context* m_context;55 56 buffer m_pbuffer; 56 57 vertex_array m_va; -
trunk/nv/gfx/skeletal_mesh.hh
r319 r323 58 58 dynamic_array< transform > m_pos_offset; 59 59 dynamic_array< transform > m_bone_offset; 60 ; 60 61 61 const mesh_data* m_data; 62 62 const md5_vtx_pntiw* m_vtx_data; -
trunk/nv/gfx/sliced_buffer.hh
r319 r323 205 205 context* m_context; 206 206 buffer m_buffer; 207 buffer_type m_type; 207 208 buffer_hint m_hint; 208 buffer_type m_type;209 209 bool m_full_update; 210 210 vector m_data; -
trunk/nv/interface/animation_key.hh
r319 r323 47 47 template<typename C> static char (&test(...))[2]; 48 48 public: 49 static bool const value = sizeof(test<derived>(0)) == 2; ;49 static bool const value = sizeof(test<derived>(0)) == 2; 50 50 }; 51 51 … … 60 60 template<typename C> static char (&test(...))[2]; 61 61 public: 62 static bool const value = sizeof(test<derived>(0)) == 2; ;62 static bool const value = sizeof(test<derived>(0)) == 2; 63 63 }; 64 64 … … 73 73 template<typename C> static char (&test(...))[2]; 74 74 public: 75 static bool const value = sizeof(test<derived>(0)) == 2; ;75 static bool const value = sizeof(test<derived>(0)) == 2; 76 76 }; 77 77 … … 86 86 template<typename C> static char (&test(...))[2]; 87 87 public: 88 static bool const value = sizeof(test<derived>(0)) == 2; ;88 static bool const value = sizeof(test<derived>(0)) == 2; 89 89 }; 90 90 … … 99 99 template<typename C> static char (&test(...))[2]; 100 100 public: 101 static bool const value = sizeof(test<derived>(0)) == 2; ;101 static bool const value = sizeof(test<derived>(0)) == 2; 102 102 }; 103 103 … … 193 193 struct key_descriptor 194 194 { 195 key_descriptor_slot slots[ animation_slot::SLOT_MAX_STORE ];195 key_descriptor_slot slots[ (uint16)animation_slot::SLOT_MAX_STORE ]; 196 196 uint32 count; 197 197 uint32 size; -
trunk/nv/interface/context.hh
r319 r323 116 116 typedef vertex_slot_info< VTX, SLOT > vinfo; 117 117 typedef datatype_traits< typename vinfo::value_type > dt_traits; 118 add_vertex_buffer( va, SLOT, vb, type_to_enum< dt_traits::base_type >::type, dt_traits::size, vinfo::offset, sizeof( VTX ), false );118 add_vertex_buffer( va, SLOT, vb, type_to_enum< typename dt_traits::base_type >::type, dt_traits::size, vinfo::offset, sizeof( VTX ), false ); 119 119 } 120 120 … … 168 168 vertex_array va = create_vertex_array( v, vcount, hint ); 169 169 buffer ib = create_buffer( INDEX_BUFFER, hint, icount * sizeof( IDX ), i ); 170 va->set_index_buffer(ib, type_to_enum< IDX >::type, true );170 set_index_buffer( va, ib, type_to_enum< IDX >::type, true ); 171 171 return va; 172 172 } … … 247 247 if ( info ) 248 248 { 249 NV_ASSERT( info->count < vertex_array_info::MAX_ATTRIBUTES, "MAX_ATTRIBUTES reached!" );249 NV_ASSERT( info->count < (uint16)vertex_array_info::MAX_ATTRIBUTES, "MAX_ATTRIBUTES reached!" ); 250 250 vertex_buffer_attribute& p = info->attr[ info->count ]; 251 251 p.vbuffer = buf; -
trunk/nv/interface/device.hh
r319 r323 101 101 ivec2 size; 102 102 image_format format; 103 sampler sampler;103 sampler tsampler; 104 104 }; 105 105 … … 173 173 174 174 template < typename T > 175 void set_uniform_array( const string& name, const std::vector<T>& value )176 {177 set_uniform_array( program p, name, (const T*)value.data(), value.size() );178 }179 180 template < typename T >181 175 void set_opt_uniform_array( program p, const string& name, const T* value, uint32 count ) 182 176 { -
trunk/nv/interface/interpolation_template.hh
r319 r323 41 41 { 42 42 template < typename T > 43 mat4 extract_matrix_slot( const T& ) { static_assert( false, "extract_matrix_slot"); }43 mat4 extract_matrix_slot( const T& ) { static_assert( sizeof( T ) == 0, "extract_matrix_slot" ); return mat4(); } 44 44 template <> inline mat4 extract_matrix_slot( const mat4& m ) { return m; } 45 45 template <> inline mat4 extract_matrix_slot( const transform& m ) { return m.extract(); } 46 46 47 47 template < typename T > 48 transform extract_transfrom_slot( const T& ) { static_assert( false, "extract_matrix_slot"); }48 transform extract_transfrom_slot( const T& ) { static_assert( sizeof( T ) == 0, "extract_matrix_slot" ); return transform(); } 49 49 template <> inline transform extract_transfrom_slot( const mat4& m ) { return transform(m); } 50 50 template <> inline transform extract_transfrom_slot( const transform& m ) { return m; } … … 85 85 86 86 template < typename KEY > 87 mat4 extract_matrix_prs( const KEY& k, const std::false_type&, const std::false_type&, const std::false_type& )87 mat4 extract_matrix_prs( const KEY&, const std::false_type&, const std::false_type&, const std::false_type& ) 88 88 { return mat4(); } 89 89 template < typename KEY > … … 111 111 112 112 template < typename KEY > 113 transform extract_transform_pr_impl( const KEY& k, const std::false_type&, const std::false_type& ) { return transform(); }113 transform extract_transform_pr_impl( const KEY&, const std::false_type&, const std::false_type& ) { return transform(); } 114 114 template < typename KEY > 115 115 transform extract_transform_pr_impl( const KEY& k, const std::true_type&, const std::true_type& ) { return transform( k.position, k.rotation ); } -
trunk/nv/interface/map_area.hh
r319 r323 35 35 virtual bool is_visible( const position& ) const { return true; } 36 36 virtual bool is_explored( const position& ) const { return true; } 37 virtual void set_visible( const position&, bool ) {} ;38 virtual bool is_transparent( const position& ) const { return true; } ;37 virtual void set_visible( const position&, bool ) {} 38 virtual bool is_transparent( const position& ) const { return true; } 39 39 virtual ~map_area(){} 40 40 }; -
trunk/nv/interface/mesh_data.hh
r319 r323 137 137 if ( ch->desc.slots[i].vslot == s ) 138 138 { 139 return c;139 return (int)c; 140 140 } 141 141 } -
trunk/nv/interface/terminal.hh
r319 r323 25 25 * Constructor 26 26 */ 27 terminal( dimension size ) : m_ size( size ), m_cursor(1,1) {}27 terminal( dimension size ) : m_cursor(1,1), m_size( size ) {} 28 28 29 29 /** … … 85 85 * Virtual destructor 86 86 */ 87 virtual ~terminal() {} ;87 virtual ~terminal() {} 88 88 89 89 protected: -
trunk/nv/interface/vertex.hh
r319 r323 65 65 template<typename C> static char (&test(...))[2]; 66 66 public: 67 static bool const value = sizeof(test<derived>(0)) == 2; ;67 static bool const value = sizeof(test<derived>(0)) == 2; 68 68 }; 69 69 … … 238 238 struct vertex_descriptor 239 239 { 240 vertex_descriptor_slot slots[ slot::SLOT_MAX_STORE ];240 vertex_descriptor_slot slots[ (uint16)slot::SLOT_MAX_STORE ]; 241 241 uint32 count; 242 242 uint32 size; -
trunk/nv/io/string_table.hh
r319 r323 27 27 28 28 string_table( char* data, uint32 size, offset* offsets, index count ) 29 : m_ count( count ), m_size( size ), m_data( data ), m_offsets( offsets)29 : m_data( data ), m_size( size ), m_offsets( offsets ), m_count( count ) 30 30 { 31 31 -
trunk/nv/lib/detail/curses_types.inc
r218 r323 25 25 26 26 #ifdef CURSES_CHTYPE_LONG 27 # ifdef _LP64 27 28 # if _LP64 28 29 typedef unsigned int chtype; 30 # else 31 typedef unsigned long chtype; /* 16-bit attr + 16-bit char */ 32 # endif 29 33 # else 30 34 typedef unsigned long chtype; /* 16-bit attr + 16-bit char */ -
trunk/nv/lib/wx.hh
r319 r323 59 59 nv::context* m_context; 60 60 nv::window* m_window; 61 wxTimer* m_update_timer;61 //wxTimer* m_update_timer; 62 62 bool m_render; 63 63 wxDECLARE_EVENT_TABLE(); -
trunk/nv/rogue/fov.hh
r319 r323 25 25 virtual void initialize( map_area*, const dimension& size ) = 0; 26 26 virtual void run( const position& p, uint16 radius ) = 0; 27 27 virtual ~fov_algorithm() {} 28 28 }; 29 29 -
trunk/src/curses/curses_terminal.cc
r319 r323 58 58 if ( color > 7 ) 59 59 { 60 attrset((static_cast<uint32>(color-7) << 24) & 0xff000000ul | 0x00800000ul);60 attrset((static_cast<uint32>(color-7) << 24) & ( 0xff000000ul | 0x00800000ul ) ); 61 61 } 62 62 else -
trunk/src/engine/particle_engine.cc
r320 r323 577 577 case particle_origin::CENTER : break; 578 578 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; 580 580 case particle_origin::TOP_RIGHT : lb = vec2(-1.f,-1.f); rt = vec2(); break; 581 581 case particle_origin::CENTER_LEFT : lb.x = 0.f; rt.x = 1.f; break; … … 663 663 { 664 664 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 ) 666 666 { 667 667 particle& pinfo = info->particles[i]; … … 723 723 { 724 724 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 ); 726 726 float sin_theta = glm::sqrt(1.0f - cos_theta * cos_theta ); 727 727 float phi = r.frange( 0.0f, 2*glm::pi<float>() ); -
trunk/src/engine/program_manager.cc
r319 r323 57 57 for ( uint32 i = 1; i <= count; ++i ) 58 58 { 59 std::string include( inctable.get<std::string, int>(i) );59 std::string include( inctable.get<std::string,uint32>(i) ); 60 60 if ( i == count ) out += "#line 1\n"; 61 61 out += nv::slurp( include ); -
trunk/src/engine/resource_system.cc
r319 r323 29 29 clear(); 30 30 lua::table_guard table( m_lua, get_storage_name() ); 31 uint32 count = table.get_ integer( "__counter" );31 uint32 count = table.get_unsigned( "__counter" ); 32 32 for ( auto i : range( count ) ) 33 33 { -
trunk/src/formats/assimp_loader.cc
r302 r323 14 14 using namespace nv; 15 15 16 const intMAX_BONES = 64;16 const unsigned MAX_BONES = 64; 17 17 18 18 struct assimp_plain_vtx … … 90 90 m_mesh_count = 0; 91 91 NV_LOG( nv::LOG_NOTICE, "AssImp loading file..." ); 92 int size = (int)source.size();92 size_t size = source.size(); 93 93 char* data = new char[ size ]; 94 94 source.read( data, size, 1 ); … … 159 159 if ( v.boneweight[i] <= 0.0f ) 160 160 { 161 v.boneindex[i] =m;161 v.boneindex[i] = (int)m; 162 162 v.boneweight[i] = bone->mWeights[w].mWeight; 163 163 found = true; … … 289 289 for ( unsigned int m = 0; m < m_mesh_count; ++m ) 290 290 { 291 sint16 translate[MAX_BONES];291 uint16 translate[MAX_BONES]; 292 292 std::vector< mesh_node_data > bones; 293 293 const aiMesh* mesh = scene->mMeshes[ m ]; … … 304 304 { 305 305 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(); 307 307 final_bones.push_back( bone ); 308 308 names[ bone.name ] = index; … … 311 311 else 312 312 { 313 translate[b] = (sint16)iname->second;313 translate[b] = iname->second; 314 314 } 315 315 } … … 326 326 if ( vertex.boneweight[i] > 0.0f ) 327 327 { 328 vertex.boneindex[i] = translate[vertex.boneindex[i]];328 vertex.boneindex[i] = (int)translate[vertex.boneindex[i]]; 329 329 } 330 330 } -
trunk/src/formats/md3_loader.cc
r319 r323 234 234 235 235 md3_loader::md3_loader( bool merge_all ) 236 : m_m d3( nullptr ), m_merge_all( merge_all)236 : m_merge_all( merge_all ), m_md3( nullptr ) 237 237 { 238 238 if ( !s_normal_ready ) … … 286 286 { 287 287 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 ); 289 289 // TODO: is this brain damaged in efficiency (loop nest order) or what? 290 290 for ( sint32 f = 0; f < md3->header.num_frames; ++f ) … … 322 322 { 323 323 mesh_data* data = new mesh_data; 324 release_mesh_frame( data, -1, index );324 release_mesh_frame( data, -1, (sint32)index ); 325 325 return data; 326 326 } … … 329 329 { 330 330 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; 338 338 339 339 if ( surface >= 0 ) 340 340 { 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; 343 343 } 344 344 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; 349 349 } 350 350 … … 362 362 while ( surf_count > 0 ) 363 363 { 364 const md3_surface_t& s urface= 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 ); 367 367 368 368 for (uint32 j = 0; j < vcount; ++j ) 369 369 { 370 vtx_t[index++].texcoord = md3_texcoord( s urface.st[j] );370 vtx_t[index++].texcoord = md3_texcoord( sface.st[j] ); 371 371 } 372 372 373 373 for (size_t j = 0; j < tcount; ++j ) 374 374 { 375 const md3_triangle_t& t = s urface.triangles[j];375 const md3_triangle_t& t = sface.triangles[j]; 376 376 icp[iindex++] = static_cast< uint16 >( index_base + t.indexes[0] ); 377 377 icp[iindex++] = static_cast< uint16 >( index_base + t.indexes[1] ); 378 378 icp[iindex++] = static_cast< uint16 >( index_base + t.indexes[2] ); 379 379 } 380 index_base += s urface.header.num_verts;380 index_base += sface.header.num_verts; 381 381 ++current_surf; 382 382 --surf_count; … … 386 386 while ( frame_count > 0 ) 387 387 { 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 ); 390 390 391 391 while ( surf_count > 0 ) 392 392 { 393 md3_surface_t& s urface= 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 ) 398 398 { 399 md3_vertex_t& v = s urface.vertices[j];399 md3_vertex_t& v = sface.vertices[j]; 400 400 vtx_pn[index].position = vec3( v.x * MD3_XYZ_SCALE, v.z * MD3_XYZ_SCALE, v.y * MD3_XYZ_SCALE ); 401 401 vtx_pn[index].normal = s_normal_cache[ v.normal ]; … … 418 418 { 419 419 md3_t* md3 = (md3_t*)m_md3; 420 uint32 node_count = md3->header.num_tags;420 uint32 node_count = (uint32)md3->header.num_tags; 421 421 if ( node_count == 0 ) return nullptr;; 422 422 mesh_node_data* nodes = new mesh_node_data[ node_count ]; … … 451 451 else 452 452 { 453 count = md3->header.num_surfaces;453 count = (uint32)md3->header.num_surfaces; 454 454 data = new mesh_data[ count ]; 455 455 for ( uint32 i = 0; i < count; ++i ) 456 456 { 457 release_mesh_frame( &data[i], -1, i );457 release_mesh_frame( &data[i], -1, (sint32)i ); 458 458 data[i].set_name( (char*)md3->surfaces[i].header.name ); 459 459 } -
trunk/src/formats/md5_loader.cc
r319 r323 135 135 mesh_data* mesh = new mesh_data("md5_mesh"); 136 136 137 intnum_verts = 0;138 intnum_tris = 0;139 intnum_weights = 0;137 uint32 num_verts = 0; 138 uint32 num_tris = 0; 139 uint32 num_weights = 0; 140 140 141 141 discard( sstream, "{" ); … … 170 170 next_line( sstream ); 171 171 std::string line; 172 for ( inti = 0; i < num_verts; ++i )172 for ( uint32 i = 0; i < num_verts; ++i ) 173 173 { 174 174 size_t weight_count; … … 194 194 next_line( sstream ); 195 195 std::string line; 196 for ( inti = 0; i < num_tris; ++i )196 for ( uint32 i = 0; i < num_tris; ++i ) 197 197 { 198 198 size_t ti0; … … 214 214 next_line( sstream ); 215 215 std::string line; 216 for ( inti = 0; i < num_weights; ++i )216 for ( uint32 i = 0; i < num_weights; ++i ) 217 217 { 218 218 md5_weight weight; … … 368 368 if ( j < weight_count ) 369 369 { 370 vdata.boneindex[j] = weights[start_weight + j].joint_id;370 vdata.boneindex[j] = (int)weights[start_weight + j].joint_id; 371 371 vdata.boneweight[j] = weights[start_weight + j].bias; 372 372 } -
trunk/src/formats/nmd_loader.cc
r319 r323 242 242 243 243 nmd_node_header nheader; 244 nheader.parent_id = (uint16)node->parent_id;244 nheader.parent_id = node->parent_id; 245 245 nheader.transform = node->transform; 246 246 stream_out.write( &nheader, sizeof( nheader ), 1 ); -
trunk/src/gfx/image.cc
r319 r323 89 89 fill( r, 255 ); 90 90 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; 93 93 94 uint32 rsizex = static_cast< uint32 >( r.size.x ); 95 uint32 rsizey = static_cast< uint32 >( r.size.y ); 94 96 const uint8* data = idata->get_data(); 95 si nt32depth = 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; 97 99 98 for( int y = 0; y < r.size.y; ++y )100 for( uint32 y = 0; y < rsizey; ++y ) 99 101 { 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 ) 102 104 { 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 ) 105 107 { 106 108 m_data[ xy + e ] = data[ y*dstride + x * depth + e ]; -
trunk/src/gfx/mesh_creator.cc
r302 r323 128 128 const vertex_descriptor& desc = channel->desc; 129 129 uint8* raw_data = channel->data; 130 intvtx_size = desc.size;130 uint32 vtx_size = desc.size; 131 131 int p_offset = -1; 132 132 int n_offset = -1; … … 135 135 switch ( desc.slots[i].vslot ) 136 136 { 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; 140 140 default : break; 141 141 } … … 173 173 size_t n_offset = 0; 174 174 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 ]; 176 176 for ( uint32 i = 0; i < channel->desc.count; ++i ) 177 177 if ( channel->desc.slots[i].vslot == slot::NORMAL ) … … 211 211 if ( desc.slots[i].etype == FLOAT_VECTOR_3 ) 212 212 { 213 p_offset = desc.slots[i].offset;213 p_offset = (int)desc.slots[i].offset; 214 214 p_channel = channel; 215 215 } … … 217 217 case slot::NORMAL : if ( desc.slots[i].etype == FLOAT_VECTOR_3 ) 218 218 { 219 n_offset = desc.slots[i].offset;219 n_offset = (int)desc.slots[i].offset; 220 220 n_channel = m_data->m_channels[ c ]; 221 221 n_channel_index = c; … … 224 224 case slot::TEXCOORD : if ( desc.slots[i].etype == FLOAT_VECTOR_2 ) 225 225 { 226 t_offset = desc.slots[i].offset;226 t_offset = (int)desc.slots[i].offset; 227 227 t_channel = channel; 228 228 } … … 420 420 int och_ti = other->get_channel_index( slot::TEXCOORD ); 421 421 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; 426 426 if ( count % size != 0 || ocount % osize != 0 ) return; 427 427 if ( count / size != ocount / osize ) return; -
trunk/src/gfx/skeletal_mesh.cc
r319 r323 53 53 for ( size_t j = 0; j < 4; ++j ) 54 54 { 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]; 57 57 const quat& orient = m_transform[index].get_orientation(); 58 58 const transform& offset = m_pos_offset[index]; … … 152 152 if ( bi != bone_names.end() ) 153 153 { 154 bone_id = bi->second;154 bone_id = (sint16)bi->second; 155 155 } 156 156 m_bone_ids[n] = bone_id; -
trunk/src/gl/gl_device.cc
r319 r323 132 132 texture result = m_textures.create(); 133 133 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; 138 138 return result; 139 139 } -
trunk/src/gl/gl_enum.cc
r319 r323 232 232 case BYTE_VECTOR_3 : return GL_INT_VEC3; 233 233 case BYTE_VECTOR_4 : return GL_INT_VEC4; 234 NV_RETURN_COVERED_DEFAULT( 0 );234 default : return 0; // TODO: throw! 235 235 } 236 236 } -
trunk/src/gl/gl_window.cc
r319 r323 19 19 20 20 #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; 24 24 #endif 25 25 … … 34 34 int capslock = !!(ke.keysym.mod & KMOD_CAPS); 35 35 if ((shifted ^ capslock) != 0) { 36 kevent.key.ascii = (char8)SDL_toupper( ucode);36 kevent.key.ascii = (char8)SDL_toupper((int)ucode); 37 37 } 38 38 } -
trunk/src/lib/gl.cc
r319 r323 19 19 // for wgl support 20 20 #if NV_PLATFORM == NV_WINDOWS 21 # ifndef WIN32_LEAN_AND_MEAN22 # define WIN32_LEAN_AND_MEAN 123 # endif24 21 #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; 31 26 #define NV_GL_FUN_EXT NV_GL_FUN 32 27 #include <nv/lib/detail/gl_functions.inc> … … 41 36 static nv::library gl_library; 42 37 static nv::gl_extensions gl_loaded_extensions = nv::gl_extensions(0); 43 extern "C"void* (NV_GL_APIENTRY *gl_ext_loader) ( const char* ) = nullptr;38 static void* (NV_GL_APIENTRY *gl_ext_loader) ( const char* ) = nullptr; 44 39 static bool gl_library_loaded = false; 45 40 static bool wgl_library_loaded = false; … … 52 47 }; 53 48 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_EXTENSION59 };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 // }; 60 55 61 56 … … 184 179 wndClass.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; 185 180 186 DWORD err =GetLastError();181 /*DWORD err = */GetLastError(); 187 182 RegisterClass(&wndClass); 188 err =GetLastError();183 /*err = */GetLastError(); 189 184 190 185 … … 235 230 } 236 231 237 238 232 bool nv::load_gl_extension( gl_extensions extension ) 239 233 { -
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.