- Timestamp:
- 07/21/15 13:31:23 (10 years ago)
- Location:
- trunk/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/engine/resource_system.cc
r399 r431 15 15 } 16 16 17 nv::resource_id nv::resource_manager_base::load_resource( const st d::string& id )17 nv::resource_id nv::resource_manager_base::load_resource( const string_view& id ) 18 18 { 19 19 lua::table_guard table( m_lua, lua::path( get_storage_name(), id ) ); … … 32 32 lua::table_guard sub_table( table, i+1 ); 33 33 resource_id rid = load_resource( sub_table ); 34 if ( rid != 0 ) m_names[ sub_table.get_st d_string("id") ] = rid;34 if ( rid != 0 ) m_names[ sub_table.get_string_hash_64("id") ] = rid; 35 35 } 36 36 } 37 37 38 nv::resource_type_id nv::resource_system::register_resource_type( const st d::string& /*name*/, resource_manager_base* /*manager*/ )38 nv::resource_type_id nv::resource_system::register_resource_type( const string_view& /*name*/, resource_manager_base* /*manager*/ ) 39 39 { 40 40 return 0; 41 41 } 42 42 43 nv::resource_type_id nv::resource_system::get_resource_type_id( const st d::string& /*name*/ ) const43 nv::resource_type_id nv::resource_system::get_resource_type_id( const string_view& /*name*/ ) const 44 44 { 45 45 return 0; -
trunk/src/formats/assimp_loader.cc
r428 r431 288 288 const aiScene* scene = reinterpret_cast<const aiScene*>( m_scene ); 289 289 mesh_nodes_data* result = new mesh_nodes_data( make_name( "bones" ) ); 290 unordered_map< uint64, uint16 > names;290 hashed_table< shash64, uint16 > names; 291 291 for ( unsigned int m = 0; m < m_mesh_count; ++m ) 292 292 { -
trunk/src/formats/md3_loader.cc
r427 r431 420 420 uint32 node_count = uint32( md3->header.num_tags ); 421 421 if ( node_count == 0 ) return nullptr; 422 mesh_nodes_data* result = new mesh_nodes_data( m_strings ? m_strings->insert( "tags" ) : 0);422 mesh_nodes_data* result = new mesh_nodes_data( m_strings ? m_strings->insert( "tags" ) : shash64() ); 423 423 for ( uint32 i = 0; i < node_count; ++i ) 424 424 { -
trunk/src/formats/nmd_loader.cc
r428 r431 233 233 sheader.children = 0; 234 234 sheader.size = strings.dump_size(); 235 sheader.name = 0;235 sheader.name = shash64(); 236 236 sheader.parent_id = -1; 237 237 sheader.attributes = 0; -
trunk/src/gfx/skeletal_mesh.cc
r430 r431 177 177 { 178 178 const data_channel_set* bone = (*bones)[ bi ]; 179 bone_names[ bone->get_name() ] = bi;179 bone_names[ bone->get_name().value() ] = bi; 180 180 m_offsets[bi] = bone->get_transform(); 181 181 } … … 186 186 sint16 bone_id = -1; 187 187 188 auto bi = bone_names.find( node->get_name() );188 auto bi = bone_names.find( node->get_name().value() ); 189 189 if ( bi != bone_names.end() ) 190 190 { -
trunk/src/lua/lua_map_area.cc
r406 r431 137 137 { 138 138 nv::map_area* ma = to_map_area( L, 1 ); 139 lua_pushstring( L, ma->id_to_string( ma->get_cell( to_coord( L, 2 ) ) ).c_str() ); 139 nv::string_view result( ma->id_to_string( ma->get_cell( to_coord( L, 2 ) ) ) ); 140 lua_pushlstring( L, result.data(), result.size() ); 140 141 return 1; 141 142 } -
trunk/src/lua/lua_state.cc
r426 r431 184 184 } 185 185 186 uint64 nv::lua::table_guard::get_string_hash_64( string_view element, uint64 defval /*= 0 */ )186 shash64 nv::lua::table_guard::get_string_hash_64( string_view element, uint64 defval /*= 0 */ ) 187 187 { 188 188 lua_getfield( m_state, -1, element.data() ); … … 196 196 } 197 197 lua_pop( m_state, 1 ); 198 return result; 198 return shash64( result ); 199 } 200 201 shash64 nv::lua::table_guard::get_string( string_view element, string_table& table, uint64 defval /*= 0 */ ) 202 { 203 lua_getfield( m_state, -1, element.data() ); 204 size_t l = 0; 205 const char* str = nullptr; 206 uint64 result = defval; 207 if ( lua_type( m_state, -1 ) == LUA_TSTRING ) 208 { 209 str = lua_tolstring( m_state, -1, &l ); 210 result = table.insert( string_view( str, l ) ).value(); 211 } 212 lua_pop( m_state, 1 ); 213 return shash64( result ); 199 214 } 200 215
Note: See TracChangeset
for help on using the changeset viewer.