(orig): Allow moving origin to another country's origin. This is a
superset of the offset command. (offs): Redundant, underdocumented, remove. (orig): Allow deities to reset origin to absolute 0,0.
This commit is contained in:
parent
c13a592bf5
commit
b69173eea4
6 changed files with 44 additions and 108 deletions
|
@ -79,6 +79,7 @@ extern s_char *prsub(struct shpstr *);
|
||||||
extern int check_trade(void);
|
extern int check_trade(void);
|
||||||
extern int ontradingblock(int, int *);
|
extern int ontradingblock(int, int *);
|
||||||
extern void trdswitchown(int, int *, int);
|
extern void trdswitchown(int, int *, int);
|
||||||
|
/* Commands */
|
||||||
int acce(void);
|
int acce(void);
|
||||||
int add(void);
|
int add(void);
|
||||||
int anti(void);
|
int anti(void);
|
||||||
|
@ -172,7 +173,6 @@ int newe(void);
|
||||||
int news(void);
|
int news(void);
|
||||||
int nuke(void);
|
int nuke(void);
|
||||||
int offe(void);
|
int offe(void);
|
||||||
int offs(void);
|
|
||||||
int orde(void);
|
int orde(void);
|
||||||
int orig(void);
|
int orig(void);
|
||||||
int para(void);
|
int para(void);
|
||||||
|
@ -429,7 +429,7 @@ extern void log_last_commands(void);
|
||||||
extern int gamedown(void);
|
extern int gamedown(void);
|
||||||
extern void daychange(time_t);
|
extern void daychange(time_t);
|
||||||
extern int getminleft(time_t, int);
|
extern int getminleft(time_t, int);
|
||||||
/* more in commands.h */
|
/* more under Commands */
|
||||||
/* empmod.c */
|
/* empmod.c */
|
||||||
/* init_nats.c */
|
/* init_nats.c */
|
||||||
extern int init_nats(void);
|
extern int init_nats(void);
|
||||||
|
@ -444,7 +444,7 @@ extern char *praddr(struct player *);
|
||||||
extern void player_main(struct player *);
|
extern void player_main(struct player *);
|
||||||
extern int match_user(char *, struct player *);
|
extern int match_user(char *, struct player *);
|
||||||
extern int command(void);
|
extern int command(void);
|
||||||
/* more in commands.h */
|
/* more under Commands */
|
||||||
/* recvclient.c */
|
/* recvclient.c */
|
||||||
extern int recvclient(char *, int);
|
extern int recvclient(char *, int);
|
||||||
|
|
||||||
|
@ -601,7 +601,7 @@ extern void pr(char *, ...) ATTRIBUTE((format (printf, 1, 2)));
|
||||||
extern void uprnf(char *buf);
|
extern void uprnf(char *buf);
|
||||||
extern void pr_id(struct player *, int, char *, ...)
|
extern void pr_id(struct player *, int, char *, ...)
|
||||||
ATTRIBUTE((format (printf, 3, 4)));
|
ATTRIBUTE((format (printf, 3, 4)));
|
||||||
extern void pr_flash(struct player *, char *format, ...)
|
extern void pr_flash(struct player *, char *, ...)
|
||||||
ATTRIBUTE((format (printf, 2, 3)));
|
ATTRIBUTE((format (printf, 2, 3)));
|
||||||
extern void pr_inform(struct player *, char *, ...)
|
extern void pr_inform(struct player *, char *, ...)
|
||||||
ATTRIBUTE((format (printf, 2, 3)));
|
ATTRIBUTE((format (printf, 2, 3)));
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
.TH Command OFFSET
|
|
||||||
.NA offset "Temporarily change coordinate system"
|
|
||||||
.LV Expert
|
|
||||||
.SY "offset <SECT|NAT>"
|
|
||||||
This should affect your maps.
|
|
||||||
.SA "Deity"
|
|
|
@ -1,9 +1,13 @@
|
||||||
.TH Command ORIGIN
|
.TH Command ORIGIN
|
||||||
.NA origin "Change the origin of your country's coordinate system"
|
.NA origin "Change the origin of your country's coordinate system"
|
||||||
.LV Expert
|
.LV Expert
|
||||||
.SY "origin <SECTOR>"
|
.SY "origin <SECTOR|COUNTRY|~>"
|
||||||
This command changes the origin of your coordinate system
|
This command moves the origin of your coordinate system
|
||||||
(where 0,0 is located.)
|
(where 0,0 is located).
|
||||||
|
.s1
|
||||||
|
You can move it to another sector, or to the origin of an allied
|
||||||
|
country. Deities can also use a \*Q~\*U argument to move it to
|
||||||
|
absolute 0,0.
|
||||||
.s1
|
.s1
|
||||||
This command does not change the location of your nation's capital,
|
This command does not change the location of your nation's capital,
|
||||||
though its coordinates, like the coordinates of all other sectors,
|
though its coordinates, like the coordinates of all other sectors,
|
||||||
|
|
|
@ -1,83 +0,0 @@
|
||||||
/*
|
|
||||||
* Empire - A multi-player, client/server Internet based war game.
|
|
||||||
* Copyright (C) 1986-2005, Dave Pare, Jeff Bailey, Thomas Ruschak,
|
|
||||||
* Ken Stevens, Steve McClure
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*
|
|
||||||
* ---
|
|
||||||
*
|
|
||||||
* See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
|
|
||||||
* related information and legal notices. It is expected that any future
|
|
||||||
* projects/authors will amend these files as needed.
|
|
||||||
*
|
|
||||||
* ---
|
|
||||||
*
|
|
||||||
* offs.c: Diety set mapping offset.
|
|
||||||
*
|
|
||||||
* Known contributors to this file:
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <config.h>
|
|
||||||
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include "misc.h"
|
|
||||||
#include "player.h"
|
|
||||||
#include "file.h"
|
|
||||||
#include "nat.h"
|
|
||||||
#include "commands.h"
|
|
||||||
|
|
||||||
int
|
|
||||||
offs(void)
|
|
||||||
{
|
|
||||||
register int i;
|
|
||||||
struct natstr *natp;
|
|
||||||
coord xorg, yorg;
|
|
||||||
coord dx, dy;
|
|
||||||
s_char *cp;
|
|
||||||
struct natstr *np;
|
|
||||||
s_char buf[1024];
|
|
||||||
|
|
||||||
natp = getnatp(player->cnum);
|
|
||||||
xorg = natp->nat_xorg;
|
|
||||||
yorg = natp->nat_yorg;
|
|
||||||
if (!(cp = getstarg(player->argp[1], "sector or nation? ", buf)))
|
|
||||||
return RET_SYN;
|
|
||||||
if (strchr(cp, ',')) { /* x, y pair for offset */
|
|
||||||
if (!sarg_xy(cp, &dx, &dy)) {
|
|
||||||
pr("Bad sector designation.\n");
|
|
||||||
return RET_SYN;
|
|
||||||
}
|
|
||||||
xorg = dx;
|
|
||||||
yorg = dy;
|
|
||||||
} else {
|
|
||||||
/* actually nation name */
|
|
||||||
if ((i = natarg(cp, (s_char *)0)) < 0)
|
|
||||||
return RET_SYN;
|
|
||||||
np = getnatp(i);
|
|
||||||
xorg = np->nat_xorg;
|
|
||||||
yorg = np->nat_yorg;
|
|
||||||
}
|
|
||||||
np = getnatp(player->cnum);
|
|
||||||
/* NOTE: it's OK to use %d,%d here, because we want abs coords */
|
|
||||||
pr("Old offset was %d,%d\n", np->nat_xorg, np->nat_yorg);
|
|
||||||
np->nat_xorg = xorg;
|
|
||||||
np->nat_yorg = yorg;
|
|
||||||
putnat(np);
|
|
||||||
pr("New offset was %d,%d\n", xorg, yorg);
|
|
||||||
return RET_OK;
|
|
||||||
}
|
|
|
@ -29,6 +29,7 @@
|
||||||
*
|
*
|
||||||
* Known contributors to this file:
|
* Known contributors to this file:
|
||||||
* Shelley Louie, 1988
|
* Shelley Louie, 1988
|
||||||
|
* Markus Armbruster, 2006
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
@ -44,25 +45,46 @@
|
||||||
int
|
int
|
||||||
orig(void)
|
orig(void)
|
||||||
{
|
{
|
||||||
struct sctstr sect;
|
|
||||||
s_char *p;
|
s_char *p;
|
||||||
coord x, y;
|
coord x, y;
|
||||||
s_char buf[1024];
|
s_char buf[1024];
|
||||||
|
natid cnum;
|
||||||
struct natstr *np;
|
struct natstr *np;
|
||||||
|
|
||||||
if ((p =
|
p = getstarg(player->argp[1], "New origin (sector or country) : ", buf);
|
||||||
getstarg(player->argp[1], "New origin location : ", buf)) == 0) {
|
if (!p)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
|
if (!isalpha(*p) && strchr(p, ',')) {
|
||||||
|
/* sector */
|
||||||
|
if (!sarg_xy(p, &x, &y)) {
|
||||||
|
pr("Bad sector designation.\n");
|
||||||
|
return RET_SYN;
|
||||||
|
}
|
||||||
|
} else if (*p == '~') {
|
||||||
|
/* reset */
|
||||||
|
if (!player->god) {
|
||||||
|
pr("Only deities can reset their origin.\n");
|
||||||
|
return RET_FAIL;
|
||||||
|
}
|
||||||
|
x = y = 0;
|
||||||
|
} else {
|
||||||
|
/* country */
|
||||||
|
cnum = natarg(p, NULL);
|
||||||
|
if (!(np = getnatp(cnum)))
|
||||||
|
return RET_SYN;
|
||||||
|
if (!player->god && player->cnum != cnum
|
||||||
|
&& getrel(np, player->cnum) != ALLIED) {
|
||||||
|
pr("Country %s is not allied with you!\n", np->nat_cnam);
|
||||||
|
return RET_FAIL;
|
||||||
|
}
|
||||||
|
x = np->nat_xorg;
|
||||||
|
y = np->nat_yorg;
|
||||||
}
|
}
|
||||||
if (!sarg_xy(p, &x, &y))
|
|
||||||
return RET_SYN;
|
|
||||||
if (!getsect(x, y, §))
|
|
||||||
return RET_SYN;
|
|
||||||
pr("Origin at %s (old system) is now at 0,0 (new system).\n",
|
pr("Origin at %s (old system) is now at 0,0 (new system).\n",
|
||||||
xyas(sect.sct_x, sect.sct_y, player->cnum));
|
xyas(x, y, player->cnum));
|
||||||
np = getnatp(player->cnum);
|
np = getnatp(player->cnum);
|
||||||
np->nat_xorg = sect.sct_x;
|
np->nat_xorg = x;
|
||||||
np->nat_yorg = sect.sct_y;
|
np->nat_yorg = y;
|
||||||
putnat(np);
|
putnat(np);
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,9 +170,8 @@ struct cmndstr player_coms[] = {
|
||||||
{"nuke <SECTS>", 0, nuke, 0, NORM},
|
{"nuke <SECTS>", 0, nuke, 0, NORM},
|
||||||
{"offer <loan|treaty> <NAT> [<NUM> <DAYS> <IRATE>]", 1, offe, C_MOD,
|
{"offer <loan|treaty> <NAT> [<NUM> <DAYS> <IRATE>]", 1, offe, C_MOD,
|
||||||
NORM + MONEY + CAP},
|
NORM + MONEY + CAP},
|
||||||
{"offset <SECT|NAT>", 0, offs, C_MOD, GOD},
|
|
||||||
{"order <SHIPS> <c|s|r|d|l> ", 1, orde, C_MOD, NORM + CAP},
|
{"order <SHIPS> <c|s|r|d|l> ", 1, orde, C_MOD, NORM + CAP},
|
||||||
{"origin <SECT>", 1, orig, C_MOD, NORM},
|
{"origin <SECT|COUNTRY|~>", 1, orig, C_MOD, NORM},
|
||||||
{"paradrop <cargo-PLANES> <fighter-PLANES> <ap-SECT> <PATH|DESTINATION>", 3, para, C_MOD, NORM + MONEY + CAP},
|
{"paradrop <cargo-PLANES> <fighter-PLANES> <ap-SECT> <PATH|DESTINATION>", 3, para, C_MOD, NORM + MONEY + CAP},
|
||||||
{"path <SECT>", 0, path, 0, NORM},
|
{"path <SECT>", 0, path, 0, NORM},
|
||||||
{"payoff <SHIPS>", 0, payo, C_MOD, NORM},
|
{"payoff <SHIPS>", 0, payo, C_MOD, NORM},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue