1 #include "save/player-class-specific-data-writer.h"
2 #include "player-info/bard-data-type.h"
3 #include "player-info/bluemage-data-type.h"
4 #include "player-info/force-trainer-data-type.h"
5 #include "player-info/magic-eater-data-type.h"
6 #include "player-info/mane-data-type.h"
7 #include "player-info/monk-data-type.h"
8 #include "player-info/samurai-data-type.h"
9 #include "player-info/smith-data-type.h"
10 #include "player-info/sniper-data-type.h"
11 #include "player-info/spell-hex-data-type.h"
12 #include "save/save-util.h"
13 #include "util/enum-converter.h"
15 void PlayerClassSpecificDataWriter::operator()(const std::shared_ptr<smith_data_type> &smith_data) const
17 for (auto [essence, amount] : smith_data->essences) {
19 wr_s16b(enum2i(essence));
27 void PlayerClassSpecificDataWriter::operator()(const std::shared_ptr<force_trainer_data_type> &force_trainer_data) const
29 wr_s32b(force_trainer_data->ki);
32 void PlayerClassSpecificDataWriter::operator()(const std::shared_ptr<bluemage_data_type> &bluemage_data) const
34 wr_FlagGroup(bluemage_data->learnt_blue_magics, wr_byte);
37 void PlayerClassSpecificDataWriter::operator()(const std::shared_ptr<magic_eater_data_type> &magic_eater_data) const
39 auto write_item_group = [](const auto &item_group) {
40 wr_u16b(static_cast<uint16_t>(item_group.size()));
41 for (const auto &item : item_group) {
46 write_item_group(magic_eater_data->staves);
47 write_item_group(magic_eater_data->wands);
48 write_item_group(magic_eater_data->rods);
51 void PlayerClassSpecificDataWriter::operator()(const std::shared_ptr<bard_data_type> &bird_data) const
53 wr_s32b(enum2i(bird_data->singing_song));
54 wr_s32b(enum2i(bird_data->interrputing_song));
55 wr_s32b(bird_data->singing_duration);
56 wr_byte(bird_data->singing_song_spell_idx);
59 void PlayerClassSpecificDataWriter::operator()(const std::shared_ptr<mane_data_type> &mane_data) const
61 wr_s16b(static_cast<int16_t>(mane_data->mane_list.size()));
63 for (const auto &mane : mane_data->mane_list) {
64 wr_s16b(static_cast<int16_t>(mane.spell));
65 wr_s16b(static_cast<int16_t>(mane.damage));
69 void PlayerClassSpecificDataWriter::operator()(const std::shared_ptr<sniper_data_type> &sniper_data) const
71 wr_s16b(sniper_data->concent);
74 void PlayerClassSpecificDataWriter::operator()(const std::shared_ptr<samurai_data_type> &samurai_data) const
76 wr_byte(enum2i(samurai_data->kata));
79 void PlayerClassSpecificDataWriter::operator()(const std::shared_ptr<monk_data_type> &monk_data) const
81 wr_byte(enum2i(monk_data->stance));
84 void PlayerClassSpecificDataWriter::operator()(const std::shared_ptr<spell_hex_data_type> &spell_hex_data) const
86 wr_FlagGroup(spell_hex_data->casting_spells, wr_byte);
87 wr_s32b(spell_hex_data->revenge_power);
88 wr_byte(enum2i(spell_hex_data->revenge_type));
89 wr_byte(spell_hex_data->revenge_turn);