[Freeciv-Dev] (PR#13229) show AI difficulty in pregame list
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13229 >
This patch shows the AI difficulty in the pregame player list. This
means the difficulty must be sent to the client, and player info must be
resent when difficulty is changed.
-jason
Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.522
diff -u -r1.522 packhand.c
--- client/packhand.c 7 Jun 2005 06:17:09 -0000 1.522
+++ client/packhand.c 7 Jun 2005 18:07:32 -0000
@@ -1521,6 +1521,7 @@
append_output_window(msg);
}
}
+ pplayer->ai.skill_level = pinfo->ai_skill_level;
update_players_dialog();
update_worklist_report_dialog();
Index: client/gui-gtk-2.0/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/gui_main.c,v
retrieving revision 1.128
diff -u -r1.128 gui_main.c
--- client/gui-gtk-2.0/gui_main.c 4 Jun 2005 16:28:18 -0000 1.128
+++ client/gui-gtk-2.0/gui_main.c 7 Jun 2005 18:07:32 -0000
@@ -1257,7 +1257,21 @@
continue; /* Connections are listed individually. */
}
if (pplayer->ai.control) {
- name = _("<AI>");
+ name = _("<AI>");
+ switch (pplayer->ai.skill_level) {
+ case 2:
+ name = _("<Novice AI>");
+ break;
+ case 3:
+ name = _("<Easy AI>");
+ break;
+ case 5:
+ name = _("<Normal AI>");
+ break;
+ case 7:
+ name = _("<Hard AI>");
+ break;
+ }
} else {
name = pplayer->username;
}
Index: common/packets.def
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.def,v
retrieving revision 1.132
diff -u -r1.132 packets.def
--- common/packets.def 7 Jun 2005 06:20:05 -0000 1.132
+++ common/packets.def 7 Jun 2005 18:07:32 -0000
@@ -646,6 +646,7 @@
BOOL is_connected;
TURN revolution_finishes;
BOOL ai;
+ UINT8 ai_skill_level;
UINT8 barbarian_type;
uint32(unsigned int) gives_shared_vision;
BIT_STRING inventions[A_LAST+1];
Index: server/plrhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/plrhand.c,v
retrieving revision 1.384
diff -u -r1.384 plrhand.c
--- server/plrhand.c 7 Jun 2005 06:20:06 -0000 1.384
+++ server/plrhand.c 7 Jun 2005 18:07:33 -0000
@@ -1461,6 +1461,7 @@
packet->is_alive=plr->is_alive;
packet->is_connected=plr->is_connected;
packet->ai=plr->ai.control;
+ packet->ai_skill_level = plr->ai.control ? plr->ai.skill_level : 0;
for (i = 0; i < MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS; i++) {
packet->love[i] = plr->ai.love[i];
}
Index: server/stdinhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/stdinhand.c,v
retrieving revision 1.417
diff -u -r1.417 stdinhand.c
--- server/stdinhand.c 4 Jun 2005 18:20:24 -0000 1.417
+++ server/stdinhand.c 7 Jun 2005 18:07:34 -0000
@@ -1779,6 +1779,7 @@
void set_ai_level_direct(struct player *pplayer, int level)
{
set_ai_level_directer(pplayer,level);
+ send_player_info(pplayer, NULL);
cmd_reply(cmd_of_level(level), NULL, C_OK,
_("Player '%s' now has AI skill level '%s'."),
pplayer->name, name_of_skill_level(level));
@@ -1804,6 +1805,7 @@
return TRUE;
}
set_ai_level_directer(pplayer, level);
+ send_player_info(pplayer, NULL);
cmd_reply(cmd_of_level(level), caller, C_OK,
_("Player '%s' now has AI skill level '%s'."),
pplayer->name, name_of_skill_level(level));
@@ -1819,6 +1821,7 @@
players_iterate(pplayer) {
if (pplayer->ai.control) {
set_ai_level_directer(pplayer, level);
+ send_player_info(pplayer, NULL);
cmd_reply(cmd_of_level(level), caller, C_OK,
_("Player '%s' now has AI skill level '%s'."),
pplayer->name, name_of_skill_level(level));
@@ -1853,6 +1856,7 @@
} else if (!caller->player->ai.control && !check) {
notify_conn(game.est_connections, _("%s set to away mode."),
caller->player->name);
+ send_player_info(caller->player, NULL);
set_ai_level_directer(caller->player, 1);
caller->player->ai.control = TRUE;
cancel_all_meetings(caller->player);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#13229) show AI difficulty in pregame list,
Jason Short <=
|
|