[Wesnoth-commits] r9913 - /trunk/src/actions.cpp (February 01, 2006 - 20:14)

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

 

Author: xan
Date: Wed Feb  1 20:13:48 2006
New Revision: 9913

URL: http://svn.gna.org/viewcvs/wesnoth?rev=9913&view=rev
Log:
Fixed bug in events where defender had no weapon.

Modified:
    trunk/src/actions.cpp

Modified: trunk/src/actions.cpp
URL: http://svn.gna.org/viewcvs/wesnoth/trunk/src/actions.cpp?rev=9913&r1=9912&r2=9913&view=diff
==============================================================================
--- trunk/src/actions.cpp (original)
+++ trunk/src/actions.cpp Wed Feb  1 20:13:48 2006
@@ -786,7 +786,7 @@
 				dat.add_child("first");
 				dat.add_child("second");
 				(*(dat.child("first")))["weapon"]=a->second.attacks()[attack_with].name();
-				(*(dat.child("second")))["weapon"]=d->second.attacks()[stats.defend_with].name();
+				(*(dat.child("second")))["weapon"]=stats.defend_with != -1 ? d->second.attacks()[stats.defend_with].name() : "none";
 				gamemap::TERRAIN att_terrain = map[attacker.x][attacker.y];
 				std::string terrain_letter("");
 				terrain_letter += att_terrain;
@@ -817,7 +817,7 @@
 				dat.add_child("first");
 				dat.add_child("second");
 				(*(dat.child("first")))["weapon"]=a->second.attacks()[attack_with].name();
-				(*(dat.child("second")))["weapon"]=d->second.attacks()[stats.defend_with].name();
+				(*(dat.child("second")))["weapon"]=stats.defend_with != -1 ? d->second.attacks()[stats.defend_with].name() : "none";
 				gamemap::TERRAIN att_terrain = map[attacker.x][attacker.y];
 				std::string terrain_letter("");
 				terrain_letter += att_terrain;
@@ -1028,7 +1028,7 @@
 				dat.add_child("first");
 				dat.add_child("second");
 				(*(dat.child("first")))["weapon"]=a->second.attacks()[attack_with].name();
-				(*(dat.child("second")))["weapon"]=d->second.attacks()[stats.defend_with].name();
+				(*(dat.child("second")))["weapon"]=stats.defend_with != -1 ? d->second.attacks()[stats.defend_with].name() : "none";
 				gamemap::TERRAIN att_terrain = map[attacker.x][attacker.y];
 				std::string terrain_letter("");
 				terrain_letter += att_terrain;
@@ -1057,7 +1057,7 @@
 				dat.add_child("first");
 				dat.add_child("second");
 				(*(dat.child("first")))["weapon"]=a->second.attacks()[attack_with].name();
-				(*(dat.child("second")))["weapon"]=d->second.attacks()[stats.defend_with].name();
+				(*(dat.child("second")))["weapon"]=stats.defend_with != -1 ? d->second.attacks()[stats.defend_with].name() : "none";
 				gamemap::TERRAIN att_terrain = map[attacker.x][attacker.y];
 				std::string terrain_letter("");
 				terrain_letter += att_terrain;



Related Mails




Powered by MHonArc, Updated Thu Feb 02 00:20:12 2006