Applied patch #1887 with slight modifications.

This commit is contained in:
Steven Panek 2011-03-07 23:51:15 +00:00
parent cdf559886a
commit 1dd559998d
10 changed files with 56 additions and 17 deletions

View File

@ -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.

View File

@ -554,6 +554,7 @@
[/message]
[remove_shroud]
side=1
x=27-32
y=23-27
[/remove_shroud]

View File

@ -315,6 +315,7 @@
#endif
[remove_shroud]
side=1
x,y=3,3
[/remove_shroud]
[teleport]

View File

@ -241,6 +241,7 @@
[/recall]
[place_shroud]
side=1
x,y=1-20,21-41
[/place_shroud]

View File

@ -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]

View File

@ -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]

View File

@ -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]

View File

@ -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]

View File

@ -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]

View File

@ -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<map_location> 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<std::string>( side_index + 1 );
side_for_raw = side_for_raw + "," + side_fake;
}
}
//iterate through the list
std::vector<std::string> side_for =
utils::split(side_for_raw, ',', utils::STRIP_SPACES | utils::REMOVE_EMPTY);
std::vector<std::string>::iterator itSide;
size_t side;
for (itSide = side_for.begin(); itSide != side_for.end(); ++itSide)
{
side = lexical_cast_default<size_t>(*itSide);
size_t index = side-1;
if (index < resources::teams->size())
{
team &t = (*resources::teams)[index];
std::set<map_location> 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();