mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
partially fix static sounds
This commit is contained in:
@@ -1449,7 +1449,7 @@ event_manager::InitEvents() {
|
||||
}
|
||||
case tp_Sound: {
|
||||
// odtworzenie dźwięku
|
||||
auto *sound = sound_man->create_sound(event->asNodeName);
|
||||
auto *sound = simulation::Sounds.find( event->asNodeName );
|
||||
if( sound != nullptr )
|
||||
event->Params[ 9 ].tsTextSound = sound;
|
||||
else
|
||||
|
||||
7
Names.h
7
Names.h
@@ -23,9 +23,8 @@ public:
|
||||
// methods
|
||||
// adds provided item to the collection. returns: true if there's no duplicate with the same name, false otherwise
|
||||
bool
|
||||
insert( Type_ *Item ) {
|
||||
insert( Type_ *Item, std::string itemname ) {
|
||||
m_items.emplace_back( Item );
|
||||
auto const itemname = Item->name();
|
||||
if( ( true == itemname.empty() ) || ( itemname == "none" ) ) {
|
||||
return true;
|
||||
}
|
||||
@@ -38,6 +37,10 @@ public:
|
||||
// cell with this name already exists; update mapping to point to the new one, for backward compatibility
|
||||
mapping.first->second = itemhandle;
|
||||
return false; }
|
||||
bool insert (Type_ *Item)
|
||||
{
|
||||
return insert(Item, Item->name());
|
||||
}
|
||||
// locates item with specified name. returns pointer to the item, or nullptr
|
||||
Type_ *
|
||||
find( std::string const &Name ) {
|
||||
|
||||
@@ -25,6 +25,7 @@ powergridsource_table Powergrid;
|
||||
instance_table Instances;
|
||||
vehicle_table Vehicles;
|
||||
light_array Lights;
|
||||
sound_table Sounds;
|
||||
lua Lua;
|
||||
|
||||
scene::basic_region *Region { nullptr };
|
||||
@@ -465,9 +466,11 @@ state_manager::deserialize_node( cParser &Input, scene::scratch_data &Scratchpad
|
||||
simulation::Region->insert_launcher( eventlauncher, Scratchpad );
|
||||
}
|
||||
}
|
||||
else if( nodedata.type == "sound" ) {
|
||||
|
||||
else if( nodedata.type == "sound" )
|
||||
{
|
||||
auto *sound { deserialize_sound( Input, Scratchpad, nodedata ) };
|
||||
if( false == simulation::Sounds.insert( sound, nodedata.name ) )
|
||||
ErrorLog( "Bad scenario: sound node with duplicate name \"" + nodedata.name + "\" encountered in file \"" + Input.Name() + "\" (line " + std::to_string( inputline ) + ")" );
|
||||
simulation::Region->insert_sound( sound, Scratchpad );
|
||||
}
|
||||
|
||||
|
||||
@@ -74,6 +74,10 @@ private:
|
||||
glm::dvec3 transform( glm::dvec3 Location, scene::scratch_data const &Scratchpad );
|
||||
};
|
||||
|
||||
class sound_table : public basic_table<sound>
|
||||
{
|
||||
};
|
||||
|
||||
extern state_manager State;
|
||||
extern event_manager Events;
|
||||
extern memory_table Memory;
|
||||
@@ -83,6 +87,7 @@ extern powergridsource_table Powergrid;
|
||||
extern instance_table Instances;
|
||||
extern vehicle_table Vehicles;
|
||||
extern light_array Lights;
|
||||
extern sound_table Sounds;
|
||||
extern lua Lua;
|
||||
|
||||
extern scene::basic_region *Region;
|
||||
|
||||
Reference in New Issue
Block a user