diff options
Diffstat (limited to 'src/openvic-simulation/misc/SongChance.cpp')
-rw-r--r-- | src/openvic-simulation/misc/SongChance.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/openvic-simulation/misc/SongChance.cpp b/src/openvic-simulation/misc/SongChance.cpp index 4a99362..94fb571 100644 --- a/src/openvic-simulation/misc/SongChance.cpp +++ b/src/openvic-simulation/misc/SongChance.cpp @@ -3,18 +3,16 @@ using namespace OpenVic; using namespace OpenVic::NodeTools; -SongChance::SongChance(size_t new_index, std::string_view new_filename, ConditionalWeight&& new_chance): -HasIdentifier { std::to_string(new_index) }, -file_name { new_filename }, -chance { std::move(new_chance) } -{} +SongChance::SongChance( + size_t new_index, std::string_view new_filename, ConditionalWeight&& new_chance +) : HasIdentifier { std::to_string(new_index) }, file_name { new_filename }, chance { std::move(new_chance) } {} bool SongChance::parse_scripts(DefinitionManager const& definition_manager) { return chance.parse_scripts(definition_manager); } bool SongChanceManager::load_songs_file(ast::NodeCPtr root) { - bool ret = true; + bool ret = true; ret &= expect_dictionary_reserve_length( song_chances, @@ -28,15 +26,15 @@ bool SongChanceManager::load_songs_file(ast::NodeCPtr root) { bool ret = expect_dictionary_keys( "name", ONE_EXACTLY, expect_string(assign_variable_callback(name)), - "chance", ONE_EXACTLY, chance.expect_conditional_weight(ConditionalWeight::BASE) + "chance", ONE_EXACTLY, chance.expect_conditional_weight(ConditionalWeight::FACTOR) )(value); - ret &= song_chances.add_item({song_chances.size(), name, std::move(chance) }); + ret &= song_chances.add_item({ song_chances.size(), name, std::move(chance) }); return ret; } )(root); - if(song_chances.size() == 0) { + if (song_chances.size() == 0) { Logger::error("No songs found in Songs.txt"); return false; } @@ -50,4 +48,4 @@ bool SongChanceManager::parse_scripts(DefinitionManager const& definition_manage ret &= songChance.parse_scripts(definition_manager); } return ret; -}
\ No newline at end of file +} |