[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src actions.cpp
From: |
Guillaume Melquiond |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src actions.cpp |
Date: |
Sat, 30 Oct 2004 07:37:51 -0400 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: Guillaume Melquiond <address@hidden> 04/10/30 11:29:30
Modified files:
src : actions.cpp
Log message:
Add unit locations to OoS reports.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/actions.cpp.diff?tr1=1.160&tr2=1.161&r1=text&r2=text
Patches:
Index: wesnoth/src/actions.cpp
diff -u wesnoth/src/actions.cpp:1.160 wesnoth/src/actions.cpp:1.161
--- wesnoth/src/actions.cpp:1.160 Sat Oct 23 08:01:22 2004
+++ wesnoth/src/actions.cpp Sat Oct 30 11:29:30 2004
@@ -1,4 +1,4 @@
-/* $Id: actions.cpp,v 1.160 2004/10/23 08:01:22 silene Exp $ */
+/* $Id: actions.cpp,v 1.161 2004/10/30 11:29:30 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -549,6 +549,13 @@
return res;
}
+static std::string unit_dump(std::pair< gamemap::location, unit > const &u)
+{
+ std::stringstream s;
+ s << u.second.type().name() << " (" << u.first.x + 1 << ',' <<
u.first.y + 1 << ')';
+ return s.str();
+}
+
void attack(display& gui, const gamemap& map,
std::vector<team>& teams,
gamemap::location attacker,
@@ -606,16 +613,15 @@
const int results_damage =
atoi((*ran_results)["damage"].c_str());
if(results_chance !=
stats.chance_to_hit_defender) {
- ERR_NW << "SYNC: In attack " <<
a->second.type().name() << " vs "
- << d->second.type().name()
+ ERR_NW << "SYNC: In attack " <<
unit_dump(*a) << " vs " << unit_dump(*d)
<< ": chance to hit defender is
inconsistent. Data source: "
<< results_chance << ";
Calculation: " << stats.chance_to_hit_defender
<< " (over-riding game
calculations with data source results)\n";
stats.chance_to_hit_defender =
results_chance;
}
if(hits != results_hits) {
- ERR_NW << "SYNC: In attack " <<
a->second.type().name() << " vs "
- << d->second.type().name() <<
": the data source says the hit was "
+ ERR_NW << "SYNC: In attack " <<
unit_dump(*a) << " vs " << unit_dump(*d)
+ << ": the data source says the
hit was "
<< (results_hits ? "successful"
: "unsuccessful")
<< ", while in-game
calculations say the hit was "
<< (hits ? "successful" :
"unsuccessful")
@@ -625,9 +631,8 @@
hits = results_hits;
}
if(results_damage !=
stats.damage_defender_takes) {
- ERR_NW << "SYNC: In attack " <<
a->second.type().name() << " vs "
- << d->second.type().name() <<
": the data source says the hit did "
- << results_damage
+ ERR_NW << "SYNC: In attack " <<
unit_dump(*a) << " vs " << unit_dump(*d)
+ << ": the data source says the
hit did " << results_damage
<< " damage, while in-game
calculations show the hit doing "
<< stats.damage_defender_takes
<< " damage (over-riding game
calculations with data source results)\n";
@@ -657,8 +662,8 @@
} else {
const bool results_dies =
(*ran_results)["dies"] == "yes";
if(results_dies != dies) {
- ERR_NW << "SYNC: In attack" <<
a->second.type().name() << " vs "
- << d->second.type().name() <<
": the data source the unit "
+ ERR_NW << "SYNC: In attack " <<
unit_dump(*a) << " vs " << unit_dump(*d)
+ << ": the data source the unit "
<< (results_dies ? "perished" :
"survived")
<< " while in-game calculations
show the unit "
<< (dies ? "perished" :
"survived")
@@ -758,16 +763,15 @@
const int results_damage =
atoi((*ran_results)["damage"].c_str());
if(results_chance !=
stats.chance_to_hit_attacker) {
- ERR_NW << "SYNC: In defend " <<
a->second.type().name() << " vs "
- << d->second.type().name()
+ ERR_NW << "SYNC: In defend " <<
unit_dump(*a) << " vs " << unit_dump(*d)
<< ": chance to hit attacker is
inconsistent. Data source: "
<< results_chance << ";
Calculation: " << stats.chance_to_hit_attacker
<< " (over-riding game
calculations with data source results)\n";
stats.chance_to_hit_attacker =
results_chance;
}
if(hits != results_hits) {
- ERR_NW << "SYNC: In defend " <<
a->second.type().name() << " vs "
- << d->second.type().name() <<
": the data source says the hit was "
+ ERR_NW << "SYNC: In defend " <<
unit_dump(*a) << " vs " << unit_dump(*d)
+ << ": the data source says the
hit was "
<< (results_hits ? "successful"
: "unsuccessful")
<< ", while in-game
calculations say the hit was "
<< (hits ? "successful" :
"unsuccessful")
@@ -777,9 +781,8 @@
hits = results_hits;
}
if(results_damage !=
stats.damage_attacker_takes) {
- ERR_NW << "SYNC: In defend " <<
a->second.type().name() << " vs "
- << d->second.type().name() <<
": the data source says the hit did "
- << results_damage
+ ERR_NW << "SYNC: In defend " <<
unit_dump(*a) << " vs " << unit_dump(*d)
+ << ": the data source says the
hit did " << results_damage
<< " damage, while in-game
calculations show the hit doing "
<< stats.damage_attacker_takes
<< " damage (over-riding game
calculations with data source results)\n";
@@ -805,8 +808,8 @@
} else {
const bool results_dies =
(*ran_results)["dies"] == "yes";
if(results_dies != dies) {
- ERR_NW << "SYNC: In defend" <<
a->second.type().name() << " vs "
- << d->second.type().name() <<
": the data source the unit "
+ ERR_NW << "SYNC: In defend " <<
unit_dump(*a) << " vs " << unit_dump(*d)
+ << ": the data source the unit "
<< (results_dies ? "perished" :
"survived")
<< " while in-game calculations
show the unit "
<< (dies ? "perished" :
"survived")