Author: crab
Date: Fri Apr 17 21:11:11 2009
New Revision: 34988
URL: http://svn.gna.org/viewcvs/wesnoth?rev=34988&view=rev
Log:
AI Testing. Adds a command line parameter --ai_config<number>=value (patch
#1164 by karlm). This patch allow to specify the exact path to ai configuration
for each of the sides from the command line, which is very important for
batch-testing of various AIs.
Modified:
trunk/changelog
trunk/data/core/about.cfg
trunk/doc/man/wesnoth.6
trunk/src/game.cpp
trunk/src/team.cpp
Modified: trunk/changelog
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=34988&r1=34987&r2=34988&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Fri Apr 17 21:11:11 2009
@@ -6,6 +6,7 @@
number generator with.
* new logdomain : uploader to see stat-upload related actions
* AI:
+ * Added command-line option ai_config<number>=<value>
* Fixed incorrect handling of poisoning attacks when suggesting best attack
in user interface
* Added basic history and hot-redeployment capabilities to in-game console.
Modified: trunk/data/core/about.cfg
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/core/about.cfg?rev=34988&r1=34987&r2=34988&view=diff
==============================================================================
--- trunk/data/core/about.cfg (original)
+++ trunk/data/core/about.cfg Fri Apr 17 21:11:11 2009
@@ -853,6 +853,10 @@
name = "Joshua Hudson"
[/entry]
[entry]
+ name = "Karl Miller (karlm)"
+ email = "karl dot miller dot km at gmail dot com"
+ [/entry]
+ [entry]
name = "Laurent Birtz"
[/entry]
[entry]
Modified: trunk/doc/man/wesnoth.6
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/doc/man/wesnoth.6?rev=34988&r1=34987&r2=34988&view=diff
==============================================================================
--- trunk/doc/man/wesnoth.6 (original)
+++ trunk/doc/man/wesnoth.6 Fri Apr 17 21:11:11 2009
@@ -180,6 +180,9 @@
.I number
has to be replaced by a side number. It usually is 1 or 2 but depends on
the number of players possible in the chosen scenario.
+.TP
+.BI --ai_config number = value
+selects a configuration file to load for the AI controller for this side.
.TP
.BI --algorithm number = value
selects a non-standard algorithm to be used by the AI controller for
Modified: trunk/src/game.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game.cpp?rev=34988&r1=34987&r2=34988&view=diff
==============================================================================
--- trunk/src/game.cpp (original)
+++ trunk/src/game.cpp Fri Apr 17 21:11:11 2009
@@ -682,7 +682,7 @@
std::string era = "era_default";
std::string scenario = "multiplayer_The_Freelands";
- std::map<int,std::string> side_types, side_controllers, side_algorithms;
+ std::map<int,std::string> side_types, side_controllers,
side_algorithms, side_ai_configs;
std::map<int,string_map> side_parameters;
std::string turns = "50";
@@ -720,6 +720,8 @@
era = value;
} else if(last_digit && name_head == "--controller") {
side_controllers[side] = value;
+ } else if(last_digit && name_head == "--ai_config") {
+ side_ai_configs[side] = value;
} else if(last_digit && name_head == "--algorithm") {
side_algorithms[side] = value;
} else if(last_digit && name_head == "--side") {
@@ -780,7 +782,8 @@
{
std::map<int,std::string>::const_iterator type =
side_types.find(side_num),
controller =
side_controllers.find(side_num),
- algorithm =
side_algorithms.find(side_num);
+ algorithm =
side_algorithms.find(side_num),
+ ai_config =
side_ai_configs.find(side_num);
const config* side = type == side_types.end() ?
&era_cfg.find_child("multiplayer_side",
"random_faction", "yes") :
@@ -839,6 +842,10 @@
if(algorithm != side_algorithms.end()) {
s["ai_algorithm"] = algorithm->second;
+ }
+
+ if(ai_config != side_ai_configs.end()) {
+ s["ai_config"] = ai_config->second;
}
config& ai_params = s.add_child("ai");
@@ -1757,6 +1764,7 @@
<< " should be between 1
and 1000, the default is 50.\n"
<< " -m, --multiplayer starts a multiplayer
game. There are additional\n"
<< " options that can be
used as explained below:\n"
+ << " --ai_config<number>=value selects a
configuration file to load for this side.\n"
<< " --algorithm<number>=value selects a
non-standard algorithm to be used by\n"
<< " the AI controller
for this side.\n"
<< " --controller<number>=value selects the
controller for this side.\n"
Modified: trunk/src/team.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/team.cpp?rev=34988&r1=34987&r2=34988&view=diff
==============================================================================
--- trunk/src/team.cpp (original)
+++ trunk/src/team.cpp Fri Apr 17 21:11:11 2009
@@ -120,7 +120,11 @@
if (!user_team_name.translatable())
user_team_name = user_team_name.from_serialized(user_team_name);
- ai_manager::add_ai_for_side_from_config(side,cfg,true);
+ if(cfg.has_attribute("ai_config")) {
+ ai_manager::add_ai_for_side_from_file(side, cfg["ai_config"],
true);
+ } else {
+ ai_manager::add_ai_for_side_from_config(side, cfg, true);
+ }
//legacy parameters
const config& global_ai_parameters =
ai_manager::get_active_ai_global_parameters_for_side(side);
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits