wesnoth-cvs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-cvs-commits] wesnoth/src ai.cpp replay.cpp


From: ott
Subject: [Wesnoth-cvs-commits] wesnoth/src ai.cpp replay.cpp
Date: Sat, 30 Apr 2005 11:23:37 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     ott <address@hidden>    05/04/30 15:23:37

Modified files:
        src            : ai.cpp replay.cpp 

Log message:
        Added additional gold logging (patch 3740).

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/ai.cpp.diff?tr1=1.147&tr2=1.148&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/replay.cpp.diff?tr1=1.109&tr2=1.110&r1=text&r2=text

Patches:
Index: wesnoth/src/ai.cpp
diff -u wesnoth/src/ai.cpp:1.147 wesnoth/src/ai.cpp:1.148
--- wesnoth/src/ai.cpp:1.147    Sat Apr 30 07:15:05 2005
+++ wesnoth/src/ai.cpp  Sat Apr 30 15:23:37 2005
@@ -1,4 +1,4 @@
-/* $Id: ai.cpp,v 1.147 2005/04/30 07:15:05 silene Exp $ */
+/* $Id: ai.cpp,v 1.148 2005/04/30 15:23:37 ott Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -275,6 +275,12 @@
        if(current_team().gold() < u->second.cost()) {
                return false;
        }
+       LOG_AI << "trying recruit: team=" << (info_.team_num) <<
+           " type=" << unit_name <<
+           " cost=" << u->second.cost() <<
+           " loc=(" << (1+loc.x) << ',' << (1+loc.y) << ')' <<
+           " gold=" << (current_team().gold()) <<
+           " (-> " << (current_team().gold()-u->second.cost()) << ")\n";
 
        unit new_unit(&u->second,info_.team_num,true);
 
@@ -287,8 +293,22 @@
                replay_guard.confirm_transaction();
 
                sync_network();
+               const team_data data = 
calculate_team_data(current_team(),info_.team_num,info_.units);
+               LOG_AI <<
+               "recruit confirmed: team=" << (info_.team_num) <<
+               " units=" << data.units <<
+               " gold=" << data.gold <<
+               ((data.net_income < 0) ? "" : "+") <<
+               data.net_income << "\n";
                return true;
        } else {
+               const team_data data = 
calculate_team_data(current_team(),info_.team_num,info_.units);
+               LOG_AI <<
+               "recruit UNconfirmed: team=" << (info_.team_num) <<
+               " units=" << data.units <<
+               " gold=" << data.gold <<
+               ((data.net_income < 0) ? "" : "+") <<
+               data.net_income << "\n";
                return false;
        }
 }
Index: wesnoth/src/replay.cpp
diff -u wesnoth/src/replay.cpp:1.109 wesnoth/src/replay.cpp:1.110
--- wesnoth/src/replay.cpp:1.109        Fri Apr 29 21:37:26 2005
+++ wesnoth/src/replay.cpp      Sat Apr 30 15:23:37 2005
@@ -1,4 +1,4 @@
-/* $Id: replay.cpp,v 1.109 2005/04/29 21:37:26 silene Exp $ */
+/* $Id: replay.cpp,v 1.110 2005/04/30 15:23:37 ott Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -701,11 +701,13 @@
                                       << u_type->second.cost() << "/" << 
current_team.gold() << "\n";
                                if (!game_config::ignore_replay_errors) throw 
replay::error();
                        }
+                       LOG_NW << "recruit: team=" << team_num << " '" << 
u_type->second.id() << "' at (" << (1+loc.x) << ',' << (1+loc.y) << ") cost=" 
<< (u_type->second.cost()) << " from gold=" << (current_team.gold()) << ' ';
 
 
                        statistics::recruit_unit(new_unit);
 
                        current_team.spend_gold(u_type->second.cost());
+                       LOG_NW << "-> " << (current_team.gold()) << "\n";
                        fix_shroud = true;
                }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]