[Wesnoth-commits] r10033 - in /trunk/src: game_events.cpp unit.cpp unit.hpp (February 09, 2006 - 22:41)

Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Headers

 

Author: xan
Date: Thu Feb  9 22:40:33 2006
New Revision: 10033

URL: http://svn.gna.org/viewcvs/wesnoth?rev=10033&view=rev
Log:
Added 'profile' key to [unit] variables, and [label] to [event].

Modified:
    trunk/src/game_events.cpp
    trunk/src/unit.cpp
    trunk/src/unit.hpp

Modified: trunk/src/game_events.cpp
URL: http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_events.cpp?rev=10033&r1=10032&r2=10033&view=diff
==============================================================================
--- trunk/src/game_events.cpp (original)
+++ trunk/src/game_events.cpp Thu Feb  9 22:40:33 2006
@@ -1146,7 +1146,14 @@
 			screen->scroll_to_tile(speaker->first.x,speaker->first.y-1);
 
 			if(image.empty()) {
-				image = speaker->second.type().image_profile();
+				if(speaker->second.profile() == "") {
+					image = speaker->second.type().image_profile();
+				} else {
+					image = speaker->second.profile();
+					if(image == "unit_image") {
+						image = speaker->second.type().image();
+					}
+				}
 			}
 
 			if(caption.empty()) {
@@ -1516,6 +1523,10 @@
 				screen->update_display();
 			}
 		}
+	} else if(cmd == "label") {
+		const gamemap::location loc(lexical_cast_default<int>(cfg["x"],-1),lexical_cast_default<int>(cfg["y"],-1));
+		const std::string& text = cfg["text"];
+		screen->labels().set_label(loc,text);
 	}
 
 

Modified: trunk/src/unit.cpp
URL: http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit.cpp?rev=10033&r1=10032&r2=10033&view=diff
==============================================================================
--- trunk/src/unit.cpp (original)
+++ trunk/src/unit.cpp Thu Feb  9 22:40:33 2006
@@ -134,6 +134,7 @@
 	backupMaxMovement_(type_->movement()),
 	resting_(u.resting_), hold_position_(u.hold_position_),
 	underlying_description_(u.underlying_description_),
+	profile_(u.profile_),
 	description_(u.description_), recruit_(u.recruit_),
 	role_(u.role_), statusFlags_(u.statusFlags_),
 	overlays_(u.overlays_), variables_(u.variables_),
@@ -197,6 +198,10 @@
 const std::string& unit::underlying_description() const
 {
 	return underlying_description_;
+}
+const std::string& unit::profile() const
+{
+	return profile_;
 }
 
 const std::string& unit::unit_description() const
@@ -598,6 +603,7 @@
 	const std::string& description = cfg["description"];
 	const std::string& speaker = cfg["speaker"];
 	const std::string& type = cfg["type"];
+	const std::string& profile = cfg["profile"];
 	const std::string& ability = cfg["ability"];
 	const std::string& side = cfg["side"];
 	const std::string& weapon = cfg["has_weapon"];
@@ -608,6 +614,9 @@
 	const std::string& level = cfg["level"];
 
 	if(description.empty() == false && description != this->underlying_description()) {
+		return false;
+	}
+	if(profile.empty() == false && profile != profile_) {
 		return false;
 	}
 
@@ -873,6 +882,8 @@
 
 	resting_ = (cfg["resting"] == "yes");
 	unrenamable_ = (cfg["unrenamable"] == "yes");
+	
+	profile_ = cfg["profile"];
 }
 
 void unit::write(config& cfg) const
@@ -941,6 +952,8 @@
 
 	cfg["resting"] = resting_ ? "yes" : "no";
 	cfg["unrenamable"] = unrenamable_ ? "yes" : "no";
+	
+	cfg["profile"] = profile_;
 }
 
 void unit::assign_role(const std::string& role)

Modified: trunk/src/unit.hpp
URL: http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit.hpp?rev=10033&r1=10032&r2=10033&view=diff
==============================================================================
--- trunk/src/unit.hpp (original)
+++ trunk/src/unit.hpp Thu Feb  9 22:40:33 2006
@@ -42,6 +42,7 @@
 	std::string name() const;
 	const std::string& description() const;
 	const std::string& underlying_description() const;
+	const std::string& profile() const;
 
 	//information about the unit -- a detailed description of it
 	const std::string& unit_description() const;
@@ -210,7 +211,7 @@
 	bool resting_;
 	bool hold_position_;
 
-	std::string underlying_description_, description_;
+	std::string underlying_description_, description_, profile_;
 
 	//this field is used if the scenario creator places a custom unit description
 	//with a certain unit. If this field is empty, then the more general unit description



Related Mails




Powered by MHonArc, Updated Fri Feb 10 00:00:17 2006