Compare commits
21 commits
master
...
hvy-plasti
Author | SHA1 | Date | |
---|---|---|---|
9731e6692a | |||
bdcd59155a | |||
f571a37cde | |||
957f774a90 | |||
56f2ca96f7 | |||
2900de1f63 | |||
56c28caf5b | |||
b8804d1cc0 | |||
551676d5f2 | |||
48ba06732c | |||
839c6001d3 | |||
ddbf8c482b | |||
8ebed5ba05 | |||
bba8db34d0 | |||
20b31defe7 | |||
f8be963202 | |||
1bf3f557e9 | |||
9a19dc973a | |||
87512fb644 | |||
c4687e15d5 | |||
1c1fa720d4 |
36 changed files with 225 additions and 12 deletions
|
@ -45,6 +45,7 @@ struct comstr {
|
|||
short ef_type;
|
||||
short com_uid;
|
||||
unsigned com_seqno;
|
||||
unsigned com_generation;
|
||||
time_t com_timestamp;
|
||||
natid com_owner;
|
||||
/* end of part matching struct empobj */
|
||||
|
|
|
@ -58,6 +58,7 @@ struct empobj {
|
|||
short ef_type;
|
||||
short uid;
|
||||
unsigned seqno;
|
||||
unsigned generation;
|
||||
time_t timestamp;
|
||||
/* end of part matching struct emptypedstr */
|
||||
natid own; /* valid if EFF_OWNER is in table's flags */
|
||||
|
|
|
@ -88,6 +88,7 @@ struct emptypedstr {
|
|||
short ef_type;
|
||||
short uid;
|
||||
unsigned seqno;
|
||||
unsigned generation;
|
||||
time_t timestamp;
|
||||
};
|
||||
|
||||
|
@ -203,6 +204,8 @@ enum {
|
|||
|
||||
extern struct castr *ef_cadef(int);
|
||||
extern int ef_read(int, int, void *);
|
||||
extern void ef_make_stale(void);
|
||||
extern void ef_mark_fresh(int, void *);
|
||||
extern void *ef_ptr(int, int);
|
||||
extern char *ef_nameof(int);
|
||||
extern time_t ef_mtime(int);
|
||||
|
|
|
@ -41,6 +41,7 @@ struct gamestr {
|
|||
short ef_type;
|
||||
short game_uid;
|
||||
unsigned game_seqno;
|
||||
unsigned game_generation;
|
||||
time_t game_timestamp;
|
||||
/* end of part matching struct empobj */
|
||||
char game_upd_disable; /* updates disabled? */
|
||||
|
|
|
@ -34,13 +34,17 @@
|
|||
#ifndef JOURNAL_H
|
||||
#define JOURNAL_H
|
||||
|
||||
struct player; /* FIXME temporary hack */
|
||||
|
||||
int journal_startup(void);
|
||||
void journal_shutdown(void);
|
||||
int journal_reopen(void);
|
||||
void journal_login(void);
|
||||
void journal_logout(void);
|
||||
void journal_prng(unsigned);
|
||||
void journal_output(struct player *, int, char *);
|
||||
void journal_input(char *);
|
||||
void journal_command(char *);
|
||||
void journal_update(int);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -52,6 +52,7 @@ struct lndstr {
|
|||
short ef_type;
|
||||
short lnd_uid; /* unit id (land unit) */
|
||||
unsigned lnd_seqno;
|
||||
unsigned lnd_generation;
|
||||
time_t lnd_timestamp; /* Last time this unit was touched */
|
||||
natid lnd_own; /* owner's country num */
|
||||
coord lnd_x; /* x location in abs coords */
|
||||
|
|
|
@ -45,6 +45,7 @@ struct lonstr {
|
|||
short ef_type;
|
||||
short l_uid;
|
||||
unsigned l_seqno;
|
||||
unsigned l_generation;
|
||||
time_t l_timestamp;
|
||||
/* end of part matching struct empobj */
|
||||
natid l_loner; /* loan shark */
|
||||
|
|
|
@ -42,6 +42,7 @@ struct loststr {
|
|||
short ef_type;
|
||||
short lost_uid;
|
||||
unsigned lost_seqno;
|
||||
unsigned lost_generation;
|
||||
time_t lost_timestamp; /* When it was lost */
|
||||
natid lost_owner; /* Who lost it */
|
||||
/* end of part matching struct empobj */
|
||||
|
|
|
@ -73,6 +73,7 @@ struct realmstr {
|
|||
short ef_type;
|
||||
short r_uid; /* realm table index */
|
||||
unsigned r_seqno;
|
||||
unsigned r_generation;
|
||||
time_t r_timestamp; /* Last time this realm was touched */
|
||||
natid r_cnum; /* country number */
|
||||
/* end of part matching struct empobj */
|
||||
|
@ -86,6 +87,7 @@ struct natstr {
|
|||
short ef_type;
|
||||
short nat_uid; /* equals nat_cnum */
|
||||
unsigned nat_seqno;
|
||||
unsigned nat_generation;
|
||||
time_t nat_timestamp;
|
||||
natid nat_cnum; /* our country number */
|
||||
/* end of part matching struct empobj */
|
||||
|
|
|
@ -49,6 +49,7 @@ struct nwsstr {
|
|||
short ef_type;
|
||||
short nws_uid;
|
||||
unsigned nws_seqno;
|
||||
unsigned nws_generation;
|
||||
time_t nws_timestamp;
|
||||
/* end of part matching struct empobj */
|
||||
natid nws_ano; /* "actor" country # */
|
||||
|
|
|
@ -45,6 +45,7 @@ struct nukstr {
|
|||
short ef_type;
|
||||
short nuk_uid;
|
||||
unsigned nuk_seqno;
|
||||
unsigned nuk_generation;
|
||||
time_t nuk_timestamp; /* Last time this nuke was touched */
|
||||
natid nuk_own;
|
||||
coord nuk_x, nuk_y; /* current loc of device */
|
||||
|
|
|
@ -49,6 +49,7 @@ struct plnstr {
|
|||
short ef_type;
|
||||
short pln_uid; /* plane unit id */
|
||||
unsigned pln_seqno;
|
||||
unsigned pln_generation;
|
||||
time_t pln_timestamp; /* Last time this plane was touched */
|
||||
natid pln_own; /* owning country */
|
||||
coord pln_x; /* plane x-y */
|
||||
|
|
|
@ -47,6 +47,7 @@ struct sctstr {
|
|||
short ef_type;
|
||||
short sct_uid; /* equals XYOFFSET(sct_x, sct_y) */
|
||||
unsigned sct_seqno;
|
||||
unsigned sct_generation;
|
||||
time_t sct_timestamp; /* Last time this sector was written to */
|
||||
natid sct_own; /* owner's country num */
|
||||
coord sct_x; /* x coord of sector */
|
||||
|
|
|
@ -66,6 +66,7 @@ struct shpstr {
|
|||
short ef_type;
|
||||
short shp_uid; /* unit id (ship #) */
|
||||
unsigned shp_seqno;
|
||||
unsigned shp_generation;
|
||||
time_t shp_timestamp; /* Last time this ship was touched. */
|
||||
natid shp_own; /* owner's country num */
|
||||
coord shp_x; /* x location in abs coords */
|
||||
|
|
|
@ -45,6 +45,7 @@ struct trdstr {
|
|||
short ef_type;
|
||||
short trd_uid;
|
||||
unsigned trd_seqno;
|
||||
unsigned trd_generation;
|
||||
time_t trd_timestamp;
|
||||
natid trd_owner;
|
||||
/* end of part matching struct empobj */
|
||||
|
|
|
@ -42,6 +42,7 @@ struct trtstr {
|
|||
short ef_type;
|
||||
short trt_uid;
|
||||
unsigned trt_seqno;
|
||||
unsigned trt_generation;
|
||||
time_t trt_timestamp;
|
||||
/* end of part matching struct empobj */
|
||||
natid trt_cna; /* proposer */
|
||||
|
|
54
info/Hvy-Plastic.t
Normal file
54
info/Hvy-Plastic.t
Normal file
|
@ -0,0 +1,54 @@
|
|||
.TH Concept "Hvy-Plastic"
|
||||
.NA Hvy-Plastic "Special rules for Hvy Plastic"
|
||||
.LV Basic
|
||||
.s1
|
||||
Ship types are customized. Better check show for the details.
|
||||
.s1
|
||||
Dreadnoughts are more heavily armored. Frigates are more fragile.
|
||||
.s1
|
||||
More ships can carry choppers. Some ships are not ideal for this, and
|
||||
this is reflected by the lack of large petrol and shell storage.
|
||||
.s1
|
||||
Land unit types are heavily customized. Better check show for the
|
||||
details. Non-mechanized units are slower and more vulnerable,
|
||||
artillery firing ranges differ, few units are light (but troop
|
||||
transports and landing ships can carry non-light units).
|
||||
.s1
|
||||
Planes are tweaked somewhat. show is your friend.
|
||||
.s1
|
||||
Nukes are on sale, but nuclear plants are not. Did I mention the show
|
||||
command?
|
||||
.s1
|
||||
Infrastructure is disabled.
|
||||
.s1
|
||||
Your refineries make less petrol from each barrel of oil than usual.
|
||||
.s1
|
||||
Natural resources gold, oil and uran deplete much slower than usual.
|
||||
A 100% gold resource contains 2500d, a 100% oil resource contains
|
||||
2500o, and a 100% uranium resource contains 500u. Fully depleting a
|
||||
sector will take you several updates, and a small fraction of the
|
||||
resource contents will be lost.
|
||||
.s1
|
||||
Gold in mountains does not deplete at all.
|
||||
.s1
|
||||
Oil production does not depend on tech; you don't have to micro-manage
|
||||
to conserve oil.
|
||||
.s1
|
||||
Ship capability anti-missile is disabled because of bugs.
|
||||
.s1
|
||||
Server time is in UTC, which means there will be no daylight savings
|
||||
time.
|
||||
.s1
|
||||
Missed updates due to server problems will be forced if caught within
|
||||
15 minutes of planned update time or skipped otherwise.
|
||||
.s1
|
||||
Everything you do in this game is logged by the deities for their own
|
||||
nefarious purposes. However, the logs are treated confidentially.
|
||||
.s1
|
||||
Make the deity laugh and get up to 5 gold bars.
|
||||
.s1
|
||||
Source code and configuration is available from
|
||||
.br
|
||||
http://www.pond.sub.org/~armbru/empire/hvy-plastic.html
|
||||
.s1
|
||||
.SA "Introduction, Server, show"
|
|
@ -181,7 +181,7 @@ assa(void)
|
|||
pr(" and was killed in the attempt.\n");
|
||||
llp->unit.land.lnd_effic = 0;
|
||||
putland(llp->unit.land.lnd_uid, &llp->unit.land);
|
||||
lnd_delete(llp, "");
|
||||
lnd_delete(llp, NULL);
|
||||
} else {
|
||||
wu(0, def->own, "%s spy spotted in %s.\n",
|
||||
cname(player->cnum), xyas(def->x, def->y,
|
||||
|
|
|
@ -157,6 +157,11 @@ bomb(void)
|
|||
plp = (struct plist *)qp;
|
||||
changed_plane_aborts(plp);
|
||||
}
|
||||
for (qp = esc_list.q_forw; qp != &esc_list; qp = next) {
|
||||
next = qp->q_forw;
|
||||
plp = (struct plist *)qp;
|
||||
changed_plane_aborts(plp);
|
||||
}
|
||||
break;
|
||||
case 's':
|
||||
if (opt_SLOW_WAR) {
|
||||
|
|
|
@ -227,7 +227,7 @@ tend_land(struct shpstr *tenderp, char *units)
|
|||
if (!snxtitem(&targets, EF_SHIP,
|
||||
player->argp[4], "Ship to be tended? "))
|
||||
return RET_FAIL;
|
||||
if (!check_land_ok(&land))
|
||||
if (!check_ship_ok(tenderp) || !check_land_ok(&land))
|
||||
return RET_SYN;
|
||||
while (nxtitem(&targets, &target)) {
|
||||
if (!player->owner &&
|
||||
|
|
|
@ -241,24 +241,33 @@ unit_cargo_init(void)
|
|||
unit_onresize(i);
|
||||
|
||||
for (i = 0; (pp = getplanep(i)); i++) {
|
||||
if (!pp->pln_own)
|
||||
if (!pp->pln_own) {
|
||||
if (CANT_HAPPEN(pp->pln_ship >= 0 || pp->pln_land >= 0))
|
||||
pp->pln_ship = pp->pln_land = -1;
|
||||
continue;
|
||||
}
|
||||
if (CANT_HAPPEN(pp->pln_ship >= 0 && pp->pln_land >= 0))
|
||||
pp->pln_land = -1;
|
||||
pln_carrier_change(pp, EF_SHIP, -1, pp->pln_ship);
|
||||
pln_carrier_change(pp, EF_LAND, -1, pp->pln_land);
|
||||
}
|
||||
for (i = 0; (lp = getlandp(i)); i++) {
|
||||
if (!lp->lnd_own)
|
||||
if (!lp->lnd_own) {
|
||||
if (CANT_HAPPEN(lp->lnd_ship >= 0 || lp->lnd_land >= 0))
|
||||
lp->lnd_ship = lp->lnd_land = -1;
|
||||
continue;
|
||||
}
|
||||
if (CANT_HAPPEN(lp->lnd_ship >= 0 && lp->lnd_land >= 0))
|
||||
lp->lnd_land = -1;
|
||||
lnd_carrier_change(lp, EF_SHIP, -1, lp->lnd_ship);
|
||||
lnd_carrier_change(lp, EF_LAND, -1, lp->lnd_land);
|
||||
}
|
||||
for (i = 0; (np = getnukep(i)); i++) {
|
||||
if (!np->nuk_own)
|
||||
if (!np->nuk_own) {
|
||||
if (CANT_HAPPEN(np->nuk_plane >= 0))
|
||||
np->nuk_plane = -1;
|
||||
continue;
|
||||
}
|
||||
nuk_carrier_change(np, EF_PLANE, -1, np->nuk_plane);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,9 +52,12 @@ static int do_read(struct empfile *, void *, int, int);
|
|||
static int do_write(struct empfile *, void *, int, int);
|
||||
static unsigned get_seqno(struct empfile *, int);
|
||||
static void new_seqno(struct empfile *, void *);
|
||||
static void must_be_fresh(struct empfile *, void *);
|
||||
static void do_blank(struct empfile *, void *, int, int);
|
||||
static int ef_check(int);
|
||||
|
||||
static unsigned ef_generation;
|
||||
|
||||
/*
|
||||
* Open the file-backed table TYPE (EF_SECTOR, ...).
|
||||
* HOW are flags to control operation. Naturally, immutable flags are
|
||||
|
@ -338,6 +341,7 @@ ef_read(int type, int id, void *into)
|
|||
cachep = ep->cache + (id - ep->baseid) * ep->size;
|
||||
}
|
||||
memcpy(into, cachep, ep->size);
|
||||
ef_mark_fresh(type, into);
|
||||
|
||||
if (ep->postread)
|
||||
ep->postread(id, into);
|
||||
|
@ -500,9 +504,11 @@ ef_write(int type, int id, void *from)
|
|||
if (ep->onresize && ep->onresize(type) < 0)
|
||||
return 0;
|
||||
}
|
||||
if (id >= ep->baseid && id < ep->baseid + ep->cids)
|
||||
if (id >= ep->baseid && id < ep->baseid + ep->cids) {
|
||||
cachep = ep->cache + (id - ep->baseid) * ep->size;
|
||||
else
|
||||
if (cachep != from)
|
||||
must_be_fresh(ep, from);
|
||||
} else
|
||||
cachep = NULL;
|
||||
if (ep->prewrite)
|
||||
ep->prewrite(id, cachep, from);
|
||||
|
@ -586,6 +592,35 @@ new_seqno(struct empfile *ep, void *buf)
|
|||
elt->seqno = old_seqno + 1;
|
||||
}
|
||||
|
||||
void
|
||||
ef_make_stale(void)
|
||||
{
|
||||
ef_generation++;
|
||||
}
|
||||
|
||||
void
|
||||
ef_mark_fresh(int type, void *buf)
|
||||
{
|
||||
struct empfile *ep;
|
||||
|
||||
if (ef_check(type) < 0)
|
||||
return;
|
||||
ep = &empfile[type];
|
||||
if (!(ep->flags & EFF_TYPED))
|
||||
return;
|
||||
((struct emptypedstr *)buf)->generation = ef_generation;
|
||||
}
|
||||
|
||||
static void
|
||||
must_be_fresh(struct empfile *ep, void *buf)
|
||||
{
|
||||
struct emptypedstr *elt = buf;
|
||||
|
||||
if (!(ep->flags & EFF_TYPED))
|
||||
return;
|
||||
CANT_HAPPEN(elt->generation != ef_generation);
|
||||
}
|
||||
|
||||
/*
|
||||
* Extend table TYPE by COUNT elements.
|
||||
* Any pointers obtained from ef_ptr() become invalid.
|
||||
|
@ -663,6 +698,7 @@ ef_blank(int type, int id, void *buf)
|
|||
elt = buf;
|
||||
elt->seqno = get_seqno(ep, elt->uid);
|
||||
}
|
||||
ef_mark_fresh(type, buf);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include <unistd.h>
|
||||
#include "empio.h"
|
||||
#include "empthread.h"
|
||||
#include "file.h"
|
||||
#include "ioqueue.h"
|
||||
#include "misc.h"
|
||||
#include "queue.h"
|
||||
|
@ -123,6 +124,9 @@ io_input(struct iop *iop, int waitforinput)
|
|||
int cc;
|
||||
int res;
|
||||
|
||||
if (waitforinput)
|
||||
ef_make_stale();
|
||||
|
||||
/* Not a read IOP */
|
||||
if ((iop->flags & IO_READ) == 0) {
|
||||
errno = EBADF;
|
||||
|
@ -183,6 +187,9 @@ io_output(struct iop *iop, int waitforoutput)
|
|||
int n;
|
||||
int remain;
|
||||
|
||||
if (waitforoutput)
|
||||
ef_make_stale();
|
||||
|
||||
/* If there is no output waiting. */
|
||||
if (!io_outputwaiting(iop))
|
||||
return 0;
|
||||
|
@ -264,6 +271,9 @@ io_write(struct iop *iop, char *buf, int nbytes, int doWait)
|
|||
{
|
||||
int len;
|
||||
|
||||
if (doWait)
|
||||
ef_make_stale();
|
||||
|
||||
if ((iop->flags & IO_WRITE) == 0)
|
||||
return -1;
|
||||
ioq_append(iop->output, buf, nbytes);
|
||||
|
@ -285,6 +295,8 @@ io_output_all(struct iop *iop)
|
|||
{
|
||||
int n;
|
||||
|
||||
ef_make_stale();
|
||||
|
||||
/*
|
||||
* Mustn't block a player thread while update is pending, or else
|
||||
* a malicous player could delay the update indefinitely
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include <signal.h>
|
||||
#include <time.h>
|
||||
#include "empthread.h"
|
||||
#include "file.h"
|
||||
#include "misc.h"
|
||||
|
||||
/* Flags that were passed to empth_init() */
|
||||
|
@ -65,6 +66,7 @@ empth_create(void (*entry)(void *), int size, int flags,
|
|||
{
|
||||
if (!flags)
|
||||
flags = empth_flags;
|
||||
ef_make_stale();
|
||||
return lwpCreate(1, entry, size, flags, name, 0, 0, ud);
|
||||
}
|
||||
|
||||
|
@ -89,18 +91,21 @@ empth_set_name(empth_t *thread, char *name)
|
|||
void
|
||||
empth_exit(void)
|
||||
{
|
||||
ef_make_stale();
|
||||
lwpExit();
|
||||
}
|
||||
|
||||
void
|
||||
empth_yield(void)
|
||||
{
|
||||
ef_make_stale();
|
||||
lwpYield();
|
||||
}
|
||||
|
||||
int
|
||||
empth_select(int fd, int flags, struct timeval *timeout)
|
||||
{
|
||||
ef_make_stale();
|
||||
return lwpSleepFd(fd, flags, timeout);
|
||||
}
|
||||
|
||||
|
@ -113,6 +118,7 @@ empth_wakeup(empth_t *a)
|
|||
int
|
||||
empth_sleep(time_t until)
|
||||
{
|
||||
ef_make_stale();
|
||||
return lwpSleepUntil(until);
|
||||
}
|
||||
|
||||
|
@ -123,6 +129,7 @@ empth_wait_for_signal(void)
|
|||
int sig, err;
|
||||
time_t now;
|
||||
|
||||
ef_make_stale();
|
||||
sigemptyset(&set);
|
||||
sigaddset(&set, SIGHUP);
|
||||
sigaddset(&set, SIGINT);
|
||||
|
@ -153,12 +160,14 @@ empth_rwlock_destroy(empth_rwlock_t *rwlock)
|
|||
void
|
||||
empth_rwlock_wrlock(empth_rwlock_t *rwlock)
|
||||
{
|
||||
ef_make_stale();
|
||||
lwp_rwlock_wrlock(rwlock);
|
||||
}
|
||||
|
||||
void
|
||||
empth_rwlock_rdlock(empth_rwlock_t *rwlock)
|
||||
{
|
||||
ef_make_stale();
|
||||
lwp_rwlock_rdlock(rwlock);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "com.h"
|
||||
#include "empio.h"
|
||||
#include "file.h"
|
||||
#include "journal.h"
|
||||
#include "match.h"
|
||||
#include "misc.h"
|
||||
#include "nat.h"
|
||||
|
@ -102,6 +103,7 @@ dispatch(char *buf, char *redir)
|
|||
uprnf(buf);
|
||||
pr("\n");
|
||||
}
|
||||
journal_command(command->c_form);
|
||||
switch (command->c_addr()) {
|
||||
case RET_OK:
|
||||
player->btused += command->c_cost;
|
||||
|
|
|
@ -121,7 +121,7 @@ command(void)
|
|||
time_t now;
|
||||
|
||||
if (getcommand(player->combuf) < 0)
|
||||
return 0;
|
||||
return player->aborted;
|
||||
|
||||
now = time(NULL);
|
||||
update_timeused(now);
|
||||
|
|
|
@ -52,7 +52,11 @@ obj_changed(struct empobj *obj, size_t sz)
|
|||
get_empobj(obj->ef_type, obj->uid, &old);
|
||||
memcpy(&tobj, obj, sz);
|
||||
old.gen.timestamp = tobj.gen.timestamp = 0;
|
||||
return memcmp(&tobj, &old, sz);
|
||||
old.gen.generation = tobj.gen.generation = 0;
|
||||
if (memcmp(&tobj, &old, sz))
|
||||
return 1;
|
||||
ef_mark_fresh(obj->ef_type, obj);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -44,7 +44,9 @@
|
|||
* prng NAME SEED
|
||||
* login CNUM HOSTADDR USER
|
||||
* logout CNUM
|
||||
* command NAME
|
||||
* input INPUT
|
||||
* output THREAD ID OUTPUT
|
||||
* update ETU
|
||||
*/
|
||||
|
||||
|
@ -67,6 +69,7 @@ static FILE *journal;
|
|||
|
||||
static void journal_entry(char *fmt, ...)
|
||||
ATTRIBUTE((format (printf, 1, 2)));
|
||||
static void journal_output_1(struct player *, int, char *, char *, int);
|
||||
|
||||
static FILE *
|
||||
journal_open(void)
|
||||
|
@ -98,7 +101,8 @@ journal_entry(char *fmt, ...)
|
|||
fprintf(journal, "\\%03o", *p);
|
||||
}
|
||||
fputs("\n", journal);
|
||||
fflush(journal);
|
||||
if (fmt[0] != 'o') /* FIXME disgusting hack */
|
||||
fflush(journal);
|
||||
if (ferror(journal)) {
|
||||
logerror("Error writing journal (%s)", strerror(errno));
|
||||
clearerr(journal);
|
||||
|
@ -167,12 +171,57 @@ journal_logout(void)
|
|||
journal_entry("logout %d", player->cnum);
|
||||
}
|
||||
|
||||
void
|
||||
journal_output(struct player *pl, int id, char *output)
|
||||
{
|
||||
static char buf[1024];
|
||||
static struct player *bpl;
|
||||
static int bid;
|
||||
char *s, *e;
|
||||
|
||||
if (keep_journal < 2)
|
||||
return;
|
||||
|
||||
if (buf[0] && (pl != bpl && id != bid)) {
|
||||
journal_output_1(bpl, bid, buf, "", -1);
|
||||
buf[0] = 0;
|
||||
}
|
||||
|
||||
for (s = output; (e = strchr(s, '\n')); s = e + 1) {
|
||||
journal_output_1(pl, id, buf, s, (int)(e + 1 - s));
|
||||
buf[0] = 0;
|
||||
}
|
||||
if (strlen(buf) + strlen(s) < 1024) {
|
||||
strcpy(buf + strlen(buf), s);
|
||||
bpl = pl;
|
||||
bid = id;
|
||||
} else {
|
||||
journal_output_1(pl, id, buf, s, -1);
|
||||
buf[0] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
journal_output_1(struct player *pl, int id,
|
||||
char *buf1, char *buf2, int buf2prec)
|
||||
{
|
||||
journal_entry("output %s %d %s%.*s",
|
||||
empth_name(empth_self()), id, buf1, buf2prec, buf2);
|
||||
}
|
||||
|
||||
void
|
||||
journal_input(char *input)
|
||||
{
|
||||
journal_entry("input %s", input);
|
||||
}
|
||||
|
||||
void
|
||||
journal_command(char *cmd)
|
||||
{
|
||||
char *eptr = strchr(cmd, ' ');
|
||||
journal_entry("command %.*s", eptr ? (int)(eptr - cmd) : -1, cmd);
|
||||
}
|
||||
|
||||
void
|
||||
journal_update(int etu)
|
||||
{
|
||||
|
|
|
@ -61,6 +61,8 @@ nreport(natid actor, int event, natid victim, int times)
|
|||
return;
|
||||
|
||||
np = ncache(actor, event, victim, times);
|
||||
/* TODO get rid of nws_generation? */
|
||||
ef_mark_fresh(EF_NEWS, np);
|
||||
putnews(np->nws_uid, np);
|
||||
|
||||
/*
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
#include "com.h"
|
||||
#include "empio.h"
|
||||
#include "file.h"
|
||||
#include "journal.h"
|
||||
#include "misc.h"
|
||||
#include "nat.h"
|
||||
#include "player.h"
|
||||
|
@ -124,6 +125,7 @@ pr_id(struct player *p, int id, char *format, ...)
|
|||
|
||||
if (p->curid >= 0) {
|
||||
io_puts(p->iop, "\n");
|
||||
journal_output(p, p->curid, "\n");
|
||||
p->curid = -1;
|
||||
}
|
||||
va_start(ap, format);
|
||||
|
@ -245,6 +247,7 @@ pr_player(struct player *pl, int id, char *buf)
|
|||
bp += len;
|
||||
}
|
||||
}
|
||||
journal_output(pl, id, buf);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -299,6 +302,7 @@ upr_player(struct player *pl, int id, char *buf)
|
|||
io_puts(pl->iop, printbuf);
|
||||
}
|
||||
}
|
||||
journal_output(pl, id, buf);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -402,7 +402,7 @@ s_commod(struct empobj *sink, short *vec,
|
|||
|
||||
if (actually_doit)
|
||||
put_empobj(sink->ef_type, sink->uid, sink);
|
||||
return wanted <= vec[type];
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -125,6 +125,7 @@ upd_land(struct lndstr *lp, int etus,
|
|||
makelost(EF_LAND, lp->lnd_own, lp->lnd_uid,
|
||||
lp->lnd_x, lp->lnd_y);
|
||||
lp->lnd_own = 0;
|
||||
lp->lnd_ship = lp->lnd_land = -1;
|
||||
return;
|
||||
}
|
||||
wu(0, lp->lnd_own,
|
||||
|
|
|
@ -268,6 +268,7 @@ nav_ship(struct shpstr *sp)
|
|||
mlp = malloc(sizeof(struct ulist));
|
||||
mlp->chrp = (struct empobj_chr *)(mchr + sp->shp_type);
|
||||
mlp->unit.ship = *sp;
|
||||
ef_mark_fresh(EF_SHIP, &mlp->unit.ship);
|
||||
mlp->mobil = sp->shp_mobil;
|
||||
emp_insque(&mlp->queue, &ship_list);
|
||||
|
||||
|
|
|
@ -110,6 +110,7 @@ upd_plane(struct plnstr *pp, int etus,
|
|||
makelost(EF_PLANE, pp->pln_own, pp->pln_uid,
|
||||
pp->pln_x, pp->pln_y);
|
||||
pp->pln_own = 0;
|
||||
pp->pln_ship = pp->pln_land = -1;
|
||||
return;
|
||||
}
|
||||
wu(0, pp->pln_own,
|
||||
|
|
|
@ -347,6 +347,7 @@ fltp_to_list(struct fltheadstr *fltp, struct emp_qelem *list)
|
|||
sp = getshipp(fe->num);
|
||||
mlp->chrp = (struct empobj_chr *)(mchr + sp->shp_type);
|
||||
mlp->unit.ship = *sp;
|
||||
ef_mark_fresh(EF_SHIP, &mlp->unit.ship);
|
||||
mlp->mobil = fe->mobil;
|
||||
emp_insque(&mlp->queue, list);
|
||||
}
|
||||
|
|
|
@ -821,7 +821,7 @@ grow_islands(void)
|
|||
secs = 0;
|
||||
if (!place_island(c, &x, &y))
|
||||
return;
|
||||
isiz = 1 + rnd(2 * is - 1);
|
||||
isiz = 1 + rnd(is) + rnd(is);
|
||||
do {
|
||||
++secs;
|
||||
find_coast(c);
|
||||
|
@ -1092,6 +1092,7 @@ write_sects(void)
|
|||
sct->sct_type = SCT_MOUNT;
|
||||
sct->sct_elev = total;
|
||||
sct->sct_newtype = sct->sct_type;
|
||||
sct->sct_dterr = own[sct->sct_x][y] + 1;
|
||||
if (ORE)
|
||||
add_resources(sct);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue