/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2014, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2017, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure, Markus Armbruster
*
* Empire is free software: you can redistribute it and/or modify
* Chad Zabel, 1994
* Steve McClure, 1998-2000
* Ron Koenderink, 2003-2009
- * Markus Armbruster, 2003-2013
+ * Markus Armbruster, 2003-2016
*/
#include <config.h>
static void
print_nat(struct natstr *np)
{
- int i;
-
pr("Country #: %2d\n", np->nat_cnum);
pr("Name <n>: %-20s\t", np->nat_cnam);
pr("Representative <r>: %s\n", np->nat_pnam);
pr("Happiness <H>: %.2f\n", np->nat_level[NAT_HLEV]);
pr("Money <M>: $%6d\n", np->nat_money);
pr("Telegrams <t>: %6d\n", np->nat_tgms);
- if (opt_HIDDEN) {
- pr("Countries contacted: ");
- for (i = 0; i < MAXNOC; i++) {
- if (getcontact(np, i))
- pr("%d(%d) ", i, getcontact(np, i));
- }
- pr("\n");
- }
}
static void
newsect.sct_own);
report_god_gives("Sector ", xyas(newx, newy, sect->sct_own),
sect->sct_own);
+ if (sect->sct_x == sect->sct_dist_x
+ && sect->sct_y == sect->sct_dist_y) {
+ sect->sct_dist_x = newx;
+ sect->sct_dist_y = newy;
+ }
sect->sct_x = newx;
sect->sct_y = newy;
+ sect->sct_coastal = newsect.sct_coastal;
ef_set_uid(EF_SECTOR, sect, XYOFFSET(newx, newy));
break;
case 'D':
return RET_FAIL;
}
divine_unit_change_quiet(unit, "Location",
- unit->own && unit->own != player->cnum,
+ newx != unit->x || newy != unit->y,
"from %s to %s",
xyas(unit->x, unit->y, player->cnum),
xyas(newx, newy, player->cnum));
xyas(unit->x, unit->y, unit->own),
xyas(newx, newy, unit->own),
cname(player->cnum));
- unit->x = newx;
- unit->y = newy;
+ unit_teleport(unit, newx, newy);
break;
case 'E':
arg = LIMIT_TO(arg, mineff, 100);
{
struct mchrstr *mcp = &mchr[ship->shp_type];
int arg = atoi(p);
+ int ret;
switch (*key) {
case 'U':
case 'E':
case 'M':
case 'F':
- return edit_unit((struct empobj *)ship, key, p,
- SHIP_MINEFF, "fleet", 0);
+ ret = edit_unit((struct empobj *)ship, key, p,
+ SHIP_MINEFF, "fleet", 0);
+ return ret;
case 't':
arg = ef_elt_byname(EF_SHIP_CHR, p);
if (arg < 0) {
divine_unit_change((struct empobj *)ship, "Type",
arg != ship->shp_type, 0,
"to %s", mchr[arg].m_name);
+ if (ship->shp_tech < mchr[arg].m_tech)
+ shp_set_tech(ship, mchr[arg].m_tech);
ship->shp_type = arg;
+ shp_set_tech(ship, ship->shp_tech);
limit_item((struct empobj *)ship, ship->shp_item, mchr[arg].m_item);
- if (ship->shp_tech >= mchr[arg].m_tech)
- break;
- arg = mchr[arg].m_tech;
- /* fall through */
+ break;
case 'T':
arg = LIMIT_TO(arg, mcp->m_tech, SHRT_MAX);
divine_unit_change((struct empobj *)ship, "Tech level",
divine_unit_change((struct empobj *)land, "Type",
arg != land->lnd_type, 0,
"to %s", lchr[arg].l_name);
+ if (land->lnd_tech < lchr[arg].l_tech)
+ lnd_set_tech(land, lchr[arg].l_tech);
land->lnd_type = arg;
+ lnd_set_tech(land, land->lnd_tech);
limit_item((struct empobj *)land, land->lnd_item, lchr[arg].l_item);
- if (land->lnd_tech >= lchr[arg].l_tech)
- break;
- arg = lchr[arg].l_tech;
- /* fall through */
+ break;
case 't':
arg = LIMIT_TO(arg, lcp->l_tech, SHRT_MAX);
divine_unit_change((struct empobj *)land, "Tech level",
divine_load((struct empobj *)land, EF_LAND, arg);
land->lnd_land = arg;
break;
+ case 'A':
+ arg = LIMIT_TO(arg, 0, PLG_EXPOSED);
+ divine_unit_change_quiet((struct empobj *)land, "Plague stage",
+ arg != land->lnd_pstage,
+ "from %d to %d", land->lnd_pstage, arg);
+ land->lnd_pstage = arg;
+ break;
+ case 'b':
+ arg = LIMIT_TO(arg, 0, 32767);
+ divine_unit_change_quiet((struct empobj *)land, "Plague time",
+ arg != land->lnd_ptime,
+ "from %d to %d", land->lnd_ptime, arg);
+ land->lnd_ptime = arg;
+ break;
case 'Z':
arg = LIMIT_TO(arg, 0, 100);
divine_unit_change((struct empobj *)land, "Retreat percentage",
divine_unit_change((struct empobj *)plane, "Type",
arg != plane->pln_type, 0,
"to %s", plchr[arg].pl_name);
+ if (plane->pln_tech < plchr[arg].pl_tech)
+ pln_set_tech(plane, plchr[arg].pl_tech);
+ if (plane->pln_range >= pln_range_max(plane))
+ /* preserve unlimited range, pln_set_tech() will adjust */
+ plane->pln_range = UCHAR_MAX;
plane->pln_type = arg;
- if (plane->pln_tech >= plchr[arg].pl_tech)
- break;
- arg = plchr[arg].pl_tech;
- /* fall through */
+ pln_set_tech(plane, plane->pln_tech);
+ break;
case 't':
arg = LIMIT_TO(arg, pcp->pl_tech, SHRT_MAX);
divine_unit_change((struct empobj *)plane, "Tech level",
divine_unit_change((struct empobj *)nuke, "Type",
arg != nuke->nuk_type, 0,
"to %s", nchr[arg].n_name);
+ if (nuke->nuk_tech < nchr[arg].n_tech)
+ nuke->nuk_tech = nchr[arg].n_tech;
nuke->nuk_type = arg;
- if (nuke->nuk_tech >= nchr[arg].n_tech)
- break;
- arg = nchr[arg].n_tech;
- /* fall through */
+ break;
case 'T':
arg = LIMIT_TO(arg, ncp->n_tech, SHRT_MAX);
divine_unit_change((struct empobj *)nuke, "Tech level",