[Freeciv-Dev] (PR#13376) ALTLinux freeciv patches: command for reveal ma
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: |
[Freeciv-Dev] (PR#13376) ALTLinux freeciv patches: command for reveal map |
From: |
"Egor Vyscrebentsov" <evyscr@xxxxxxxxx> |
Date: |
Wed, 29 Jun 2005 13:56:58 -0700 |
Reply-to: |
bugs@xxxxxxxxxxx |
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13376 >
Good daytime!
Attached is a patch from ALTLinux freeciv-2.0.2-alt1.src.rpm that allows
to reveal map for given player.
Author is Dmitry V. Levin <ldv AT altlinux.org>
--
Thanks, evyscr
PS Not that i understand reasons for making such commands...
diff -uprk.orig freeciv-2.0.0.orig/server/commands.c
freeciv-2.0.0/server/commands.c
--- freeciv-2.0.0.orig/server/commands.c 2005-04-01 08:19:33 +0400
+++ freeciv-2.0.0/server/commands.c 2005-04-25 18:24:10 +0400
@@ -356,6 +356,10 @@ const struct command commands[] = {
"rfcstyle",
N_("Switch server output between 'RFC-style' and normal style."), NULL
},
+ {"revealmap", ALLOW_HACK, ALLOW_HACK,
+ "revealmap <player-name>",
+ N_("Reveal map for given player."), NULL
+ },
{"serverid", ALLOW_INFO, ALLOW_INFO,
"serverid",
N_("Simply returns the id of the server."),
diff -uprk.orig freeciv-2.0.0.orig/server/commands.h
freeciv-2.0.0/server/commands.h
--- freeciv-2.0.0.orig/server/commands.h 2005-04-01 08:19:33 +0400
+++ freeciv-2.0.0/server/commands.h 2005-04-25 18:25:24 +0400
@@ -79,6 +79,7 @@ enum command_id {
/* undocumented */
CMD_RFCSTYLE,
+ CMD_REVEAL_MAP,
CMD_SRVID,
/* pseudo-commands: */
diff -uprk.orig freeciv-2.0.0.orig/server/stdinhand.c
freeciv-2.0.0/server/stdinhand.c
--- freeciv-2.0.0.orig/server/stdinhand.c 2005-04-16 00:20:55 +0400
+++ freeciv-2.0.0/server/stdinhand.c 2005-04-25 18:13:26 +0400
@@ -94,6 +94,7 @@ static bool take_command(struct connecti
static bool detach_command(struct connection *caller, char *name, bool check);
static bool start_command(struct connection *caller, char *name, bool check);
static bool end_command(struct connection *caller, char *str, bool check);
+static bool reveal_map_command(struct connection *caller, char *name, bool
check);
enum vote_type {
VOTE_NONE, VOTE_UNUSED, VOTE_YES, VOTE_NO
@@ -3089,6 +3090,24 @@ static bool detach_command(struct connec
return res;
}
+static bool reveal_map_command(struct connection *caller, char *name, bool
check)
+{
+ enum m_pre_result match_result;
+ struct player *pplayer = find_player_by_name_prefix(name, &match_result);
+
+ if (pplayer) {
+ if (check) {
+ return TRUE;
+ }
+ map_know_all(pplayer);
+ cmd_reply(CMD_REVEAL_MAP, caller, C_OK,
+ _("Map revealed for player '%s'."), pplayer->name);
+ return TRUE;
+ }
+ cmd_reply_no_such_player(CMD_REVEAL_MAP, caller, name, match_result);
+ return FALSE;
+}
+
/**************************************************************************
After a /load is completed, a reply is sent to all connections to tell
them about the load. This information is used by the conndlg to
@@ -3513,6 +3532,8 @@ bool handle_stdin_input(struct connectio
return start_command(caller, arg, check);
case CMD_END_GAME:
return end_command(caller, arg, check);
+ case CMD_REVEAL_MAP:
+ return reveal_map_command(caller, arg, check);
case CMD_NUM:
case CMD_UNRECOGNIZED:
case CMD_AMBIGUOUS:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#13376) ALTLinux freeciv patches: command for reveal map,
Egor Vyscrebentsov <=
|
|