[Freeciv-Dev] (PR#3965) New command "reveal" to show map to a player
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Hi,
The attached patch introduces a new command "reveal" to show whole map to
a player. Without arguments it shows map to all. I meant it as a
debugging tool mostly, so I made it #ifdef DEBUG, but I guess it can be
(mis)used to give newbies an edge against harder opponents.
G.
Index: server/stdinhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/stdinhand.c,v
retrieving revision 1.275
diff -u -r1.275 stdinhand.c
--- server/stdinhand.c 2003/04/08 20:36:10 1.275
+++ server/stdinhand.c 2003/04/09 18:50:39
@@ -49,6 +49,7 @@
#include "diplhand.h"
#include "gamehand.h"
#include "gamelog.h"
+#include "maphand.h"
#include "mapgen.h"
#include "meta.h"
#include "plrhand.h"
@@ -971,6 +972,7 @@
CMD_HARD,
#ifdef DEBUG
CMD_EXPERIMENTAL,
+ CMD_REVEAL,
#endif
CMD_CMDLEVEL,
CMD_FIRSTLEVEL,
@@ -1194,6 +1196,14 @@
"FOR TESTING OF NEW AI FEATURES! For ordinary servers, this option "
"has no effect.")
},
+ {"reveal", ALLOW_CTRL,
+ /* TRANS: translate text between <> only */
+ N_("reveal\n
+ reveal <player-name>"),
+ N_("Reveal map to a player or all players"),
+ N_("Reveal whole map to player, if a player name is given, otherwise
+ reveal map to all players.")
+ },
#endif
{"cmdlevel", ALLOW_HACK, /* confusing to leave this at ALLOW_CTRL */
/* TRANS: translate text between <> only */
@@ -1701,6 +1711,33 @@
}
/**************************************************************************
+ Server command to reveal map to the given player
+**************************************************************************/
+#ifdef DEBUG
+static void reveal_map(struct connection *caller, char *arg)
+{
+ enum m_pre_result match_result;
+ struct player *pplayer;
+
+ if (server_state != RUN_GAME_STATE) {
+ cmd_reply(CMD_REVEAL, caller, C_FAIL,
+ _("You can't reveal map when game isn't running"));
+ return;
+ }
+
+ pplayer = find_player_by_name_prefix(arg, &match_result);
+
+ if (pplayer) {
+ map_know_and_see_all(pplayer);
+ } else if (match_result == M_PRE_EMPTY) {
+ show_map_to_all();
+ } else {
+ cmd_reply_no_such_player(CMD_REVEAL, caller, arg, match_result);
+ }
+}
+#endif
+
+/**************************************************************************
...
**************************************************************************/
void toggle_ai_player_direct(struct connection *caller, struct player *pplayer)
@@ -3434,6 +3471,9 @@
case CMD_EXPERIMENTAL:
set_ai_level(caller, arg, 10);
break;
+ case CMD_REVEAL:
+ reveal_map(caller, arg);
+ break;
#endif
case CMD_QUIT:
quit_game(caller);
@@ -4209,6 +4249,7 @@
CMD_HARD,
#ifdef DEBUG
CMD_EXPERIMENTAL,
+ CMD_REVEAL,
#endif
CMD_REMOVE,
-1
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#3965) New command "reveal" to show map to a player,
Gregory Berkolaiko <=
|
|