diff --git a/changelog b/changelog index f7cf0a942f9..a56cb153d4b 100644 --- a/changelog +++ b/changelog @@ -55,6 +55,8 @@ Version 1.9.4+svn: * Introduced [move_unit]check_passability= (default yes, previously it was always yes/non-existent) key to allow disabling the check for suitable terrain. * Added TAKE_IT_STRING and LEAVE_IT_STRING arguments to PICKUPPABLE_ITEM + * The tags [remove_shroud] and [place_shroud] now take comma-separated lists of sides. + They default to affecting all sides now if no side is set. * Miscellaneous and bugfixes: * Fixed: g++ compiler warnings. * Added: cmake target to build the gui design pdf. diff --git a/data/campaigns/Descent_Into_Darkness/scenarios/11_Descent_into_Darkness.cfg b/data/campaigns/Descent_Into_Darkness/scenarios/11_Descent_into_Darkness.cfg index 422bdad6f6d..9ff936823f3 100644 --- a/data/campaigns/Descent_Into_Darkness/scenarios/11_Descent_into_Darkness.cfg +++ b/data/campaigns/Descent_Into_Darkness/scenarios/11_Descent_into_Darkness.cfg @@ -554,6 +554,7 @@ [/message] [remove_shroud] + side=1 x=27-32 y=23-27 [/remove_shroud] diff --git a/data/campaigns/Eastern_Invasion/scenarios/02_The_Escape_Tunnel.cfg b/data/campaigns/Eastern_Invasion/scenarios/02_The_Escape_Tunnel.cfg index f9a0e45afd6..4b146176789 100644 --- a/data/campaigns/Eastern_Invasion/scenarios/02_The_Escape_Tunnel.cfg +++ b/data/campaigns/Eastern_Invasion/scenarios/02_The_Escape_Tunnel.cfg @@ -315,6 +315,7 @@ #endif [remove_shroud] + side=1 x,y=3,3 [/remove_shroud] [teleport] diff --git a/data/campaigns/Heir_To_The_Throne/scenarios/14_Plunging_Into_the_Darkness.cfg b/data/campaigns/Heir_To_The_Throne/scenarios/14_Plunging_Into_the_Darkness.cfg index a584d4be053..ce548fdcff3 100644 --- a/data/campaigns/Heir_To_The_Throne/scenarios/14_Plunging_Into_the_Darkness.cfg +++ b/data/campaigns/Heir_To_The_Throne/scenarios/14_Plunging_Into_the_Darkness.cfg @@ -241,6 +241,7 @@ [/recall] [place_shroud] + side=1 x,y=1-20,21-41 [/place_shroud] diff --git a/data/campaigns/Heir_To_The_Throne/scenarios/15_The_Lost_General.cfg b/data/campaigns/Heir_To_The_Throne/scenarios/15_The_Lost_General.cfg index 6013823fb26..6be5509e1e6 100644 --- a/data/campaigns/Heir_To_The_Throne/scenarios/15_The_Lost_General.cfg +++ b/data/campaigns/Heir_To_The_Throne/scenarios/15_The_Lost_General.cfg @@ -206,6 +206,7 @@ x,y=6,23 [/scroll_to] [remove_shroud] + side=1 x=2-4 y=21-24 [/remove_shroud] @@ -294,6 +295,7 @@ find_vacant=yes [/unstore_unit] [place_shroud] + side=1 x= 2-7 , 7-8 y=21-24,22-24 [/place_shroud] @@ -326,6 +328,7 @@ side=1 [/filter] [remove_shroud] + side=1 x=14-16,12-18,10-19,12-18 y=10, 11, 12-14,15 [/remove_shroud] diff --git a/data/campaigns/Northern_Rebirth/scenarios/05a_The_Pursuit.cfg b/data/campaigns/Northern_Rebirth/scenarios/05a_The_Pursuit.cfg index 75d682757a5..5cc2cc06b49 100644 --- a/data/campaigns/Northern_Rebirth/scenarios/05a_The_Pursuit.cfg +++ b/data/campaigns/Northern_Rebirth/scenarios/05a_The_Pursuit.cfg @@ -1073,6 +1073,7 @@ # Remove some shroud and place the units [remove_shroud] + side=1 x=9,7-10 y=8-11,10-12 [/remove_shroud] @@ -2368,6 +2369,7 @@ #endif #endif [remove_shroud] + side=1 x=28-30 y=8-12 [/remove_shroud] @@ -2615,6 +2617,7 @@ # Set a flag to prevent the confrontation form getting triggered more than once {VARIABLE confronted_malifor yes} [remove_shroud] + side=1 x=23-26 y=8-13 [/remove_shroud] diff --git a/data/campaigns/The_Hammer_of_Thursagan/scenarios/06_High_Pass.cfg b/data/campaigns/The_Hammer_of_Thursagan/scenarios/06_High_Pass.cfg index ebb13f014fd..9c370b12a15 100644 --- a/data/campaigns/The_Hammer_of_Thursagan/scenarios/06_High_Pass.cfg +++ b/data/campaigns/The_Hammer_of_Thursagan/scenarios/06_High_Pass.cfg @@ -157,11 +157,13 @@ [/message] [remove_shroud] + side=1 x=29-31 y=10-12 [/remove_shroud] {HIGHLIGHT_IMAGE 30 11 scenery/signpost.png ()} [place_shroud] + side=1 x=29-31 y=10-12 [/place_shroud] diff --git a/data/campaigns/The_Hammer_of_Thursagan/scenarios/12_The_Underlevels.cfg b/data/campaigns/The_Hammer_of_Thursagan/scenarios/12_The_Underlevels.cfg index 609b5bccd32..8b0fb1a84ca 100644 --- a/data/campaigns/The_Hammer_of_Thursagan/scenarios/12_The_Underlevels.cfg +++ b/data/campaigns/The_Hammer_of_Thursagan/scenarios/12_The_Underlevels.cfg @@ -862,6 +862,7 @@ [/terrain] [remove_shroud] + side=1 x=7-10 y=1-3 [/remove_shroud] @@ -913,6 +914,7 @@ [/terrain] [remove_shroud] + side=1 x=15-18 y=1-3 [/remove_shroud] @@ -964,6 +966,7 @@ [/terrain] [remove_shroud] + side=1 x=22-25 y=1-3 [/remove_shroud] @@ -1015,6 +1018,7 @@ [/terrain] [remove_shroud] + side=1 x=22-25 y=8-10 [/remove_shroud] diff --git a/data/campaigns/Under_the_Burning_Suns/scenarios/03_Stirring_in_the_Night.cfg b/data/campaigns/Under_the_Burning_Suns/scenarios/03_Stirring_in_the_Night.cfg index 4f25a077d76..e66d063ace3 100644 --- a/data/campaigns/Under_the_Burning_Suns/scenarios/03_Stirring_in_the_Night.cfg +++ b/data/campaigns/Under_the_Burning_Suns/scenarios/03_Stirring_in_the_Night.cfg @@ -1368,6 +1368,7 @@ This unit always strikes first with this attack, even if they are defending." fire_event=no [/kill] [place_shroud] + side=1 x=1-60 y=1-60 [/place_shroud] @@ -1529,6 +1530,7 @@ This unit always strikes first with this attack, even if they are defending." side=1 [/redraw] [place_shroud] + side=1 x=1-60 y=1-60 [/place_shroud] @@ -1798,6 +1800,7 @@ This unit always strikes first with this attack, even if they are defending." [/then] [/if] [place_shroud] + side=1 x=1-60 y=1-60 [/place_shroud] @@ -2080,6 +2083,7 @@ This unit always strikes first with this attack, even if they are defending." [/then] [/if] [place_shroud] + side=1 x=1-60 y=1-60 [/place_shroud] diff --git a/src/game_events.cpp b/src/game_events.cpp index 64f0d00f5e9..867a62c6963 100644 --- a/src/game_events.cpp +++ b/src/game_events.cpp @@ -544,26 +544,44 @@ namespace { static void toggle_shroud(const bool remove, const vconfig& cfg) { - int side_num = cfg["side"].to_int(1); - const size_t index = side_num-1; + std::string side_for_raw = cfg["side"]; - if (index < resources::teams->size()) - { - team &t = (*resources::teams)[index]; - std::set locs; - terrain_filter filter(cfg, *resources::units); - filter.restrict_size(game_config::max_loop); - filter.get_locations(locs, true); - - foreach (map_location const &loc, locs) - { - if (remove) { - t.clear_shroud(loc); - } else { - t.place_shroud(loc); - } + //If they didn't define any sides then we are making a comma separated list for them + //It contains all the sides from 1 to the max number of sides in play + if (side_for_raw.empty()) { + side_for_raw = "1"; + for (size_t side_index = 1; side_index < resources::teams->size(); side_index++) { + std::string side_fake = lexical_cast( side_index + 1 ); + side_for_raw = side_for_raw + "," + side_fake; } } + //iterate through the list + std::vector side_for = + utils::split(side_for_raw, ',', utils::STRIP_SPACES | utils::REMOVE_EMPTY); + std::vector::iterator itSide; + size_t side; + for (itSide = side_for.begin(); itSide != side_for.end(); ++itSide) + { + side = lexical_cast_default(*itSide); + size_t index = side-1; + if (index < resources::teams->size()) + { + team &t = (*resources::teams)[index]; + std::set locs; + terrain_filter filter(cfg, *resources::units); + filter.restrict_size(game_config::max_loop); + filter.get_locations(locs, true); + + foreach (map_location const &loc, locs) + { + if (remove) { + t.clear_shroud(loc); + } else { + t.place_shroud(loc); + } + } + } + } resources::screen->labels().recalculate_shroud(); resources::screen->recalculate_minimap();