From 511b1858a38e13f2404d0ccbfd32457be4c160ae Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Sun, 2 Feb 2020 22:32:33 -0500 Subject: [PATCH] Fix Windows build and tests --- src/game/boe.items.cpp | 2 +- src/game/boe.specials.cpp | 22 +++++++++++----------- src/scenario/special.hpp | 2 +- test/scen_read.cpp | 2 +- test/scen_write.cpp | 4 ++-- test/town_read.cpp | 2 +- test/town_write.cpp | 2 +- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/game/boe.items.cpp b/src/game/boe.items.cpp index 99359928..0e8363ff 100644 --- a/src/game/boe.items.cpp +++ b/src/game/boe.items.cpp @@ -639,7 +639,7 @@ void story_dialog(std::string title, str_num_t first, str_num_t last, eSpecCtxTy } if(which_str_type == eSpecCtxType::SCEN) me["str"].setText(univ.scenario.spec_strs[cur]); - else if(which_str_type == eSpecCtxType::OUT) + else if(which_str_type == eSpecCtxType::OUTDOOR) me["str"].setText(univ.out->spec_strs[cur]); else if(which_str_type == eSpecCtxType::TOWN) me["str"].setText(univ.town->spec_strs[cur]); diff --git a/src/game/boe.specials.cpp b/src/game/boe.specials.cpp index e7553c2c..da451f50 100644 --- a/src/game/boe.specials.cpp +++ b/src/game/boe.specials.cpp @@ -123,16 +123,16 @@ bool handle_wandering_specials(short mode) { if((mode == 0) && (store_wandering_special.spec_on_meet >= 0)) { // When encountering short prevent; - run_special(eSpecCtx::OUTDOOR_ENC,eSpecCtxType::OUT,store_wandering_special.spec_on_meet,univ.party.loc_in_sec,&prevent); + run_special(eSpecCtx::OUTDOOR_ENC,eSpecCtxType::OUTDOOR,store_wandering_special.spec_on_meet,univ.party.loc_in_sec,&prevent); if(prevent > 0) return false; } break; case 1: // end by victory - run_special(eSpecCtx::WIN_ENCOUNTER,eSpecCtxType::OUT,store_wandering_special.spec_on_win,univ.party.loc_in_sec); + run_special(eSpecCtx::WIN_ENCOUNTER,eSpecCtxType::OUTDOOR,store_wandering_special.spec_on_win,univ.party.loc_in_sec); break; case 2: // end by loss (flight or total party kill) - run_special(eSpecCtx::FLEE_ENCOUNTER,eSpecCtxType::OUT,store_wandering_special.spec_on_flee,univ.party.loc_in_sec); + run_special(eSpecCtx::FLEE_ENCOUNTER,eSpecCtxType::OUTDOOR,store_wandering_special.spec_on_flee,univ.party.loc_in_sec); break; } return true; @@ -199,7 +199,7 @@ bool check_special_terrain(location where_check,eSpecCtx mode,cPlayer& which_pc, if(out_where == univ.out->special_locs[i]) { spec_num = univ.out->special_locs[i].spec; // call special - run_special(mode, eSpecCtxType::OUT, spec_num, out_where, &s1, &s2); + run_special(mode, eSpecCtxType::OUTDOOR, spec_num, out_where, &s1, &s2); if(s1 > 0) can_enter = false; else if(s2 > 0) @@ -461,7 +461,7 @@ bool check_special_terrain(location where_check,eSpecCtx mode,cPlayer& which_pc, if(ter_flag2 == 1){ if(mode == eSpecCtx::TOWN_MOVE || (mode == eSpecCtx::COMBAT_MOVE && which_combat_type == 1)) spec_type = eSpecCtxType::TOWN; - else spec_type = eSpecCtxType::OUT; + else spec_type = eSpecCtxType::OUTDOOR; } run_special(mode, spec_type, ter_flag1, where_check, &s1, &s2); if(s1 > 0) @@ -1257,7 +1257,7 @@ bool use_space(location where) { eSpecCtxType spec_type = eSpecCtxType::SCEN; if(univ.scenario.ter_types[ter].flag2 == 1){ if(is_town() || (is_combat() && which_combat_type == 1)) spec_type = eSpecCtxType::TOWN; - else spec_type = eSpecCtxType::OUT; + else spec_type = eSpecCtxType::OUTDOOR; } run_special(eSpecCtx::USE_SPACE, spec_type, univ.scenario.ter_types[ter].flag1, where); return true; @@ -2014,7 +2014,7 @@ void run_special(eSpecCtx which_mode, eSpecCtxType which_type, spec_num_t start_ std::string type("???"); switch(ctx.cur_spec_type) { case eSpecCtxType::SCEN: type = "scenario"; break; - case eSpecCtxType::OUT: type = "outdoors" ; break; + case eSpecCtxType::OUTDOOR: type = "outdoors" ; break; case eSpecCtxType::TOWN: type = "town"; break; } add_string_to_buf("Warning: Null " + type + " special called (ID " + std::to_string(cur_spec) + ") - was this intended?", 4); @@ -2075,7 +2075,7 @@ cSpecial get_node(spec_num_t cur_spec, eSpecCtxType cur_spec_type) { return dummy_node; } return univ.scenario.scen_specials[cur_spec]; - case eSpecCtxType::OUT: + case eSpecCtxType::OUTDOOR: if(cur_spec != minmax(0,univ.out->specials.size() - 1,cur_spec)) { showError("The scenario called an outdoor special node out of range."); return dummy_node; @@ -4512,7 +4512,7 @@ void handle_message(const runtime_state& ctx, const std::string& title, pic_num_ case eSpecCtxType::SCEN: note_type = NOTE_SCEN; break; - case eSpecCtxType::OUT: + case eSpecCtxType::OUTDOOR: note_type = NOTE_OUT; break; case eSpecCtxType::TOWN: @@ -4545,7 +4545,7 @@ void get_strs(std::string& str1,std::string& str2,eSpecCtxType cur_type,short wh size_t num_strs; if(cur_type == eSpecCtxType::SCEN) num_strs = univ.scenario.spec_strs.size(); - else if(cur_type == eSpecCtxType::OUT) + else if(cur_type == eSpecCtxType::OUTDOOR) num_strs = univ.out->spec_strs.size(); else if(cur_type == eSpecCtxType::TOWN) num_strs = univ.town->spec_strs.size(); @@ -4562,7 +4562,7 @@ void get_strs(std::string& str1,std::string& str2,eSpecCtxType cur_type,short wh if(which_str2 >= 0) str2 = univ.scenario.spec_strs[which_str2]; break; - case eSpecCtxType::OUT: + case eSpecCtxType::OUTDOOR: if(which_str1 >= 0) str1 = univ.out->spec_strs[which_str1]; if(which_str2 >= 0) diff --git a/src/scenario/special.hpp b/src/scenario/special.hpp index a98a3fe6..d3d383d6 100644 --- a/src/scenario/special.hpp +++ b/src/scenario/special.hpp @@ -90,7 +90,7 @@ public: }; enum class eSpecCtxType { - SCEN, OUT, TOWN, + SCEN, OUTDOOR, TOWN, }; class cTimer { diff --git a/test/scen_read.cpp b/test/scen_read.cpp index c9faf367..8cf6cd0b 100644 --- a/test/scen_read.cpp +++ b/test/scen_read.cpp @@ -210,7 +210,7 @@ TEST_CASE("Loading a new-format scenario record") { REQUIRE(scen.scenario_timers.size() >= 1); CHECK(scen.scenario_timers[0].time == 100); CHECK(scen.scenario_timers[0].node == 15); - CHECK(scen.scenario_timers[0].node_type == 0); + CHECK(scen.scenario_timers[0].node_type == eSpecCtxType::SCEN); REQUIRE(scen.snd_names.size() >= 1); CHECK(scen.snd_names[0] == "The name of my custom sound"); } diff --git a/test/scen_write.cpp b/test/scen_write.cpp index bc214927..2b3a82bb 100644 --- a/test/scen_write.cpp +++ b/test/scen_write.cpp @@ -100,7 +100,7 @@ TEST_CASE("Saving a scenario record") { scen.store_item_towns[0] = 5; REQUIRE(scen.scenario_timers.size() >= 1); // A safety valve for if I ever make this array dynamic scen.scenario_timers[0].node = 3; - scen.scenario_timers[0].node_type = 1; + scen.scenario_timers[0].node_type = eSpecCtxType::OUTDOOR; scen.scenario_timers[0].time = 30000; scen.spec_strs.push_back("This is a sample special string!"); scen.journal_strs.push_back("This is a sample journal string!"); @@ -110,7 +110,7 @@ TEST_CASE("Saving a scenario record") { CHECK(scen.store_item_rects[0] == rect(1,2,3,4)); CHECK(scen.store_item_towns[0] == 5); CHECK(scen.scenario_timers[0].node == 3); - CHECK(scen.scenario_timers[0].node_type == 0); // This is inferred by the fact that it's in the scenario file + CHECK(scen.scenario_timers[0].node_type == eSpecCtxType::SCEN); // This is inferred by the fact that it's in the scenario file CHECK(scen.scenario_timers[0].time == 30000); REQUIRE(scen.spec_strs.size() == 1); CHECK(scen.spec_strs[0] == "This is a sample special string!"); diff --git a/test/town_read.cpp b/test/town_read.cpp index 38dd663f..be78219c 100644 --- a/test/town_read.cpp +++ b/test/town_read.cpp @@ -155,7 +155,7 @@ TEST_CASE("Loading a town definition") { CHECK(town->defy_mapping); CHECK(town->defy_scrying); REQUIRE(town->timers.size() >= 1); - CHECK(town->timers[0].node_type == 2); + CHECK(town->timers[0].node_type == eSpecCtxType::TOWN); CHECK(town->timers[0].node == 15); CHECK(town->timers[0].time == 100); REQUIRE(town->wandering.size() >= 1); diff --git a/test/town_write.cpp b/test/town_write.cpp index 95074125..fc03c33a 100644 --- a/test/town_write.cpp +++ b/test/town_write.cpp @@ -90,7 +90,7 @@ TEST_CASE("Saving a town") { CHECK(town->defy_mapping); CHECK(town->defy_scrying); REQUIRE(town->timers.size() >= 1); - CHECK(town->timers[0].node_type == 2); + CHECK(town->timers[0].node_type == eSpecCtxType::TOWN); CHECK(town->timers[0].node == 12); CHECK(town->timers[0].time == 2500); REQUIRE(town->wandering.size() >= 1);