[Wesnoth-cvs-commits] wesnoth/src unit.cpp unit_types.cpp unit_types.hpp (August 21, 2005 - 20:11)

 

CVSROOT:	/cvsroot/wesnoth
Module name:	wesnoth
Branch: 	
Changes by:	Philippe Plantier <gruikya@xxxxxxxxxxxxxxxx>	05/08/21 17:46:03

Modified files:
	src            : unit.cpp unit_types.cpp unit_types.hpp 

Log message:
	Fixed the has_weapon filter which was broken with my previous commit.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/unit.cpp.diff?tr1=1.159&tr2=1.160&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/unit_types.cpp.diff?tr1=1.106&tr2=1.107&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/unit_types.hpp.diff?tr1=1.72&tr2=1.73&r1=text&r2=text

Patches:
Index: wesnoth/src/unit.cpp
diff -u wesnoth/src/unit.cpp:1.159 wesnoth/src/unit.cpp:1.160
--- wesnoth/src/unit.cpp:1.159	Thu Aug 11 14:42:36 2005
+++ wesnoth/src/unit.cpp	Sun Aug 21 17:46:03 2005
@@ -1,4 +1,4 @@
-/* $Id: unit.cpp,v 1.159 2005/08/11 14:42:36 ott Exp $ */
+/* $Id: unit.cpp,v 1.160 2005/08/21 17:46:03 gruikya Exp $ */
 /*
    Copyright (C) 2003 by David White <davidnwhite@xxxxxxxxxxx>
    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
@@ -580,7 +580,7 @@
 		const std::vector<attack_type>& attacks = this->attacks();
 		for(std::vector<attack_type>::const_iterator i = attacks.begin();
 		    i != attacks.end(); ++i) {
-			if(i->name() == weapon) {
+			if(i->id() == weapon) {
 				has_weapon = true;
 			}
 		}
Index: wesnoth/src/unit_types.cpp
diff -u wesnoth/src/unit_types.cpp:1.106 wesnoth/src/unit_types.cpp:1.107
--- wesnoth/src/unit_types.cpp:1.106	Sun Aug 21 17:27:15 2005
+++ wesnoth/src/unit_types.cpp	Sun Aug 21 17:46:03 2005
@@ -1,4 +1,4 @@
-/* $Id: unit_types.cpp,v 1.106 2005/08/21 17:27:15 gruikya Exp $ */
+/* $Id: unit_types.cpp,v 1.107 2005/08/21 17:46:03 gruikya Exp $ */
 /*
    Copyright (C) 2003 by David White <davidnwhite@xxxxxxxxxxx>
    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
@@ -153,10 +153,10 @@
 		animation_.push_back(unit_animation(cfg));
 	}
 
-	std::string name = cfg["name"];
+	id_ = cfg["name"];
 	description_ = cfg["description"];
 	if (description_.empty())
-		description_ = egettext(name.c_str());
+		description_ = egettext(id_.c_str());
 
 	type_ = cfg["type"];
 	special_ = cfg["special"];
@@ -164,7 +164,7 @@
 	slow_ = special_ == "slow";
 	icon_ = cfg["icon"];
 	if(icon_.empty())
-		icon_ = "attacks/" + name + ".png";
+		icon_ = "attacks/" + id_ + ".png";
 
 	range_ = cfg["range"] == "long" ? LONG_RANGE : SHORT_RANGE;
 	damage_ = atol(cfg["damage"].c_str());
@@ -183,6 +183,11 @@
 	return description_;
 }
 
+const std::string& attack_type::id() const
+{
+	return id_;
+}
+
 const std::string& attack_type::type() const
 {
 	return type_;
@@ -286,6 +291,7 @@
 
 	if(set_name.empty() == false) {
 		description_ = set_name;
+		id_ = set_name;
 	}
 
 	if(set_type.empty() == false) {
Index: wesnoth/src/unit_types.hpp
diff -u wesnoth/src/unit_types.hpp:1.72 wesnoth/src/unit_types.hpp:1.73
--- wesnoth/src/unit_types.hpp:1.72	Sun Aug 21 17:27:15 2005
+++ wesnoth/src/unit_types.hpp	Sun Aug 21 17:46:03 2005
@@ -1,4 +1,4 @@
-/* $Id: unit_types.hpp,v 1.72 2005/08/21 17:27:15 gruikya Exp $ */
+/* $Id: unit_types.hpp,v 1.73 2005/08/21 17:46:03 gruikya Exp $ */
 /*
    Copyright (C) 2003 by David White <davidnwhite@xxxxxxxxxxx>
    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
@@ -80,6 +80,7 @@
 
 	attack_type(const config& cfg);
 	const t_string& name() const;
+	const std::string& id() const;
 	const std::string& type() const;
 	const std::string& special() const;
 	const std::string& icon() const;
@@ -103,6 +104,7 @@
 	std::vector<unit_animation> animation_;
 	std::vector<unit_animation> direction_animation_[6];
 	t_string description_;
+	std::string id_;
 	std::string type_;
 	std::string special_;
 	std::string icon_;



You are on the gna.org mail server.

Generated by mhonarc, Tue Sep 20 16:52:47 2005