diff --git a/include/commodity.h b/include/commodity.h index e3545785..38ef0990 100644 --- a/include/commodity.h +++ b/include/commodity.h @@ -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 */ diff --git a/include/empobj.h b/include/empobj.h index 713f2f4a..3906c13a 100644 --- a/include/empobj.h +++ b/include/empobj.h @@ -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 */ diff --git a/include/file.h b/include/file.h index 9aa6f389..0ffa5b0c 100644 --- a/include/file.h +++ b/include/file.h @@ -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); diff --git a/include/game.h b/include/game.h index 9f77dc0f..b10426fc 100644 --- a/include/game.h +++ b/include/game.h @@ -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? */ diff --git a/include/journal.h b/include/journal.h index ed2224a3..b52e14b1 100644 --- a/include/journal.h +++ b/include/journal.h @@ -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 diff --git a/include/land.h b/include/land.h index 6f5232ff..99f9c301 100644 --- a/include/land.h +++ b/include/land.h @@ -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 */ diff --git a/include/loan.h b/include/loan.h index f4f900f7..fbfe1568 100644 --- a/include/loan.h +++ b/include/loan.h @@ -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 */ diff --git a/include/lost.h b/include/lost.h index d30f8e85..021f2633 100644 --- a/include/lost.h +++ b/include/lost.h @@ -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 */ diff --git a/include/nat.h b/include/nat.h index 5749a1bd..e4c135f9 100644 --- a/include/nat.h +++ b/include/nat.h @@ -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 */ diff --git a/include/news.h b/include/news.h index 24554f09..01a47826 100644 --- a/include/news.h +++ b/include/news.h @@ -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 # */ diff --git a/include/nuke.h b/include/nuke.h index 231f0a04..bb1efd53 100644 --- a/include/nuke.h +++ b/include/nuke.h @@ -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 */ diff --git a/include/plane.h b/include/plane.h index 8e37d0d2..5e809e2d 100644 --- a/include/plane.h +++ b/include/plane.h @@ -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 */ diff --git a/include/sect.h b/include/sect.h index 336b71f1..f242b22f 100644 --- a/include/sect.h +++ b/include/sect.h @@ -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 */ diff --git a/include/ship.h b/include/ship.h index 21e749f5..a8762d57 100644 --- a/include/ship.h +++ b/include/ship.h @@ -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 */ diff --git a/include/trade.h b/include/trade.h index 6fc9919e..26449ae8 100644 --- a/include/trade.h +++ b/include/trade.h @@ -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 */ diff --git a/include/treaty.h b/include/treaty.h index 0e164eef..e70c2f98 100644 --- a/include/treaty.h +++ b/include/treaty.h @@ -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 */ diff --git a/info/Hvy-Plastic.t b/info/Hvy-Plastic.t new file mode 100644 index 00000000..8bdfe622 --- /dev/null +++ b/info/Hvy-Plastic.t @@ -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" diff --git a/src/lib/commands/assa.c b/src/lib/commands/assa.c index 2d121a1c..97b138c4 100644 --- a/src/lib/commands/assa.c +++ b/src/lib/commands/assa.c @@ -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, diff --git a/src/lib/commands/bomb.c b/src/lib/commands/bomb.c index f959e06d..589e5b73 100644 --- a/src/lib/commands/bomb.c +++ b/src/lib/commands/bomb.c @@ -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) { diff --git a/src/lib/commands/tend.c b/src/lib/commands/tend.c index 2c7dba37..c859d488 100644 --- a/src/lib/commands/tend.c +++ b/src/lib/commands/tend.c @@ -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 && diff --git a/src/lib/common/cargo.c b/src/lib/common/cargo.c index 59ccf84b..d0c84d72 100644 --- a/src/lib/common/cargo.c +++ b/src/lib/common/cargo.c @@ -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); } } diff --git a/src/lib/common/file.c b/src/lib/common/file.c index 908b024b..16633eee 100644 --- a/src/lib/common/file.c +++ b/src/lib/common/file.c @@ -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); } /* diff --git a/src/lib/empthread/io.c b/src/lib/empthread/io.c index 5bbce8d9..3fcf164b 100644 --- a/src/lib/empthread/io.c +++ b/src/lib/empthread/io.c @@ -51,6 +51,7 @@ #include #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 diff --git a/src/lib/empthread/lwp.c b/src/lib/empthread/lwp.c index 03bf4a64..66015a78 100644 --- a/src/lib/empthread/lwp.c +++ b/src/lib/empthread/lwp.c @@ -37,6 +37,7 @@ #include #include #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); } diff --git a/src/lib/player/dispatch.c b/src/lib/player/dispatch.c index f629f5d3..50c0f43d 100644 --- a/src/lib/player/dispatch.c +++ b/src/lib/player/dispatch.c @@ -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; diff --git a/src/lib/player/player.c b/src/lib/player/player.c index cab28d43..030fe0e5 100644 --- a/src/lib/player/player.c +++ b/src/lib/player/player.c @@ -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); diff --git a/src/lib/subs/check.c b/src/lib/subs/check.c index f20f9617..6623a3ef 100644 --- a/src/lib/subs/check.c +++ b/src/lib/subs/check.c @@ -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 diff --git a/src/lib/subs/journal.c b/src/lib/subs/journal.c index cd187132..ffe59f7d 100644 --- a/src/lib/subs/journal.c +++ b/src/lib/subs/journal.c @@ -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) { diff --git a/src/lib/subs/nreport.c b/src/lib/subs/nreport.c index 0bce9462..bcb9be58 100644 --- a/src/lib/subs/nreport.c +++ b/src/lib/subs/nreport.c @@ -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); /* diff --git a/src/lib/subs/pr.c b/src/lib/subs/pr.c index 3ba199ee..76b0faa8 100644 --- a/src/lib/subs/pr.c +++ b/src/lib/subs/pr.c @@ -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); } /* diff --git a/src/lib/subs/supply.c b/src/lib/subs/supply.c index 2650d33f..853e77fb 100644 --- a/src/lib/subs/supply.c +++ b/src/lib/subs/supply.c @@ -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; } /* diff --git a/src/lib/update/land.c b/src/lib/update/land.c index 81ca77d3..41cc5682 100644 --- a/src/lib/update/land.c +++ b/src/lib/update/land.c @@ -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, diff --git a/src/lib/update/nav_ship.c b/src/lib/update/nav_ship.c index d57ed6aa..bb44bedb 100644 --- a/src/lib/update/nav_ship.c +++ b/src/lib/update/nav_ship.c @@ -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); diff --git a/src/lib/update/plane.c b/src/lib/update/plane.c index f764f17c..dea614c0 100644 --- a/src/lib/update/plane.c +++ b/src/lib/update/plane.c @@ -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, diff --git a/src/lib/update/sail.c b/src/lib/update/sail.c index a1588759..85570e38 100644 --- a/src/lib/update/sail.c +++ b/src/lib/update/sail.c @@ -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); } diff --git a/src/util/fairland.c b/src/util/fairland.c index 08d2af28..88fe72ef 100644 --- a/src/util/fairland.c +++ b/src/util/fairland.c @@ -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); }