Author: noyga
Date: Sun May 18 17:08:29 2008
New Revision: 26699
URL: http://svn.gna.org/viewcvs/wesnoth?rev=26699&view=rev
Log:
Apply patch #1067 by xonev: Add image key to removeitem tag
Modified:
trunk/changelog
trunk/data/core/about.cfg
trunk/src/game_display.cpp
trunk/src/game_display.hpp
trunk/src/game_events.cpp
Modified: trunk/changelog
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=26699&r1=26698&r2=26699&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Sun May 18 17:08:29 2008
@@ -50,6 +50,8 @@
pass parameters (ex: "alias hp=unit hitpoints", then use "hp 100")
* WML engine:
* titlescreen is now randomly loaded
+ * removeitem now can take an image key so that overlays can be removed one
at
+ a time. (patch #1067)
* fix [teleport] capturing villages with the wrong side (bug #11683)
* SideWML recruit= no longer locks the faction except if explicitely wanted
with the new key faction_from_recruit=yes
Modified: trunk/data/core/about.cfg
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/core/about.cfg?rev=26699&r1=26698&r2=26699&view=diff
==============================================================================
--- trunk/data/core/about.cfg (original)
+++ trunk/data/core/about.cfg Sun May 18 17:08:29 2008
@@ -136,6 +136,9 @@
email = "lao.geek_AT_gmail.com"
wikiuser = "lao"
[/entry]
+ [entry]
+ name = "Steven Oxley (xonev)"
+ [/entry]
[/about]
[about]
Modified: trunk/src/game_display.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_display.cpp?rev=26699&r1=26698&r2=26699&view=diff
==============================================================================
--- trunk/src/game_display.cpp (original)
+++ trunk/src/game_display.cpp Sun May 18 17:08:29 2008
@@ -97,7 +97,6 @@
for(size_t i = 0; i != teams_.size(); ++i) {
std::string side_color = team::get_side_colour_index(i+1);
side_colors.push_back(side_color);
-
std::string flag = teams_[i].flag();
std::string old_rgb = game_config::flag_rgb;
std::string new_rgb = side_color;
@@ -1133,6 +1132,26 @@
overlays_.erase(loc);
}
+void game_display::remove_single_overlay(const gamemap::location& loc, const
std::string& toDelete)
+{
+ //Iterate through the values with key of loc
+ typedef overlay_map::iterator Itor;
+ overlay_map::iterator iteratorCopy;
+ std::pair<Itor,Itor> itors = overlays_.equal_range(loc);
+ while(itors.first != itors.second) {
+ //If image or halo of overlay struct matches toDelete, remove
the overlay
+ if(itors.first->second.image == toDelete ||
itors.first->second.halo == toDelete) {
+ iteratorCopy = itors.first;
+ ++itors.first;
+ halo::remove(iteratorCopy->second.halo_handle);
+ overlays_.erase(iteratorCopy);
+ }
+ else {
+ ++itors.first;
+ }
+ }
+}
+
void game_display::write_overlays(config& cfg) const
{
for(overlay_map::const_iterator i = overlays_.begin(); i !=
overlays_.end(); ++i) {
Modified: trunk/src/game_display.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_display.hpp?rev=26699&r1=26698&r2=26699&view=diff
==============================================================================
--- trunk/src/game_display.hpp (original)
+++ trunk/src/game_display.hpp Sun May 18 17:08:29 2008
@@ -143,6 +143,8 @@
void add_overlay(const gamemap::location& loc, const std::string&
image, const std::string& halo="");
//! remove_overlay will remove all overlays on a tile.
void remove_overlay(const gamemap::location& loc);
+ //! remove_single_overlay will remove a single overlay from a tile
+ void remove_single_overlay(const gamemap::location& loc, const
std::string& toDelete);
//! Function to serialize overlay data.
void write_overlays(config& cfg) const;
Modified: trunk/src/game_events.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_events.cpp?rev=26699&r1=26698&r2=26699&view=diff
==============================================================================
--- trunk/src/game_events.cpp (original)
+++ trunk/src/game_events.cpp Sun May 18 17:08:29 2008
@@ -1544,12 +1544,20 @@
}
else if(cmd == "removeitem") {
+ std::string img = cfg["image"];
+ assert(state_of_game != NULL);
gamemap::location loc = cfg_to_loc(cfg);
+
if(!loc.valid()) {
- loc = event_info.loc1;
- }
-
- screen->remove_overlay(loc);
+ loc = event_info.loc1;
+ }
+
+ if(!img.empty()) { //If image key is set remove that one item
+ screen->remove_single_overlay(loc, img);
+ }
+ else { //Else remove the overlay completely
+ screen->remove_overlay(loc);
+ }
}
else if(cmd == "unit_overlay") {
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits