Merge lp:~widelands-dev/widelands/ai_level_names into lp:widelands

Proposed by GunChleoc
Status: Merged
Merged at revision: 7658
Proposed branch: lp:~widelands-dev/widelands/ai_level_names
Merge into: lp:widelands
Diff against target: 703 lines (+116/-98)
32 files modified
campaigns/bar02.wmf/player_names (+3/-3)
maps/The Green Plateau.wmf/player_names (+3/-3)
maps/Trident of Fire.wmf/player_names (+5/-5)
scripting/widelands/multiplayer_help.lua (+1/-1)
src/ai/ai_hints.cc (+2/-2)
src/ai/ai_hints.h (+5/-5)
src/ai/computer_player.cc (+7/-3)
src/ai/computer_player.h (+2/-0)
src/ai/defaultai.cc (+14/-14)
src/ai/defaultai.h (+21/-15)
src/wui/multiplayersetupgroup.cc (+8/-4)
src/wui/playerdescrgroup.cc (+5/-3)
test/maps/lua_testsuite.wmf/player_names (+2/-2)
tribes/buildings/productionsites/atlanteans/sawmill/init.lua (+2/-2)
tribes/buildings/productionsites/atlanteans/smelting_works/init.lua (+2/-2)
tribes/buildings/productionsites/atlanteans/smokery/init.lua (+2/-2)
tribes/buildings/productionsites/atlanteans/weaving_mill/init.lua (+2/-2)
tribes/buildings/productionsites/barbarians/lime_kiln/init.lua (+2/-2)
tribes/buildings/productionsites/barbarians/smelting_works/init.lua (+2/-2)
tribes/buildings/productionsites/barbarians/wood_hardener/init.lua (+2/-2)
tribes/buildings/productionsites/empire/brewery/init.lua (+2/-2)
tribes/buildings/productionsites/empire/sawmill/init.lua (+2/-2)
tribes/buildings/productionsites/empire/smelting_works/init.lua (+2/-2)
tribes/buildings/productionsites/empire/stonemasons_house/init.lua (+2/-2)
tribes/buildings/productionsites/empire/winery/init.lua (+2/-2)
tribes/buildings/trainingsites/atlanteans/dungeon/init.lua (+2/-2)
tribes/buildings/trainingsites/atlanteans/labyrinth/init.lua (+2/-2)
tribes/buildings/trainingsites/barbarians/battlearena/init.lua (+2/-2)
tribes/buildings/trainingsites/barbarians/trainingcamp/init.lua (+2/-2)
tribes/buildings/trainingsites/empire/arena/init.lua (+2/-2)
tribes/buildings/trainingsites/empire/colosseum/init.lua (+2/-2)
tribes/buildings/trainingsites/empire/trainingcamp/init.lua (+2/-2)
To merge this branch: bzr merge lp:~widelands-dev/widelands/ai_level_names
Reviewer Review Type Date Requested Status
Widelands Developers Pending
Review via email: mp+279697@code.launchpad.net

Description of the change

Renamed AI levels to "Normal", "Weak", "Very Weak".

AI names and icon filenames are now independent of their descnames.

pics/ai_strong.png is now unused, but I am having trouble grabbing the media repro, so I left it in for now. It should be moved over there though, because we're currently not using it, but we don't want to lose the graphic for when we do have a strong AI in the future.

To post a comment you must log in.
Revision history for this message
TiborB (tiborb95) wrote :

Code looks good. If somebody compiles and tests it, give "approve", please.

(I wonder if there will be such volunteer :) )

Revision history for this message
GunChleoc (gunchleoc) wrote :

I have posted on the forum to give this branch testing priority - hopefully somebody will find the time :)

Revision history for this message
kaputtnik (franku) wrote :

> pics/ai_strong.png is now unused

I could put it into the media branch.

Currently i compile this branch and try to test the changes. After i am ready i will update this branch (removing the png file) and update the media branch also.

Revision history for this message
GunChleoc (gunchleoc) wrote :

Thanks! You can delete the file from this branch with "bzr rm <filename>" if you want to take care of that too.

Revision history for this message
kaputtnik (franku) wrote :

I know how to remove a file ;) Thanks anyway. I've removed the file and tested the interface by clicking around and cycle through the ai levels... play tested only by starting a game both in multiplayer and normal mode.

There is a crash when hitting the help button in multiplayer mode:

terminate called after throwing an instance of 'ImageNotFound'
  what(): [/home/kaputtnik/Quellcode/widelands-repo/ai_level_names/src/graphic/image_io.h:35] Image not found: pics/ai_Normal.png

I fixed this by editing scripting/widelands/multiplayer_help.lua and changed string "ai_Normal.png" to "ai_normal.png" (all lowercase letters). I've also checked if one of the other uppercase file names occur by searching for them in all of the widelands files -> no further occurrence where found.

So for the interface it seems to look good :-)

Revision history for this message
GunChleoc (gunchleoc) wrote :

Thanks! Your fix is correct, so this branch is ready to go :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'campaigns/bar02.wmf/player_names'
--- campaigns/bar02.wmf/player_names 2010-03-11 17:46:46 +0000
+++ campaigns/bar02.wmf/player_names 2015-12-07 18:58:53 +0000
@@ -10,14 +10,14 @@
10[player_2]10[player_2]
11name="Kalitath"11name="Kalitath"
12tribe="barbarians"12tribe="barbarians"
13ai="Defensive"13ai="very_weak"
1414
15[player_3]15[player_3]
16name="First Brother"16name="First Brother"
17tribe="barbarians"17tribe="barbarians"
18ai="Aggressive"18ai="normal"
1919
20[player_4]20[player_4]
21name="Second Brother"21name="Second Brother"
22tribe="barbarians"22tribe="barbarians"
23ai="Aggressive"23ai="normal"
2424
=== modified file 'maps/The Green Plateau.wmf/player_names'
--- maps/The Green Plateau.wmf/player_names 2015-11-01 22:12:57 +0000
+++ maps/The Green Plateau.wmf/player_names 2015-12-07 18:58:53 +0000
@@ -12,17 +12,17 @@
12[player_2]12[player_2]
13name="Erwyn"13name="Erwyn"
14tribe="barbarians"14tribe="barbarians"
15ai="Normal"15ai="weak"
16closeable="false"16closeable="false"
1717
18[player_3]18[player_3]
19name="Jomo"19name="Jomo"
20tribe="barbarians"20tribe="barbarians"
21ai="Defensive"21ai="very_weak"
22closeable="false"22closeable="false"
2323
24[player_4]24[player_4]
25name="Lanissa"25name="Lanissa"
26tribe="barbarians"26tribe="barbarians"
27ai="None"27ai="empty"
28closeable="false"28closeable="false"
2929
=== modified file 'maps/Trident of Fire.wmf/player_names'
--- maps/Trident of Fire.wmf/player_names 2013-08-15 16:00:17 +0000
+++ maps/Trident of Fire.wmf/player_names 2015-12-07 18:58:53 +0000
@@ -24,29 +24,29 @@
24[player_4]24[player_4]
25name="Player A"25name="Player A"
26tribe="barbarians"26tribe="barbarians"
27ai="Aggressive"27ai="normal"
28closeable="false"28closeable="false"
2929
30[player_5]30[player_5]
31name="Player B"31name="Player B"
32tribe="empire"32tribe="empire"
33ai="Aggressive"33ai="normal"
34closeable="false"34closeable="false"
3535
36[player_6]36[player_6]
37name="Player C"37name="Player C"
38tribe="atlanteans"38tribe="atlanteans"
39ai="Aggressive"39ai="normal"
40closeable="false"40closeable="false"
4141
42[player_7]42[player_7]
43name="Player D"43name="Player D"
44tribe="empire"44tribe="empire"
45ai="Aggressive"45ai="normal"
46closeable="false"46closeable="false"
4747
48[player_8]48[player_8]
49name="Player E"49name="Player E"
50tribe="atlanteans"50tribe="atlanteans"
51ai="Aggressive"51ai="normal"
52closeable="false"52closeable="false"
5353
=== removed file 'pics/ai_Strong.png'
54Binary files pics/ai_Strong.png 2015-11-25 21:01:02 +0000 and pics/ai_Strong.png 1970-01-01 00:00:00 +0000 differ54Binary files pics/ai_Strong.png 2015-11-25 21:01:02 +0000 and pics/ai_Strong.png 1970-01-01 00:00:00 +0000 differ
=== renamed file 'pics/ai_None.png' => 'pics/ai_empty.png'
=== renamed file 'pics/ai_Normal.png' => 'pics/ai_normal.png'
=== renamed file 'pics/ai_Random.png' => 'pics/ai_random.png'
=== renamed file 'pics/ai_Weak.png' => 'pics/ai_very_weak.png'
=== added file 'pics/ai_weak.png'
55Binary files pics/ai_weak.png 1970-01-01 00:00:00 +0000 and pics/ai_weak.png 2015-12-07 18:58:53 +0000 differ55Binary files pics/ai_weak.png 1970-01-01 00:00:00 +0000 and pics/ai_weak.png 2015-12-07 18:58:53 +0000 differ
=== modified file 'scripting/widelands/multiplayer_help.lua'
--- scripting/widelands/multiplayer_help.lua 2015-11-21 10:35:08 +0000
+++ scripting/widelands/multiplayer_help.lua 2015-12-07 18:58:53 +0000
@@ -19,7 +19,7 @@
19 result = result .. rt(h2(_"Player settings"))19 result = result .. rt(h2(_"Player settings"))
20 result = result .. rt(p(_"In the middle are the settings for the players. To start a game, each player must be one of the following:"))20 result = result .. rt(p(_"In the middle are the settings for the players. To start a game, each player must be one of the following:"))
21 result = result .. picture_li("pics/genstats_nrworkers.png", _"Connected to one or more clients (see ‘Client settings’).")21 result = result .. picture_li("pics/genstats_nrworkers.png", _"Connected to one or more clients (see ‘Client settings’).")
22 result = result .. picture_li("pics/ai_Normal.png", _"Connected to a computer player (the face in the picture as well as the mouse hover texts indicate the strength of the currently selected computer player).")22 result = result .. picture_li("pics/ai_normal.png", _"Connected to a computer player (the face in the picture as well as the mouse hover texts indicate the strength of the currently selected computer player).")
23 result = result .. picture_li("pics/shared_in.png", _"Set as shared in starting position for another player.")23 result = result .. picture_li("pics/shared_in.png", _"Set as shared in starting position for another player.")
24 result = result .. picture_li("pics/stop.png", _"Closed.")24 result = result .. picture_li("pics/stop.png", _"Closed.")
25 result = result .. rt(p(_"The latter three can only be set by the hosting client by left-clicking the ‘type’ button of a player. Hosting players can also set the initialization of each player (the set of buildings, wares and workers the player starts with) and the tribe and team for computer players"))25 result = result .. rt(p(_"The latter three can only be set by the hosting client by left-clicking the ‘type’ button of a player. Hosting players can also set the initialization of each player (the set of buildings, wares and workers the player starts with) and the tribe and team for computer players"))
2626
=== modified file 'src/ai/ai_hints.cc'
--- src/ai/ai_hints.cc 2015-11-23 18:44:38 +0000
+++ src/ai/ai_hints.cc 2015-12-07 18:58:53 +0000
@@ -40,8 +40,8 @@
40 // 10 days default40 // 10 days default
41 forced_after_(table->has_key("forced_after") ? table->get_int("forced_after") : 864000),41 forced_after_(table->has_key("forced_after") ? table->get_int("forced_after") : 864000),
42 mines_percent_(table->has_key("mines_percent") ? table->get_int("mines_percent") : 100),42 mines_percent_(table->has_key("mines_percent") ? table->get_int("mines_percent") : 100),
43 weak_ai_limit_(table->has_key("weak_ai_limit") ? table->get_int("weak_ai_limit") : -1),43 very_weak_ai_limit_(table->has_key("very_weak_ai_limit") ? table->get_int("very_weak_ai_limit") : -1),
44 normal_ai_limit_(table->has_key("normal_ai_limit") ? table->get_int("normal_ai_limit") : -1),44 weak_ai_limit_(table->has_key("weak_ai_limit") ? table->get_int("weak_ai_limit") : -1),
45 trainingsite_type_(TrainingSiteType::kNoTS) {45 trainingsite_type_(TrainingSiteType::kNoTS) {
4646
47 if (table->has_key("trainingsite_type")) {47 if (table->has_key("trainingsite_type")) {
4848
=== modified file 'src/ai/ai_hints.h'
--- src/ai/ai_hints.h 2015-11-23 18:44:38 +0000
+++ src/ai/ai_hints.h 2015-12-07 18:58:53 +0000
@@ -102,14 +102,14 @@
102 return mines_percent_;102 return mines_percent_;
103 }103 }
104104
105 int16_t get_very_weak_ai_limit() const {
106 return very_weak_ai_limit_;
107 }
108
105 int16_t get_weak_ai_limit() const {109 int16_t get_weak_ai_limit() const {
106 return weak_ai_limit_;110 return weak_ai_limit_;
107 }111 }
108112
109 int16_t get_normal_ai_limit() const {
110 return normal_ai_limit_;
111 }
112
113 TrainingSiteType get_trainingsite_type() const {113 TrainingSiteType get_trainingsite_type() const {
114 return trainingsite_type_;114 return trainingsite_type_;
115 }115 }
@@ -130,8 +130,8 @@
130 int32_t prohibited_till_;130 int32_t prohibited_till_;
131 int32_t forced_after_;131 int32_t forced_after_;
132 int8_t mines_percent_;132 int8_t mines_percent_;
133 int16_t very_weak_ai_limit_;
133 int16_t weak_ai_limit_;134 int16_t weak_ai_limit_;
134 int16_t normal_ai_limit_;
135 TrainingSiteType trainingsite_type_;135 TrainingSiteType trainingsite_type_;
136136
137 DISALLOW_COPY_AND_ASSIGN(BuildingHints);137 DISALLOW_COPY_AND_ASSIGN(BuildingHints);
138138
=== modified file 'src/ai/computer_player.cc'
--- src/ai/computer_player.cc 2015-11-26 09:53:02 +0000
+++ src/ai/computer_player.cc 2015-12-07 18:58:53 +0000
@@ -36,8 +36,12 @@
36 void think() override {}36 void think() override {}
3737
38 struct EmptyAIImpl : Implementation {38 struct EmptyAIImpl : Implementation {
39 /** TRANSLATORS: This is the name of an AI used in the game setup screens */39 EmptyAIImpl() {
40 EmptyAIImpl() {name = pgettext("ai_name", "None");}40 name = "empty";
41 /** TRANSLATORS: This is the name of an AI used in the game setup screens */
42 descname = _("No AI");
43 icon_filename = "pics/ai_empty.png";
44 }
41 ComputerPlayer * instantiate45 ComputerPlayer * instantiate
42 (Widelands::Game & g, Widelands::PlayerNumber const pid) const override46 (Widelands::Game & g, Widelands::PlayerNumber const pid) const override
43 {47 {
@@ -56,9 +60,9 @@
56 static std::vector<ComputerPlayer::Implementation const *> impls;60 static std::vector<ComputerPlayer::Implementation const *> impls;
5761
58 if (impls.empty()) {62 if (impls.empty()) {
59 impls.push_back(&DefaultAI::strong_impl);
60 impls.push_back(&DefaultAI::normal_impl);63 impls.push_back(&DefaultAI::normal_impl);
61 impls.push_back(&DefaultAI::weak_impl);64 impls.push_back(&DefaultAI::weak_impl);
65 impls.push_back(&DefaultAI::very_weak_impl);
62 impls.push_back(&EmptyAI::implementation);66 impls.push_back(&EmptyAI::implementation);
63 }67 }
6468
6569
=== modified file 'src/ai/computer_player.h'
--- src/ai/computer_player.h 2014-09-30 20:31:43 +0000
+++ src/ai/computer_player.h 2015-12-07 18:58:53 +0000
@@ -52,6 +52,8 @@
52 */52 */
53 struct Implementation {53 struct Implementation {
54 std::string name;54 std::string name;
55 std::string descname;
56 std::string icon_filename;
55 virtual ~Implementation() {}57 virtual ~Implementation() {}
56 virtual ComputerPlayer * instantiate58 virtual ComputerPlayer * instantiate
57 (Widelands::Game &, Widelands::PlayerNumber) const = 0;59 (Widelands::Game &, Widelands::PlayerNumber) const = 0;
5860
=== modified file 'src/ai/defaultai.cc'
--- src/ai/defaultai.cc 2015-11-28 18:32:46 +0000
+++ src/ai/defaultai.cc 2015-12-07 18:58:53 +0000
@@ -93,9 +93,9 @@
9393
94using namespace Widelands;94using namespace Widelands;
9595
96DefaultAI::StrongImpl DefaultAI::strong_impl;
97DefaultAI::NormalImpl DefaultAI::normal_impl;96DefaultAI::NormalImpl DefaultAI::normal_impl;
98DefaultAI::WeakImpl DefaultAI::weak_impl;97DefaultAI::WeakImpl DefaultAI::weak_impl;
98DefaultAI::VeryWeakImpl DefaultAI::very_weak_impl;
9999
100/// Constructor of DefaultAI100/// Constructor of DefaultAI
101DefaultAI::DefaultAI(Game& ggame, PlayerNumber const pid, DefaultAI::Type const t)101DefaultAI::DefaultAI(Game& ggame, PlayerNumber const pid, DefaultAI::Type const t)
@@ -560,16 +560,16 @@
560 }560 }
561561
562 // Is total count of this building limited by AI mode?562 // Is total count of this building limited by AI mode?
563 if (type_ == DefaultAI::Type::kVeryWeak && bh.get_very_weak_ai_limit() >= 0) {
564 bo.cnt_limit_by_aimode_ = bh.get_very_weak_ai_limit();
565 log (" %d: AI 'very weak' mode: applying limit %d building(s) for %s\n",
566 player_number(),
567 bo.cnt_limit_by_aimode_,
568 bo.name);
569 }
563 if (type_ == DefaultAI::Type::kWeak && bh.get_weak_ai_limit() >= 0) {570 if (type_ == DefaultAI::Type::kWeak && bh.get_weak_ai_limit() >= 0) {
564 bo.cnt_limit_by_aimode_ = bh.get_weak_ai_limit();571 bo.cnt_limit_by_aimode_ = bh.get_weak_ai_limit();
565 log (" %d: AI defensive mode: applying limit %d building(s) for %s\n",572 log (" %d: AI 'weak' mode: applying limit %d building(s) for %s\n",
566 player_number(),
567 bo.cnt_limit_by_aimode_,
568 bo.name);
569 }
570 if (type_ == DefaultAI::Type::kNormal && bh.get_normal_ai_limit() >= 0) {
571 bo.cnt_limit_by_aimode_ = bh.get_normal_ai_limit();
572 log (" %d: AI normal mode: applying limit %d building(s) for %s\n",
573 player_number(),573 player_number(),
574 bo.cnt_limit_by_aimode_,574 bo.cnt_limit_by_aimode_,
575 bo.name);575 bo.name);
@@ -5194,12 +5194,12 @@
5194 }5194 }
5195 }5195 }
51965196
5197 // defining treshold ratio of own_strenght/enemy's_strength5197 // defining treshold ratio of own_strength/enemy's_strength
5198 uint32_t treshold_ratio = 100;5198 uint32_t treshold_ratio = 100;
5199 if (type_ == DefaultAI::Type::kStrong) {5199 if (type_ == DefaultAI::Type::kNormal) {
5200 treshold_ratio = 80;5200 treshold_ratio = 80;
5201 }5201 }
5202 if (type_ == DefaultAI::Type::kWeak) {5202 if (type_ == DefaultAI::Type::kVeryWeak) {
5203 treshold_ratio = 120;5203 treshold_ratio = 120;
5204 }5204 }
52055205
@@ -5420,10 +5420,10 @@
5420 }5420 }
54215421
5422 // here is some differentiation based on "character" of a player5422 // here is some differentiation based on "character" of a player
5423 if (type_ == DefaultAI::Type::kNormal) {5423 if (type_ == DefaultAI::Type::kWeak) {
5424 site->second.score -= 3;5424 site->second.score -= 3;
5425 site->second.score -= vacant_mil_positions_ / 8;5425 site->second.score -= vacant_mil_positions_ / 8;
5426 } else if (type_ == DefaultAI::Type::kWeak) {5426 } else if (type_ == DefaultAI::Type::kVeryWeak) {
5427 site->second.score -= 6;5427 site->second.score -= 6;
5428 site->second.score -= vacant_mil_positions_ / 4;5428 site->second.score -= vacant_mil_positions_ / 4;
5429 } else { //=AGRESSIVE5429 } else { //=AGRESSIVE
54305430
=== modified file 'src/ai/defaultai.h'
--- src/ai/defaultai.h 2015-11-26 09:53:02 +0000
+++ src/ai/defaultai.h 2015-12-07 18:58:53 +0000
@@ -72,9 +72,9 @@
72// should be trained if inputs_ get filled again.).72// should be trained if inputs_ get filled again.).
73struct DefaultAI : ComputerPlayer {73struct DefaultAI : ComputerPlayer {
74 enum class Type {74 enum class Type {
75 kVeryWeak,
75 kWeak,76 kWeak,
76 kNormal,77 kNormal,
77 kStrong,
78 };78 };
7979
80 DefaultAI(Widelands::Game&, const Widelands::PlayerNumber, DefaultAI::Type);80 DefaultAI(Widelands::Game&, const Widelands::PlayerNumber, DefaultAI::Type);
@@ -95,21 +95,12 @@
9595
9696
97 /// Implementation for Strong97 /// Implementation for Strong
98 struct StrongImpl : public ComputerPlayer::Implementation {
99 StrongImpl() {
100 /** TRANSLATORS: This is the name of an AI used in the game setup screens */
101 name = pgettext("ai_name", "Strong");
102 }
103 ComputerPlayer* instantiate(Widelands::Game& game,
104 Widelands::PlayerNumber const p) const override {
105 return new DefaultAI(game, p, DefaultAI::Type::kStrong);
106 }
107 };
108
109 struct NormalImpl : public ComputerPlayer::Implementation {98 struct NormalImpl : public ComputerPlayer::Implementation {
110 NormalImpl() {99 NormalImpl() {
100 name = "normal";
111 /** TRANSLATORS: This is the name of an AI used in the game setup screens */101 /** TRANSLATORS: This is the name of an AI used in the game setup screens */
112 name = pgettext("ai_name", "Normal");102 descname = _("Normal AI");
103 icon_filename = "pics/ai_normal.png";
113 }104 }
114 ComputerPlayer* instantiate(Widelands::Game& game,105 ComputerPlayer* instantiate(Widelands::Game& game,
115 Widelands::PlayerNumber const p) const override {106 Widelands::PlayerNumber const p) const override {
@@ -119,8 +110,10 @@
119110
120 struct WeakImpl : public ComputerPlayer::Implementation {111 struct WeakImpl : public ComputerPlayer::Implementation {
121 WeakImpl() {112 WeakImpl() {
113 name = "weak";
122 /** TRANSLATORS: This is the name of an AI used in the game setup screens */114 /** TRANSLATORS: This is the name of an AI used in the game setup screens */
123 name = pgettext("ai_name", "Weak");115 descname = _("Weak AI");
116 icon_filename = "pics/ai_weak.png";
124 }117 }
125 ComputerPlayer* instantiate(Widelands::Game& game,118 ComputerPlayer* instantiate(Widelands::Game& game,
126 Widelands::PlayerNumber const p) const override {119 Widelands::PlayerNumber const p) const override {
@@ -128,9 +121,22 @@
128 }121 }
129 };122 };
130123
131 static StrongImpl strong_impl;124 struct VeryWeakImpl : public ComputerPlayer::Implementation {
125 VeryWeakImpl() {
126 name = "very_weak";
127 /** TRANSLATORS: This is the name of an AI used in the game setup screens */
128 descname = _("Very Weak AI");
129 icon_filename = "pics/ai_very_weak.png";
130 }
131 ComputerPlayer* instantiate(Widelands::Game& game,
132 Widelands::PlayerNumber const p) const override {
133 return new DefaultAI(game, p, DefaultAI::Type::kVeryWeak);
134 }
135 };
136
132 static NormalImpl normal_impl;137 static NormalImpl normal_impl;
133 static WeakImpl weak_impl;138 static WeakImpl weak_impl;
139 static VeryWeakImpl very_weak_impl;
134140
135private:141private:
136 void late_initialization();142 void late_initialization();
137143
=== modified file 'src/wui/multiplayersetupgroup.cc'
--- src/wui/multiplayersetupgroup.cc 2015-11-01 10:11:56 +0000
+++ src/wui/multiplayersetupgroup.cc 2015-12-07 18:58:53 +0000
@@ -23,6 +23,7 @@
2323
24#include <boost/format.hpp>24#include <boost/format.hpp>
2525
26#include "ai/computer_player.h"
26#include "base/i18n.h"27#include "base/i18n.h"
27#include "base/log.h"28#include "base/log.h"
28#include "base/wexception.h"29#include "base/wexception.h"
@@ -301,11 +302,14 @@
301 pic += "novalue.png";302 pic += "novalue.png";
302 } else {303 } else {
303 if (player_setting.random_ai) {304 if (player_setting.random_ai) {
304 title = (boost::format(_("AI: %s")) % pgettext("ai_name", "Random")).str();305 /** TRANSLATORS: This is the name of an AI used in the game setup screens */
305 pic += "ai_Random.png";306 title = _("Random AI");
307 pic += "ai_random.png";
306 } else {308 } else {
307 title = (boost::format(_("AI: %s")) % _(player_setting.ai)).str();309 const ComputerPlayer::Implementation* impl =
308 pic += "ai_" + player_setting.ai + ".png";310 ComputerPlayer::get_implementation(player_setting.ai);
311 title = impl->descname;
312 pic = impl->icon_filename;
309 }313 }
310 }314 }
311 } else { // PlayerSettings::stateHuman315 } else { // PlayerSettings::stateHuman
312316
=== modified file 'src/wui/playerdescrgroup.cc'
--- src/wui/playerdescrgroup.cc 2015-10-23 16:32:05 +0000
+++ src/wui/playerdescrgroup.cc 2015-12-07 18:58:53 +0000
@@ -23,6 +23,7 @@
2323
24#include <boost/format.hpp>24#include <boost/format.hpp>
2525
26#include "ai/computer_player.h"
26#include "base/i18n.h"27#include "base/i18n.h"
27#include "base/wexception.h"28#include "base/wexception.h"
28#include "graphic/graphic.h"29#include "graphic/graphic.h"
@@ -166,10 +167,11 @@
166 title = _("Computer");167 title = _("Computer");
167 else {168 else {
168 if (player.random_ai) {169 if (player.random_ai) {
169 title += _("AI: Random");170 title += _("Random AI");
170 } else {171 } else {
171 /** TRANSLATORS %s = AI type, e.g. 'Agressive' */172 const ComputerPlayer::Implementation* impl =
172 title += (boost::format(_("AI: %s")) % _(player.ai)).str();173 ComputerPlayer::get_implementation(player.ai);
174 title = impl->descname;
173 }175 }
174 }176 }
175 } else { // PlayerSettings::stateHuman177 } else { // PlayerSettings::stateHuman
176178
=== modified file 'test/maps/lua_testsuite.wmf/player_names'
--- test/maps/lua_testsuite.wmf/player_names 2015-04-14 18:34:40 +0000
+++ test/maps/lua_testsuite.wmf/player_names 2015-12-07 18:58:53 +0000
@@ -12,11 +12,11 @@
12[player_2]12[player_2]
13name="Epic Empire"13name="Epic Empire"
14tribe="empire"14tribe="empire"
15ai="Defensive"15ai="very_weak"
16closeable="false"16closeable="false"
1717
18[player_3]18[player_3]
19name="Awesome Atlantean"19name="Awesome Atlantean"
20tribe="atlanteans"20tribe="atlanteans"
21ai="Defensive"21ai="very_weak"
22closeable="false"22closeable="false"
2323
=== modified file 'tribes/buildings/productionsites/atlanteans/sawmill/init.lua'
--- tribes/buildings/productionsites/atlanteans/sawmill/init.lua 2015-11-24 19:55:49 +0000
+++ tribes/buildings/productionsites/atlanteans/sawmill/init.lua 2015-12-07 18:58:53 +0000
@@ -35,8 +35,8 @@
35 aihints = {35 aihints = {
36 forced_after = 250,36 forced_after = 250,
37 prohibited_till = 250,37 prohibited_till = 250,
38 weak_ai_limit = 1,38 very_weak_ai_limit = 1,
39 normal_ai_limit = 239 weak_ai_limit = 2
40 },40 },
4141
42 working_positions = {42 working_positions = {
4343
=== modified file 'tribes/buildings/productionsites/atlanteans/smelting_works/init.lua'
--- tribes/buildings/productionsites/atlanteans/smelting_works/init.lua 2015-11-24 19:55:49 +0000
+++ tribes/buildings/productionsites/atlanteans/smelting_works/init.lua 2015-12-07 18:58:53 +0000
@@ -34,8 +34,8 @@
3434
35 aihints = {35 aihints = {
36 prohibited_till = 600,36 prohibited_till = 600,
37 weak_ai_limit = 1,37 very_weak_ai_limit = 1,
38 normal_ai_limit = 238 weak_ai_limit = 2
39 },39 },
4040
41 working_positions = {41 working_positions = {
4242
=== modified file 'tribes/buildings/productionsites/atlanteans/smokery/init.lua'
--- tribes/buildings/productionsites/atlanteans/smokery/init.lua 2015-11-24 19:55:49 +0000
+++ tribes/buildings/productionsites/atlanteans/smokery/init.lua 2015-12-07 18:58:53 +0000
@@ -36,8 +36,8 @@
36 aihints = {36 aihints = {
37 forced_after = 800,37 forced_after = 800,
38 prohibited_till = 180,38 prohibited_till = 180,
39 weak_ai_limit = 1,39 very_weak_ai_limit = 1,
40 normal_ai_limit = 240 weak_ai_limit = 2
41 },41 },
4242
43 working_positions = {43 working_positions = {
4444
=== modified file 'tribes/buildings/productionsites/atlanteans/weaving_mill/init.lua'
--- tribes/buildings/productionsites/atlanteans/weaving_mill/init.lua 2015-11-24 19:55:49 +0000
+++ tribes/buildings/productionsites/atlanteans/weaving_mill/init.lua 2015-12-07 18:58:53 +0000
@@ -36,8 +36,8 @@
36 aihints = {36 aihints = {
37 forced_after = 600,37 forced_after = 600,
38 prohibited_till = 450,38 prohibited_till = 450,
39 weak_ai_limit = 1,39 very_weak_ai_limit = 1,
40 normal_ai_limit = 240 weak_ai_limit = 2
41 },41 },
4242
43 working_positions = {43 working_positions = {
4444
=== modified file 'tribes/buildings/productionsites/barbarians/lime_kiln/init.lua'
--- tribes/buildings/productionsites/barbarians/lime_kiln/init.lua 2015-11-24 19:55:49 +0000
+++ tribes/buildings/productionsites/barbarians/lime_kiln/init.lua 2015-12-07 18:58:53 +0000
@@ -34,8 +34,8 @@
3434
35 aihints = {35 aihints = {
36 forced_after = 600,36 forced_after = 600,
37 weak_ai_limit = 1,37 very_weak_ai_limit = 1,
38 normal_ai_limit = 238 weak_ai_limit = 2
39 },39 },
4040
41 working_positions = {41 working_positions = {
4242
=== modified file 'tribes/buildings/productionsites/barbarians/smelting_works/init.lua'
--- tribes/buildings/productionsites/barbarians/smelting_works/init.lua 2015-11-24 19:55:49 +0000
+++ tribes/buildings/productionsites/barbarians/smelting_works/init.lua 2015-12-07 18:58:53 +0000
@@ -37,8 +37,8 @@
3737
38 aihints = {38 aihints = {
39 prohibited_till = 400,39 prohibited_till = 400,
40 weak_ai_limit = 1,40 very_weak_ai_limit = 1,
41 normal_ai_limit = 241 weak_ai_limit = 2
42 },42 },
4343
44 working_positions = {44 working_positions = {
4545
=== modified file 'tribes/buildings/productionsites/barbarians/wood_hardener/init.lua'
--- tribes/buildings/productionsites/barbarians/wood_hardener/init.lua 2015-11-23 19:37:34 +0000
+++ tribes/buildings/productionsites/barbarians/wood_hardener/init.lua 2015-12-07 18:58:53 +0000
@@ -44,8 +44,8 @@
44 aihints = {44 aihints = {
45 forced_after = 250,45 forced_after = 250,
46 prohibited_till = 250,46 prohibited_till = 250,
47 weak_ai_limit = 1,47 very_weak_ai_limit = 1,
48 normal_ai_limit = 248 weak_ai_limit = 2
49 },49 },
5050
51 working_positions = {51 working_positions = {
5252
=== modified file 'tribes/buildings/productionsites/empire/brewery/init.lua'
--- tribes/buildings/productionsites/empire/brewery/init.lua 2015-11-24 19:55:49 +0000
+++ tribes/buildings/productionsites/empire/brewery/init.lua 2015-12-07 18:58:53 +0000
@@ -35,8 +35,8 @@
35 aihints = {35 aihints = {
36 forced_after = 900,36 forced_after = 900,
37 prohibited_till = 600,37 prohibited_till = 600,
38 weak_ai_limit = 1,38 very_weak_ai_limit = 1,
39 normal_ai_limit = 239 weak_ai_limit = 2
40 },40 },
4141
42 working_positions = {42 working_positions = {
4343
=== modified file 'tribes/buildings/productionsites/empire/sawmill/init.lua'
--- tribes/buildings/productionsites/empire/sawmill/init.lua 2015-11-24 19:55:49 +0000
+++ tribes/buildings/productionsites/empire/sawmill/init.lua 2015-12-07 18:58:53 +0000
@@ -35,8 +35,8 @@
35 aihints = {35 aihints = {
36 forced_after = 250,36 forced_after = 250,
37 prohibited_till = 250,37 prohibited_till = 250,
38 weak_ai_limit = 1,38 very_weak_ai_limit = 1,
39 normal_ai_limit = 239 weak_ai_limit = 2
40 },40 },
4141
42 working_positions = {42 working_positions = {
4343
=== modified file 'tribes/buildings/productionsites/empire/smelting_works/init.lua'
--- tribes/buildings/productionsites/empire/smelting_works/init.lua 2015-11-24 19:55:49 +0000
+++ tribes/buildings/productionsites/empire/smelting_works/init.lua 2015-12-07 18:58:53 +0000
@@ -40,8 +40,8 @@
4040
41 aihints = {41 aihints = {
42 prohibited_till = 600,42 prohibited_till = 600,
43 weak_ai_limit = 1,43 very_weak_ai_limit = 1,
44 normal_ai_limit = 244 weak_ai_limit = 2
45 },45 },
4646
47 working_positions = {47 working_positions = {
4848
=== modified file 'tribes/buildings/productionsites/empire/stonemasons_house/init.lua'
--- tribes/buildings/productionsites/empire/stonemasons_house/init.lua 2015-11-24 19:55:49 +0000
+++ tribes/buildings/productionsites/empire/stonemasons_house/init.lua 2015-12-07 18:58:53 +0000
@@ -36,8 +36,8 @@
36 aihints = {36 aihints = {
37 forced_after = 400,37 forced_after = 400,
38 prohibited_till = 400,38 prohibited_till = 400,
39 weak_ai_limit = 1,39 very_weak_ai_limit = 1,
40 normal_ai_limit = 240 weak_ai_limit = 2
41 },41 },
4242
43 working_positions = {43 working_positions = {
4444
=== modified file 'tribes/buildings/productionsites/empire/winery/init.lua'
--- tribes/buildings/productionsites/empire/winery/init.lua 2015-11-24 19:55:49 +0000
+++ tribes/buildings/productionsites/empire/winery/init.lua 2015-12-07 18:58:53 +0000
@@ -37,8 +37,8 @@
37 aihints = {37 aihints = {
38 forced_after = 600,38 forced_after = 600,
39 prohibited_till = 600,39 prohibited_till = 600,
40 weak_ai_limit = 1,40 very_weak_ai_limit = 1,
41 normal_ai_limit = 241 weak_ai_limit = 2
42 },42 },
4343
44 working_positions = {44 working_positions = {
4545
=== modified file 'tribes/buildings/trainingsites/atlanteans/dungeon/init.lua'
--- tribes/buildings/trainingsites/atlanteans/dungeon/init.lua 2015-11-24 19:55:49 +0000
+++ tribes/buildings/trainingsites/atlanteans/dungeon/init.lua 2015-12-07 18:58:53 +0000
@@ -37,8 +37,8 @@
3737
38 aihints = {38 aihints = {
39 trainingsite_type = "advanced",39 trainingsite_type = "advanced",
40 weak_ai_limit = 0,40 very_weak_ai_limit = 0,
41 normal_ai_limit = 141 weak_ai_limit = 1
42 },42 },
4343
44 working_positions = {44 working_positions = {
4545
=== modified file 'tribes/buildings/trainingsites/atlanteans/labyrinth/init.lua'
--- tribes/buildings/trainingsites/atlanteans/labyrinth/init.lua 2015-11-24 19:55:49 +0000
+++ tribes/buildings/trainingsites/atlanteans/labyrinth/init.lua 2015-12-07 18:58:53 +0000
@@ -37,8 +37,8 @@
37 aihints = {37 aihints = {
38 prohibited_till=900,38 prohibited_till=900,
39 trainingsite_type = "basic",39 trainingsite_type = "basic",
40 weak_ai_limit = 1,40 very_weak_ai_limit = 1,
41 normal_ai_limit = 241 weak_ai_limit = 2
42 },42 },
4343
44 working_positions = {44 working_positions = {
4545
=== modified file 'tribes/buildings/trainingsites/barbarians/battlearena/init.lua'
--- tribes/buildings/trainingsites/barbarians/battlearena/init.lua 2015-11-24 19:55:49 +0000
+++ tribes/buildings/trainingsites/barbarians/battlearena/init.lua 2015-12-07 18:58:53 +0000
@@ -53,8 +53,8 @@
53 aihints = {53 aihints = {
54 prohibited_till = 2700,54 prohibited_till = 2700,
55 trainingsite_type = "basic",55 trainingsite_type = "basic",
56 weak_ai_limit = 1,56 very_weak_ai_limit = 1,
57 normal_ai_limit = 357 weak_ai_limit = 3
58 },58 },
5959
60 working_positions = {60 working_positions = {
6161
=== modified file 'tribes/buildings/trainingsites/barbarians/trainingcamp/init.lua'
--- tribes/buildings/trainingsites/barbarians/trainingcamp/init.lua 2015-11-24 19:55:49 +0000
+++ tribes/buildings/trainingsites/barbarians/trainingcamp/init.lua 2015-12-07 18:58:53 +0000
@@ -46,8 +46,8 @@
46 aihints = {46 aihints = {
47 prohibited_till = 500,47 prohibited_till = 500,
48 trainingsite_type = "advanced",48 trainingsite_type = "advanced",
49 weak_ai_limit = 0,49 very_weak_ai_limit = 0,
50 normal_ai_limit = 150 weak_ai_limit = 1
51 },51 },
5252
53 working_positions = {53 working_positions = {
5454
=== modified file 'tribes/buildings/trainingsites/empire/arena/init.lua'
--- tribes/buildings/trainingsites/empire/arena/init.lua 2015-11-24 19:55:49 +0000
+++ tribes/buildings/trainingsites/empire/arena/init.lua 2015-12-07 18:58:53 +0000
@@ -41,8 +41,8 @@
4141
42 aihints = {42 aihints = {
43 trainingsite_type = "basic",43 trainingsite_type = "basic",
44 weak_ai_limit = 1,44 very_weak_ai_limit = 1,
45 normal_ai_limit = 245 weak_ai_limit = 2
46 },46 },
4747
48 working_positions = {48 working_positions = {
4949
=== modified file 'tribes/buildings/trainingsites/empire/colosseum/init.lua'
--- tribes/buildings/trainingsites/empire/colosseum/init.lua 2015-11-24 19:55:49 +0000
+++ tribes/buildings/trainingsites/empire/colosseum/init.lua 2015-12-07 18:58:53 +0000
@@ -35,8 +35,8 @@
3535
36 aihints = {36 aihints = {
37 trainingsite_type = "basic",37 trainingsite_type = "basic",
38 weak_ai_limit = 1,38 very_weak_ai_limit = 1,
39 normal_ai_limit = 239 weak_ai_limit = 2
40 },40 },
4141
42 working_positions = {42 working_positions = {
4343
=== modified file 'tribes/buildings/trainingsites/empire/trainingcamp/init.lua'
--- tribes/buildings/trainingsites/empire/trainingcamp/init.lua 2015-11-24 19:55:49 +0000
+++ tribes/buildings/trainingsites/empire/trainingcamp/init.lua 2015-12-07 18:58:53 +0000
@@ -37,8 +37,8 @@
37 aihints = {37 aihints = {
38 prohibited_till = 2700,38 prohibited_till = 2700,
39 trainingsite_type = "advanced",39 trainingsite_type = "advanced",
40 weak_ai_limit = 0,40 very_weak_ai_limit = 0,
41 normal_ai_limit = 141 weak_ai_limit = 1
42 },42 },
4343
44 working_positions = {44 working_positions = {

Subscribers

People subscribed via source and target branches

to status/vote changes: