[Wesnoth-commits] r10236 - /trunk/src/actions.cpp (February 21, 2006 - 09:34)

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

 

Author: noyga
Date: Tue Feb 21 09:34:08 2006
New Revision: 10236

URL: http://svn.gna.org/viewcvs/wesnoth?rev=10236&view=rev
Log:
Fix bug #5363 

Modified:
    trunk/src/actions.cpp

Modified: trunk/src/actions.cpp
URL: http://svn.gna.org/viewcvs/wesnoth/trunk/src/actions.cpp?rev=10236&r1=10235&r2=10236&view=diff
==============================================================================
--- trunk/src/actions.cpp (original)
+++ trunk/src/actions.cpp Tue Feb 21 09:34:08 2006
@@ -739,7 +739,7 @@
 	//defender, so we have to make sure they still exist
 	a = units.find(attacker);
 	d = units.find(defender);
-	if(a == units.end() || d == units.end() || size_t(attack_with) >= a->second.attacks().size() || size_t(stats.defend_with) >= d->second.attacks().size()) {
+	if(a == units.end() || d == units.end() || (attack_with != -1 && size_t(attack_with) >= a->second.attacks().size()) || (stats.defend_with != -1 && size_t(stats.defend_with) >= d->second.attacks().size())) {
 		return;
 	}
 	
@@ -825,7 +825,7 @@
 				game_events::fire("attacker_hits",attacker,defender,dat);
 				a = units.find(attacker);
 				d = units.find(defender);
-				if(a == units.end() || d == units.end() || size_t(attack_with) >= a->second.attacks().size() || size_t(stats.defend_with) >= d->second.attacks().size()) {
+				if(a == units.end() || d == units.end() || (attack_with != -1 && size_t(attack_with) >= a->second.attacks().size()) || (stats.defend_with != -1 && size_t(stats.defend_with)) >= d->second.attacks().size()) {
 					recalculate_fog(map,state,info,units,teams,attacker_side-1);
 					recalculate_fog(map,state,info,units,teams,defender_side-1);
 					gui.recalculate_minimap();
@@ -856,7 +856,7 @@
 				game_events::fire("attacker_misses",attacker,defender,dat);
 				a = units.find(attacker);
 				d = units.find(defender);
-				if(a == units.end() || d == units.end() || size_t(attack_with) >= a->second.attacks().size() || size_t(stats.defend_with) >= d->second.attacks().size()) {
+				if(a == units.end() || d == units.end() || (attack_with != -1 && size_t(attack_with) >= a->second.attacks().size()) || (stats.defend_with != -1 && size_t(stats.defend_with) >= d->second.attacks().size())) {
 					recalculate_fog(map,state,info,units,teams,attacker_side-1);
 					recalculate_fog(map,state,info,units,teams,defender_side-1);
 					gui.recalculate_minimap();
@@ -1071,7 +1071,7 @@
 				game_events::fire("defender_hits",attacker,defender,dat);
 				a = units.find(attacker);
 				d = units.find(defender);
-				if(a == units.end() || d == units.end() || size_t(attack_with) >= a->second.attacks().size() || size_t(stats.defend_with) >= d->second.attacks().size()) {
+				if(a == units.end() || d == units.end() || (attack_with != -1 && size_t(attack_with) >= a->second.attacks().size()) || (stats.defend_with != -1 && size_t(stats.defend_with) >= d->second.attacks().size())) {
 					recalculate_fog(map,state,info,units,teams,attacker_side-1);
 					recalculate_fog(map,state,info,units,teams,defender_side-1);
 					gui.recalculate_minimap();
@@ -1100,7 +1100,7 @@
 				game_events::fire("defender_misses",attacker,defender,dat);
 				a = units.find(attacker);
 				d = units.find(defender);
-				if(a == units.end() || d == units.end() || size_t(attack_with) >= a->second.attacks().size() || size_t(stats.defend_with) >= d->second.attacks().size()) {
+				if(a == units.end() || d == units.end() || (attack_with != -1 && size_t(attack_with) >= a->second.attacks().size()) || (stats.defend_with != -1 && size_t(stats.defend_with) >= d->second.attacks().size())) {
 					recalculate_fog(map,state,info,units,teams,attacker_side-1);
 					recalculate_fog(map,state,info,units,teams,defender_side-1);
 					gui.recalculate_minimap();



Related Mails




Powered by MHonArc, Updated Tue Feb 21 10:40:28 2006