bugfix fogle schiff. bugfix doppeltes move. FL_LONGACTION

This commit is contained in:
Enno Rehling 2001-02-18 10:06:10 +00:00
parent 1e6647b539
commit 2cc18d8c83
21 changed files with 89 additions and 132 deletions

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: economy.c,v 1.6 2001/02/10 19:24:04 enno Exp $ * $Id: economy.c,v 1.7 2001/02/18 10:06:08 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -2813,7 +2813,7 @@ produce(void)
for (u = r->units; u; u = u->next) { for (u = r->units; u; u = u->next) {
strlist * s; strlist * s;
if (u->race == RC_SPELL || fval(u, FL_HADBATTLE)) if (u->race == RC_SPELL || fval(u, FL_LONGACTION))
continue; continue;
if (rterrain(r) == T_GLACIER && u->race == RC_INSECT && if (rterrain(r) == T_GLACIER && u->race == RC_INSECT &&

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: laws.c,v 1.26 2001/02/18 09:35:14 corwin Exp $ * $Id: laws.c,v 1.27 2001/02/18 10:06:08 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -2204,67 +2204,6 @@ reorder_owners(region * r)
#endif #endif
} }
#if 0
static void
reorder_owners(region * r)
{
unit * us[4096];
unit * u, **ui = &r->units;
unit ** first;
building * b;
ship * sh;
int i = 0;
int end;
if (rbuildings(r)==NULL && r->ships==NULL) return;
for (u=r->units;u;u=u->next) us[i++] = u;
end = i;
for (b=rbuildings(r);b;b=b->next) {
first = NULL;
for (i=0;i!=end;++i) if (us[i] && us[i]->building==b) {
if (!first) first = ui;
if (fval(us[i], FL_OWNER) && first != ui) {
us[i]->next = *first;
*first = us[i];
} else {
*ui = us[i];
ui = &us[i]->next;
}
us[i] = NULL;
}
u = buildingowner(r, b);
if (!fval(u, FL_OWNER)) {
fprintf(stderr, "WARNING: Gebäude %s hatte keinen Besitzer. Setze %s\n", buildingname(b), unitname(u));
fset(u, FL_OWNER);
}
}
for (i=0;i!=end;++i) if (us[i] && us[i]->ship==NULL) {
*ui = us[i];
ui = &us[i]->next;
us[i] = NULL;
}
for (sh=r->ships;sh;sh=sh->next) {
first = NULL;
for (i=0;i!=end;++i) if (us[i] && us[i]->ship==sh) {
if (!first) first = ui;
if (fval(us[i], FL_OWNER) && first != ui) {
us[i]->next = *first;
*first = us[i];
} else {
*ui = us[i];
ui = &us[i]->next;
}
us[i] = NULL;
}
u = shipowner(r, sh);
if (!fval(u, FL_OWNER)) {
fprintf(stderr, "WARNING: Das Schiff %s hatte keinen Besitzer. Setze %s\n", shipname(sh), unitname(u));
fset(u, FL_OWNER);
}
}
*ui = NULL;
}
#endif
static attrib_type at_number = { static attrib_type at_number = {
"faction_renum", "faction_renum",
@ -2749,8 +2688,10 @@ setdefaults (void)
/* Wenn die Einheit handelt, muß der Default-Befehl gelöscht /* Wenn die Einheit handelt, muß der Default-Befehl gelöscht
* werden. */ * werden. */
if(trade == true) set_string(&u->thisorder, ""); if(trade == true) {
fset(u, FL_LONGACTION);
set_string(&u->thisorder, "");
}
/* thisorder kopieren wir nun nach lastorder. in lastorder steht /* thisorder kopieren wir nun nach lastorder. in lastorder steht
* der DEFAULT befehl der einheit. da MOVE kein default werden * der DEFAULT befehl der einheit. da MOVE kein default werden
* darf, wird MOVE nicht in lastorder kopiert. MACHE TEMP wurde ja * darf, wird MOVE nicht in lastorder kopiert. MACHE TEMP wurde ja

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: study.c,v 1.6 2001/02/11 09:42:57 katze Exp $ * $Id: study.c,v 1.7 2001/02/18 10:06:08 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -586,7 +586,7 @@ teaching(void)
for (u = r->units; u; u = u->next) { for (u = r->units; u; u = u->next) {
if (u->race == RC_SPELL || fval(u, FL_HADBATTLE)) if (u->race == RC_SPELL || fval(u, FL_LONGACTION))
continue; continue;
if (rterrain(r) == T_OCEAN && u->race != RC_AQUARIAN) if (rterrain(r) == T_OCEAN && u->race != RC_AQUARIAN)

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: battle.c,v 1.15 2001/02/14 20:09:48 enno Exp $ * $Id: battle.c,v 1.16 2001/02/18 10:06:09 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -2237,7 +2237,7 @@ aftermath(battle * b)
int n; int n;
if (relevant && df->action_counter >= df->unit->number) { if (relevant && df->action_counter >= df->unit->number) {
fset(df->unit, FL_HADBATTLE); fset(df->unit, FL_LONGACTION);
/* TODO: das sollte hier weg sobald anderswo üb /* TODO: das sollte hier weg sobald anderswo üb
* erall HADBATTLE getestet wird. */ * erall HADBATTLE getestet wird. */
set_string(&du->thisorder, ""); set_string(&du->thisorder, "");
@ -2440,17 +2440,15 @@ aftermath(battle * b)
} }
} }
sh = r->ships;
if (battle_was_relevant) { if (battle_was_relevant) {
while (sh) { ship **sp = &r->ships;
while (*sp) {
ship * sh = *sp;
sh->drifted = false; sh->drifted = false;
if (sh->damage >= sh->size * DAMAGE_SCALE) { if (sh->damage >= sh->size * DAMAGE_SCALE) {
ship * sn = sh->next;
destroy_ship(sh, r); destroy_ship(sh, r);
sh = sn;
} else {
sh = sh->next;
} }
if (*sp==sh) sp=&sh->next;
} }
} }
#ifdef TROLLSAVE #ifdef TROLLSAVE
@ -3259,7 +3257,7 @@ do_battle(void)
/* list_foreach geht nicht, wegen flee() */ /* list_foreach geht nicht, wegen flee() */
for (u = r->units; u != NULL; u = u->next) { for (u = r->units; u != NULL; u = u->next) {
if (fval(u, FL_HADBATTLE)) continue; if (fval(u, FL_LONGACTION)) continue;
if (u->number > 0) { if (u->number > 0) {
strlist *sl; strlist *sl;

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: border.c,v 1.5 2001/02/12 22:39:56 enno Exp $ * $Id: border.c,v 1.6 2001/02/18 10:06:09 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -106,12 +106,12 @@ read_borders(FILE * f)
assert(type || !"border type not registered"); assert(type || !"border type not registered");
from = findregion(fx, fy); from = findregion(fx, fy);
if (!from) { if (!from) {
fputs("\aERROR: border for unknown regions\n", stderr); log_error(("ERROR: border for unknown region %d,%d\n", fx, fy));
from = new_region(fx, fy); from = new_region(fx, fy);
} }
to = findregion(tx, ty); to = findregion(tx, ty);
if (!to) { if (!to) {
fputs("\aERROR: border for unknown regions\n", stderr); log_error(("ERROR: border for unknown region %d,%d\n", tx, ty));
to = new_region(tx, ty); to = new_region(tx, ty);
} }
if (to==from) { if (to==from) {

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: build.c,v 1.7 2001/02/09 13:53:51 corwin Exp $ * $Id: build.c,v 1.8 2001/02/18 10:06:09 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -854,7 +854,7 @@ create_ship(region * r, unit * u, const struct ship_type * newtype, int want)
if (want>0) want = min(want, msize); if (want>0) want = min(want, msize);
else want = msize; else want = msize;
sh = new_ship(newtype); sh = new_ship(newtype, r);
addlist(&r->ships, sh); addlist(&r->ships, sh);

View File

@ -75,7 +75,7 @@ void create_ship(struct region * r, struct unit * u, const struct ship_type * ne
void continue_ship(struct region * r, struct unit * u, int size); void continue_ship(struct region * r, struct unit * u, int size);
struct building * getbuilding(const struct region * r); struct building * getbuilding(const struct region * r);
ship *getship(const struct region * r); struct ship *getship(const struct region * r);
void remove_contacts(void); void remove_contacts(void);
void do_leave(void); void do_leave(void);
@ -83,10 +83,10 @@ void do_misc(char try);
void reportevent(struct region * r, char *s); void reportevent(struct region * r, char *s);
void shash(ship * sh); void shash(struct ship * sh);
void sunhash(ship * sh); void sunhash(struct ship * sh);
void destroy_ship(ship * s, struct region * r); void destroy_ship(struct ship * s, struct region * r);
/* ** ** ** ** ** ** * /* ** ** ** ** ** ** *
* new build rules * * new build rules *

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: curse.c,v 1.5 2001/02/15 02:41:46 enno Exp $ * $Id: curse.c,v 1.6 2001/02/18 10:06:09 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -30,6 +30,7 @@
#include "race.h" #include "race.h"
#include "faction.h" #include "faction.h"
#include "building.h" #include "building.h"
#include "ship.h"
#include "objtypes.h" #include "objtypes.h"
/* util includes */ /* util includes */

View File

@ -52,6 +52,9 @@ struct item_type;
struct potion_type; struct potion_type;
struct luxury_type; struct luxury_type;
struct herb_type; struct herb_type;
/* types */
struct ship_type;
struct building_type;
/* util includes */ /* util includes */
#include <cvector.h> #include <cvector.h>
@ -793,22 +796,6 @@ typedef struct strlist {
char * s; char * s;
} strlist; } strlist;
typedef struct ship {
struct ship *next;
struct ship *nexthash;
int no;
char *name;
char *display;
struct attrib * attribs;
int size;
int damage; /* damage in 100th of a point of size */
int flags;
const struct ship_type * type;
direction_t coast;
boolean moved;
boolean drifted;
} ship;
extern int max_unique_id; extern int max_unique_id;
typedef struct skillvalue { typedef struct skillvalue {
skill_t id; skill_t id;
@ -817,7 +804,7 @@ typedef struct skillvalue {
#define FL_GUARD (1<<0) /* 1 */ #define FL_GUARD (1<<0) /* 1 */
#define FL_ISNEW (1<<1) /* 2 */ #define FL_ISNEW (1<<1) /* 2 */
#define FL_HADBATTLE (1<<2) /* 4 */ #define FL_LONGACTION (1<<2) /* 4 */
#define FL_OWNER (1<<3) /* 8 */ #define FL_OWNER (1<<3) /* 8 */
#define FL_PARTEITARNUNG (1<<4) /* 16 */ #define FL_PARTEITARNUNG (1<<4) /* 16 */
#define FL_DISBELIEVES (1<<5) /* 32 */ #define FL_DISBELIEVES (1<<5) /* 32 */
@ -991,7 +978,7 @@ char *factionname(const struct faction * f);
char *regionid(const struct region * r); char *regionid(const struct region * r);
char *unitname(const struct unit * u); char *unitname(const struct unit * u);
char *xunitid(const struct unit * u); char *xunitid(const struct unit * u);
char *shipname(const ship * sh); char *shipname(const struct ship * sh);
struct building *largestbuilding(const struct region * r, boolean img); struct building *largestbuilding(const struct region * r, boolean img);
@ -1049,7 +1036,7 @@ const char *strcheck(const char *s, size_t maxlen);
const char * findorder(const struct unit * u, const char * cmd); const char * findorder(const struct unit * u, const char * cmd);
#define attacked(u) (fval(u, FL_HADBATTLE)) #define attacked(u) (fval(u, FL_LONGACTION))
boolean idle(struct faction * f); boolean idle(struct faction * f);
boolean unit_has_cursed_item(struct unit *u); boolean unit_has_cursed_item(struct unit *u);
struct region * rconnect(const struct region *, direction_t dir); struct region * rconnect(const struct region *, direction_t dir);

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: magic.c,v 1.10 2001/02/18 09:21:11 katze Exp $ * $Id: magic.c,v 1.11 2001/02/18 10:06:09 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -98,6 +98,7 @@ findshipr(const region *r, int n)
for (sh = r->ships; sh; sh = sh->next) { for (sh = r->ships; sh; sh = sh->next) {
if (sh->no == n) { if (sh->no == n) {
assert(sh->region == r);
return sh; return sh;
} }
} }
@ -2639,8 +2640,9 @@ magic(void)
for (r = regions; r; r = r->next) { for (r = regions; r; r = r->next) {
for (u = r->units; u; u = u->next) { for (u = r->units; u; u = u->next) {
boolean casted = false;
if (u->race == RC_SPELL || fval(u, FL_HADBATTLE)) if (u->race == RC_SPELL || fval(u, FL_LONGACTION))
continue; continue;
if (rterrain(r) == T_GLACIER && u->race == RC_INSECT && if (rterrain(r) == T_GLACIER && u->race == RC_INSECT &&
@ -2661,7 +2663,7 @@ magic(void)
cmistake(u, so->s, 269, MSG_MAGIC); cmistake(u, so->s, 269, MSG_MAGIC);
continue; continue;
} }
set_string(&u->thisorder, ""); casted = true;
target_r = r; target_r = r;
mage = u; mage = u;
level = eff_skill(u, SK_MAGIC, r); level = eff_skill(u, SK_MAGIC, r);
@ -2830,6 +2832,7 @@ magic(void)
add_castorder(&cll[(int)(sp->rank)], co); add_castorder(&cll[(int)(sp->rank)], co);
} }
} }
if (casted) fset(u, FL_LONGACTION);
} }
} }
for (spellrank = 0; spellrank < MAX_SPELLRANK; spellrank++) { for (spellrank = 0; spellrank < MAX_SPELLRANK; spellrank++) {

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: movement.c,v 1.10 2001/02/17 15:02:49 enno Exp $ * $Id: movement.c,v 1.11 2001/02/18 10:06:09 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -415,6 +415,7 @@ move_ship(ship * sh, region * from, region * to, region ** route)
attrib *a; attrib *a;
translist(&from->ships, &to->ships, sh); translist(&from->ships, &to->ships, sh);
sh->region = to;
while (u) { while (u) {
unit *nu = u->next; unit *nu = u->next;
@ -1194,6 +1195,7 @@ travel(region * first, unit * u, region * next, int flucht)
else if (flucht) else if (flucht)
move_unit(u, current, NULL); move_unit(u, current, NULL);
set_string(&u->thisorder, ""); set_string(&u->thisorder, "");
fset(u, FL_LONGACTION);
setguard(u, GUARD_NONE); setguard(u, GUARD_NONE);
if (fval(u, FL_FOLLOWING)) caught_target(current, u); if (fval(u, FL_FOLLOWING)) caught_target(current, u);
@ -1617,7 +1619,7 @@ kapitaen(region * r, ship * sh)
/* Segeln, Wandern, Reiten */ /* Segeln, Wandern, Reiten */
void static void
move(region * r, unit * u, boolean move_on_land) move(region * r, unit * u, boolean move_on_land)
{ {
region *r2; region *r2;
@ -1669,6 +1671,7 @@ move(region * r, unit * u, boolean move_on_land)
if (*up==uf) up = &uf->next; if (*up==uf) up = &uf->next;
} }
} }
if (u->region!=r) fset(u, FL_LONGACTION);
} }
attrib_type at_piracy_direction = { attrib_type at_piracy_direction = {
@ -1863,6 +1866,7 @@ hunt(unit *u)
strcat(command, " "); strcat(command, " ");
strcat(command, directions[dir]); strcat(command, directions[dir]);
moves++; moves++;
rc = rconnect(rc, dir);
} }
/* In command steht jetzt das NACH-Kommando. */ /* In command steht jetzt das NACH-Kommando. */
@ -2027,11 +2031,10 @@ movement(void)
if(p != P_UNIT) { if(p != P_UNIT) {
cmistake(u, o->s, 240, MSG_MOVE); cmistake(u, o->s, 240, MSG_MOVE);
} }
u = u2; break;; u = u2; break;
} }
if(hunt(u)) { if (!fval(u, FL_LONGACTION) && hunt(u)) {
set_string(&u->thisorder, "");
u = r->units; u = r->units;
continue; continue;
} }
@ -2088,7 +2091,7 @@ follow(void)
for (u=r->units;u;u=u->next) { for (u=r->units;u;u=u->next) {
attrib * a; attrib * a;
strlist * o; strlist * o;
if (fval(u, FL_HADBATTLE)) continue; if (fval(u, FL_LONGACTION)) continue;
a = a_find(u->attribs, &at_follow); a = a_find(u->attribs, &at_follow);
for (o=u->orders;o;o=o->next) { for (o=u->orders;o;o=o->next) {
if (igetkeyword(o->s) == K_FOLLOW if (igetkeyword(o->s) == K_FOLLOW

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: movement.h,v 1.2 2001/01/26 16:19:40 enno Exp $ * $Id: movement.h,v 1.3 2001/02/18 10:06:09 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -55,7 +55,7 @@ extern boolean cansail(const struct region * r, struct ship * sh);
extern boolean canswim(struct unit *u); extern boolean canswim(struct unit *u);
extern struct unit *kapitaen(struct region * r, struct ship * sh); extern struct unit *kapitaen(struct region * r, struct ship * sh);
extern void travelthru(struct unit * u, struct region * r); extern void travelthru(struct unit * u, struct region * r);
extern ship * move_ship(ship * sh, struct region * from, struct region * to, struct region ** route); extern struct ship * move_ship(struct ship * sh, struct region * from, struct region * to, struct region ** route);
extern attrib_type at_piracy_direction; extern attrib_type at_piracy_direction;

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: race.c,v 1.5 2001/02/14 08:35:12 katze Exp $ * $Id: race.c,v 1.6 2001/02/18 10:06:09 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -1852,7 +1852,7 @@ give_starting_equipment(struct region *r, struct unit *u)
break; break;
case RC_AQUARIAN: case RC_AQUARIAN:
{ {
ship *sh = new_ship(&st_boat); ship *sh = new_ship(&st_boat, r);
sh->size = sh->type->construction->maxsize; sh->size = sh->type->construction->maxsize;
addlist(&r->ships, sh); addlist(&r->ships, sh);
u->ship = sh; u->ship = sh;

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: save.c,v 1.19 2001/02/17 15:02:49 enno Exp $ * $Id: save.c,v 1.20 2001/02/18 10:06:09 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -455,7 +455,7 @@ readfaction(void)
* muß in "Gänsefüßchen" stehen!! */ * muß in "Gänsefüßchen" stehen!! */
/* War vorher in main.c:getgarbage() */ /* War vorher in main.c:getgarbage() */
if (1 || !quiet) { if (!quiet) {
printf(" %4s;", factionid(f)); printf(" %4s;", factionid(f));
fflush(stdout); fflush(stdout);
} }
@ -1137,6 +1137,7 @@ readgame(boolean backup)
while (--p >= 0) { while (--p >= 0) {
sh = (ship *) calloc(1, sizeof(ship)); sh = (ship *) calloc(1, sizeof(ship));
sh->region = r;
if (global.data_version>=FULL_BASE36_VERSION) if (global.data_version>=FULL_BASE36_VERSION)
sh->no = rid(F); sh->no = rid(F);
else else
@ -1777,6 +1778,7 @@ writegame(char *path, char quiet)
wi(F, listlen(r->ships)); wi(F, listlen(r->ships));
wnl(F); wnl(F);
for (sh = r->ships; sh; sh = sh->next) { for (sh = r->ships; sh; sh = sh->next) {
assert(sh->region == r);
#if RELEASE_VERSION>= FULL_BASE36_VERSION #if RELEASE_VERSION>= FULL_BASE36_VERSION
wid(F, sh->no); wid(F, sh->no);
#else #else

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: ship.c,v 1.2 2001/01/26 16:19:40 enno Exp $ * $Id: ship.c,v 1.3 2001/02/18 10:06:09 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -216,7 +216,7 @@ const ship_type st_trireme = {
}; };
ship * ship *
new_ship(const ship_type * stype) new_ship(const ship_type * stype, region * r)
{ {
static char buffer[7 + IDSIZE + 1]; static char buffer[7 + IDSIZE + 1];
ship *sh = (ship *) calloc(1, sizeof(ship)); ship *sh = (ship *) calloc(1, sizeof(ship));
@ -224,6 +224,7 @@ new_ship(const ship_type * stype)
sh->no = newcontainerid(); sh->no = newcontainerid();
sh->coast = NODIRECTION; sh->coast = NODIRECTION;
sh->type = stype; sh->type = stype;
sh->region = r;
sprintf(buffer, "Schiff %s", shipid(sh)); sprintf(buffer, "Schiff %s", shipid(sh));
set_string(&sh->name, buffer); set_string(&sh->name, buffer);

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: ship.h,v 1.2 2001/01/26 16:19:40 enno Exp $ * $Id: ship.h,v 1.3 2001/02/18 10:06:09 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -66,11 +66,28 @@ extern void st_register(const ship_type * type);
#define NOSHIP NULL #define NOSHIP NULL
typedef struct ship {
struct ship *next;
struct ship *nexthash;
int no;
struct region *region;
char *name;
char *display;
struct attrib * attribs;
int size;
int damage; /* damage in 100th of a point of size */
int flags;
const struct ship_type * type;
direction_t coast;
boolean moved;
boolean drifted;
} ship;
extern void damage_ship(ship *sh, double percent); extern void damage_ship(ship *sh, double percent);
extern struct unit *captain(ship *sh, struct region *r); extern struct unit *captain(ship *sh, struct region *r);
extern struct unit *shipowner(const struct region * r, const struct ship * sh); extern struct unit *shipowner(const struct region * r, const struct ship * sh);
extern ship *new_ship(const struct ship_type * stype); extern ship *new_ship(const struct ship_type * stype, struct region * r);
extern char *shipname(const struct ship * sh); extern char *shipname(const struct ship * sh);
extern ship *findship(int n); extern ship *findship(int n);
#endif #endif

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: spell.c,v 1.11 2001/02/18 09:21:11 katze Exp $ * $Id: spell.c,v 1.12 2001/02/18 10:06:09 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -41,6 +41,7 @@
#include "race.h" #include "race.h"
#include "region.h" #include "region.h"
#include "resolve.h" #include "resolve.h"
#include "ship.h"
#include "skill.h" #include "skill.h"
#include "spy.h" #include "spy.h"
#include "teleport.h" #include "teleport.h"

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: unit.c,v 1.6 2001/02/18 09:32:13 corwin Exp $ * $Id: unit.c,v 1.7 2001/02/18 10:06:10 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -32,6 +32,7 @@
#include "movement.h" #include "movement.h"
#include "race.h" #include "race.h"
#include "region.h" #include "region.h"
#include "ship.h"
/* util includes */ /* util includes */
#include <resolve.h> #include <resolve.h>
@ -684,7 +685,7 @@ transfermen(unit * u, unit * u2, int n)
/* "hat attackiert"-status wird übergeben */ /* "hat attackiert"-status wird übergeben */
if (u2) { if (u2) {
if (fval(u, FL_HADBATTLE)) fset(u2, FL_HADBATTLE); if (fval(u, FL_LONGACTION)) fset(u2, FL_LONGACTION);
hp = u->hp; hp = u->hp;
if (u->skills) if (u->skills)
for (sk = 0; sk < MAXSKILLS; ++sk) for (sk = 0; sk < MAXSKILLS; ++sk)

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: main.c,v 1.17 2001/02/14 20:09:49 enno Exp $ * $Id: main.c,v 1.18 2001/02/18 10:06:10 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -57,6 +57,7 @@
#include <reports.h> #include <reports.h>
#include <region.h> #include <region.h>
#include <save.h> #include <save.h>
#include <ship.h>
#include <time.h> #include <time.h>
#include <border.h> #include <border.h>
#include <region.h> #include <region.h>

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: map_modify.c,v 1.5 2001/02/18 07:45:43 corwin Exp $ * $Id: map_modify.c,v 1.6 2001/02/18 10:06:10 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -491,6 +491,7 @@ NeuesSchiff(region * r)
s = new_ship(stype[q]); s = new_ship(stype[q]);
/* Ist das richtig so, Henning? */ /* Ist das richtig so, Henning? */
addlist(&r->ships, s); addlist(&r->ships, s);
sh->region = r;
strcpy(buf, my_input(win, 2, 2, "Name: ", NULL)); strcpy(buf, my_input(win, 2, 2, "Name: ", NULL));
if (strlen(buf) > 0) if (strlen(buf) > 0)

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: map_units.c,v 1.3 2001/02/09 13:53:53 corwin Exp $ * $Id: map_units.c,v 1.4 2001/02/18 10:06:10 enno Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -1270,7 +1270,7 @@ showunits(region * r)
} }
x = un; x = un;
} }
translist(&shipregion->ships, &r->ships, clipship); move_ship(clipship, shipregion, r, NULL);
clipship = NULL; clipship = NULL;
shipregion = NULL; shipregion = NULL;
} }