aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/misc/SongChance.hpp
blob: dc7d929f759f780ec6a4c18cc07dc068b982eac0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#pragma once

#include "openvic-simulation/types/IdentifierRegistry.hpp"
#include "openvic-simulation/scripts/ConditionalWeight.hpp"

namespace OpenVic {
   /*For music/Songs.txt if it exists*/
   struct SongChanceManager;

   struct SongChance : HasIdentifier {
      friend struct SongChanceManager;

   private:
      std::string PROPERTY(file_name);
      ConditionalWeight PROPERTY(chance);

      SongChance(size_t new_index, std::string_view new_filename, ConditionalWeight&& new_chance);

      bool parse_scripts(DefinitionManager const& definition_manager);

   public:
      SongChance(SongChance&&) = default;
   };

   struct SongChanceManager {
   private:
      IdentifierRegistry<SongChance> IDENTIFIER_REGISTRY(song_chance);
      //Songs.txt
   public:
      bool load_songs_file(ast::NodeCPtr root);
      bool parse_scripts(DefinitionManager const& definition_manager);
   };
}