16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-21 21:49:19 +02:00

scenery groups export and deserialization, associated events included in scenery node groups, AI brake charging tweak, door locking and vehicle hunting oscillation sounds

This commit is contained in:
tmj-fstate
2018-08-24 21:11:35 +02:00
parent 24eda2d63f
commit 09f24df109
14 changed files with 304 additions and 118 deletions

View File

@@ -13,14 +13,16 @@ http://mozilla.org/MPL/2.0/.
namespace scene {
struct basic_group {
// members
std::vector<scene::basic_node *> nodes;
std::vector<TEvent *> events;
};
// holds lists of grouped scene nodes
class node_groups {
// NOTE: during scenario deserialization encountering *.inc file causes creation of a new group on the group stack
// this allows all nodes listed in this *.inc file to be grouped and potentially modified together by the editor.
private:
// types
using node_sequence = std::vector<scene::basic_node *>;
public:
// constructors
node_groups() = default;
@@ -37,14 +39,20 @@ public:
// places provided node in specified group
void
insert( scene::group_handle const Group, scene::basic_node *Node );
std::pair<node_sequence::iterator, node_sequence::iterator>
// places provided event in specified group
void
insert( scene::group_handle const Group, TEvent *Event );
// grants direct access to specified group
scene::basic_group &
group( scene::group_handle const Group ) {
auto &group { m_groupmap[ Group ] };
return { std::begin( group ), std::end( group ) }; }
return m_groupmap[ Group ]; }
// sends basic content of the class in legacy (text) format to provided stream
void
export_as_text( std::ostream &Output ) const;
private:
// types
using group_map = std::unordered_map<scene::group_handle, node_sequence>;
using group_map = std::unordered_map<scene::group_handle, scene::basic_group>;
// methods
// removes specified group from the group list and group information from the group's nodes
void