forked from github/server
Merge pull request #67 from badgerman/version-cleanup
eliminating support for old datafile versions, prior to binary formats
This commit is contained in:
commit
fcffb3d8e1
14 changed files with 300 additions and 580 deletions
|
@ -104,12 +104,7 @@ static int lc_read(struct attrib *a, void *owner, struct storage *store)
|
||||||
building_action *data = (building_action *)a->data.v;
|
building_action *data = (building_action *)a->data.v;
|
||||||
int result =
|
int result =
|
||||||
read_reference(&data->b, store, read_building_reference, resolve_building);
|
read_reference(&data->b, store, read_building_reference, resolve_building);
|
||||||
if (global.data_version < UNICODE_VERSION) {
|
READ_TOK(store, name, sizeof(name));
|
||||||
READ_STR(store, name, sizeof(name));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
READ_TOK(store, name, sizeof(name));
|
|
||||||
}
|
|
||||||
if (strcmp(name, "tunnel_action") == 0) {
|
if (strcmp(name, "tunnel_action") == 0) {
|
||||||
/* E2: Weltentor has a new module, doesn't need this any longer */
|
/* E2: Weltentor has a new module, doesn't need this any longer */
|
||||||
result = 0;
|
result = 0;
|
||||||
|
@ -118,26 +113,16 @@ static int lc_read(struct attrib *a, void *owner, struct storage *store)
|
||||||
else {
|
else {
|
||||||
data->fname = _strdup(name);
|
data->fname = _strdup(name);
|
||||||
}
|
}
|
||||||
if (global.data_version >= BACTION_VERSION) {
|
READ_TOK(store, name, sizeof(name));
|
||||||
if (global.data_version < UNICODE_VERSION) {
|
if (strcmp(name, "tnnL") == 0) {
|
||||||
READ_STR(store, name, sizeof(name));
|
/* tunnel_action was the old Weltentore, their code has changed. ignore this object */
|
||||||
}
|
result = 0;
|
||||||
else {
|
data->b = 0;
|
||||||
READ_TOK(store, name, sizeof(name));
|
|
||||||
if (strcmp(name, "tnnL") == 0) {
|
|
||||||
/* tunnel_action was the old Weltentore, their code has changed. ignore this object */
|
|
||||||
result = 0;
|
|
||||||
data->b = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (strcmp(name, NULLSTRING) == 0)
|
|
||||||
data->param = 0;
|
|
||||||
else {
|
|
||||||
data->param = _strdup(name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
if (strcmp(name, NULLSTRING) == 0)
|
||||||
data->param = 0;
|
data->param = 0;
|
||||||
|
else {
|
||||||
|
data->param = _strdup(name);
|
||||||
}
|
}
|
||||||
if (result == 0 && !data->b) {
|
if (result == 0 && !data->b) {
|
||||||
return AT_READ_FAIL;
|
return AT_READ_FAIL;
|
||||||
|
|
|
@ -231,10 +231,8 @@ int LongHunger(const struct unit *u)
|
||||||
if (u != NULL) {
|
if (u != NULL) {
|
||||||
if (!fval(u, UFL_HUNGER))
|
if (!fval(u, UFL_HUNGER))
|
||||||
return false;
|
return false;
|
||||||
#ifdef NEW_DAEMONHUNGER_RULE
|
|
||||||
if (u_race(u) == get_race(RC_DAEMON))
|
if (u_race(u) == get_race(RC_DAEMON))
|
||||||
return false;
|
return false;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
if (rule < 0 || gamecookie != global.cookie) {
|
if (rule < 0 || gamecookie != global.cookie) {
|
||||||
gamecookie = global.cookie;
|
gamecookie = global.cookie;
|
||||||
|
|
|
@ -195,14 +195,8 @@ int curse_read(attrib * a, void *owner, struct storage *store)
|
||||||
READ_TOK(store, cursename, sizeof(cursename));
|
READ_TOK(store, cursename, sizeof(cursename));
|
||||||
READ_INT(store, &flags);
|
READ_INT(store, &flags);
|
||||||
READ_INT(store, &c->duration);
|
READ_INT(store, &c->duration);
|
||||||
if (global.data_version >= CURSEVIGOURISFLOAT_VERSION) {
|
READ_FLT(store, &flt);
|
||||||
READ_FLT(store, &flt);
|
c->vigour = flt;
|
||||||
c->vigour = flt;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
READ_INT(store, &n);
|
|
||||||
c->vigour = (float)n;
|
|
||||||
}
|
|
||||||
if (global.data_version < INTPAK_VERSION) {
|
if (global.data_version < INTPAK_VERSION) {
|
||||||
ur = read_reference(&c->magician, store, read_int, resolve_unit);
|
ur = read_reference(&c->magician, store, read_int, resolve_unit);
|
||||||
}
|
}
|
||||||
|
@ -226,12 +220,7 @@ int curse_read(attrib * a, void *owner, struct storage *store)
|
||||||
assert(result == 0);
|
assert(result == 0);
|
||||||
return AT_READ_FAIL;
|
return AT_READ_FAIL;
|
||||||
}
|
}
|
||||||
if (global.data_version < CURSEFLAGS_VERSION) {
|
c->flags = flags;
|
||||||
c_setflag(c, flags);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
c->flags = flags;
|
|
||||||
}
|
|
||||||
c_clearflag(c, CURSE_ISNEW);
|
c_clearflag(c, CURSE_ISNEW);
|
||||||
|
|
||||||
if (c->type->read)
|
if (c->type->read)
|
||||||
|
|
|
@ -236,8 +236,6 @@ void read_groups(struct storage *store, faction * f)
|
||||||
READ_INT(store, &fid.i);
|
READ_INT(store, &fid.i);
|
||||||
if (fid.i <= 0)
|
if (fid.i <= 0)
|
||||||
break;
|
break;
|
||||||
if (global.data_version < STORAGE_VERSION && fid.i == 0)
|
|
||||||
break;
|
|
||||||
a = ally_add(pa, findfaction(fid.i));
|
a = ally_add(pa, findfaction(fid.i));
|
||||||
READ_INT(store, &a->status);
|
READ_INT(store, &a->status);
|
||||||
if (!a->faction)
|
if (!a->faction)
|
||||||
|
|
|
@ -428,10 +428,6 @@ static void read_alliances(struct storage *store)
|
||||||
{
|
{
|
||||||
char pbuf[8];
|
char pbuf[8];
|
||||||
int id, terminator = 0;
|
int id, terminator = 0;
|
||||||
if (global.data_version < SAVEALLIANCE_VERSION) {
|
|
||||||
if (!AllianceRestricted() && !AllianceAuto())
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (global.data_version < ALLIANCELEADER_VERSION) {
|
if (global.data_version < ALLIANCELEADER_VERSION) {
|
||||||
terminator = atoi36("end");
|
terminator = atoi36("end");
|
||||||
READ_STR(store, pbuf, sizeof(pbuf));
|
READ_STR(store, pbuf, sizeof(pbuf));
|
||||||
|
@ -645,36 +641,10 @@ unit *read_unit(struct gamedata *data)
|
||||||
READ_INT(data->store, &n);
|
READ_INT(data->store, &n);
|
||||||
u->age = (short)n;
|
u->age = (short)n;
|
||||||
|
|
||||||
if (data->version < STORAGE_VERSION) {
|
READ_TOK(data->store, rname, sizeof(rname));
|
||||||
char *space;
|
|
||||||
READ_STR(data->store, rname, sizeof(rname));
|
|
||||||
space = strchr(rname, ' ');
|
|
||||||
if (space != NULL) {
|
|
||||||
char *inc = space + 1;
|
|
||||||
char *outc = space;
|
|
||||||
do {
|
|
||||||
while (*inc == ' ')
|
|
||||||
++inc;
|
|
||||||
while (*inc) {
|
|
||||||
*outc++ = *inc++;
|
|
||||||
if (*inc == ' ')
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} while (*inc);
|
|
||||||
*outc = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
READ_TOK(data->store, rname, sizeof(rname));
|
|
||||||
}
|
|
||||||
u_setrace(u, rc_find(rname));
|
u_setrace(u, rc_find(rname));
|
||||||
|
|
||||||
if (data->version < STORAGE_VERSION) {
|
READ_TOK(data->store, rname, sizeof(rname));
|
||||||
READ_STR(data->store, rname, sizeof(rname));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
READ_TOK(data->store, rname, sizeof(rname));
|
|
||||||
}
|
|
||||||
if (rname[0] && skill_enabled(SK_STEALTH))
|
if (rname[0] && skill_enabled(SK_STEALTH))
|
||||||
u->irace = rc_find(rname);
|
u->irace = rc_find(rname);
|
||||||
else
|
else
|
||||||
|
@ -756,14 +726,6 @@ unit *read_unit(struct gamedata *data)
|
||||||
}
|
}
|
||||||
READ_STR(data->store, obuf, sizeof(obuf));
|
READ_STR(data->store, obuf, sizeof(obuf));
|
||||||
}
|
}
|
||||||
if (data->version < NOLASTORDER_VERSION) {
|
|
||||||
order *ord;
|
|
||||||
READ_STR(data->store, obuf, sizeof(obuf));
|
|
||||||
ord = parse_order(obuf, u->faction->locale);
|
|
||||||
if (ord != NULL) {
|
|
||||||
addlist(&u->orders, ord);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
set_order(&u->thisorder, NULL);
|
set_order(&u->thisorder, NULL);
|
||||||
|
|
||||||
assert(u_race(u));
|
assert(u_race(u));
|
||||||
|
@ -869,13 +831,11 @@ static region *readregion(struct gamedata *data, int x, int y)
|
||||||
{
|
{
|
||||||
region *r = findregion(x, y);
|
region *r = findregion(x, y);
|
||||||
const terrain_type *terrain;
|
const terrain_type *terrain;
|
||||||
char token[32];
|
char name[NAMESIZE];
|
||||||
int uid = 0;
|
int uid = 0;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
if (data->version >= UID_VERSION) {
|
READ_INT(data->store, &uid);
|
||||||
READ_INT(data->store, &uid);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (r == NULL) {
|
if (r == NULL) {
|
||||||
plane *pl = findplane(x, y);
|
plane *pl = findplane(x, y);
|
||||||
|
@ -906,23 +866,11 @@ static region *readregion(struct gamedata *data, int x, int y)
|
||||||
region_setinfo(r, info);
|
region_setinfo(r, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data->version < TERRAIN_VERSION) {
|
READ_STR(data->store, name, sizeof(name));
|
||||||
int ter;
|
terrain = get_terrain(name);
|
||||||
READ_INT(data->store, &ter);
|
if (terrain == NULL) {
|
||||||
terrain = newterrain((terrain_t)ter);
|
log_error("Unknown terrain '%s'\n", name);
|
||||||
if (terrain == NULL) {
|
assert(!"unknown terrain");
|
||||||
log_error("while reading datafile from pre-TERRAIN_VERSION, could not find terrain #%d.\n", ter);
|
|
||||||
terrain = newterrain(T_PLAIN);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
char name[64];
|
|
||||||
READ_STR(data->store, name, sizeof(name));
|
|
||||||
terrain = get_terrain(name);
|
|
||||||
if (terrain == NULL) {
|
|
||||||
log_error("Unknown terrain '%s'\n", name);
|
|
||||||
assert(!"unknown terrain");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
r->terrain = terrain;
|
r->terrain = terrain;
|
||||||
READ_INT(data->store, &r->flags);
|
READ_INT(data->store, &r->flags);
|
||||||
|
@ -930,7 +878,6 @@ static region *readregion(struct gamedata *data, int x, int y)
|
||||||
r->age = (unsigned short)n;
|
r->age = (unsigned short)n;
|
||||||
|
|
||||||
if (fval(r->terrain, LAND_REGION)) {
|
if (fval(r->terrain, LAND_REGION)) {
|
||||||
char name[NAMESIZE];
|
|
||||||
r->land = calloc(1, sizeof(land_region));
|
r->land = calloc(1, sizeof(land_region));
|
||||||
READ_STR(data->store, name, sizeof(name));
|
READ_STR(data->store, name, sizeof(name));
|
||||||
r->land->name = _strdup(name);
|
r->land->name = _strdup(name);
|
||||||
|
@ -963,13 +910,13 @@ static region *readregion(struct gamedata *data, int x, int y)
|
||||||
assert(*pres == NULL);
|
assert(*pres == NULL);
|
||||||
for (;;) {
|
for (;;) {
|
||||||
rawmaterial *res;
|
rawmaterial *res;
|
||||||
READ_STR(data->store, token, sizeof(token));
|
READ_STR(data->store, name, sizeof(name));
|
||||||
if (strcmp(token, "end") == 0)
|
if (strcmp(name, "end") == 0)
|
||||||
break;
|
break;
|
||||||
res = malloc(sizeof(rawmaterial));
|
res = malloc(sizeof(rawmaterial));
|
||||||
res->type = rmt_find(token);
|
res->type = rmt_find(name);
|
||||||
if (res->type == NULL) {
|
if (res->type == NULL) {
|
||||||
log_error("invalid resourcetype %s in data.\n", token);
|
log_error("invalid resourcetype %s in data.\n", name);
|
||||||
}
|
}
|
||||||
assert(res->type != NULL);
|
assert(res->type != NULL);
|
||||||
READ_INT(data->store, &n);
|
READ_INT(data->store, &n);
|
||||||
|
@ -990,9 +937,9 @@ static region *readregion(struct gamedata *data, int x, int y)
|
||||||
}
|
}
|
||||||
*pres = NULL;
|
*pres = NULL;
|
||||||
|
|
||||||
READ_STR(data->store, token, sizeof(token));
|
READ_STR(data->store, name, sizeof(name));
|
||||||
if (strcmp(token, "noherb") != 0) {
|
if (strcmp(name, "noherb") != 0) {
|
||||||
const resource_type *rtype = rt_find(token);
|
const resource_type *rtype = rt_find(name);
|
||||||
assert(rtype && rtype->itype && fval(rtype->itype, ITF_HERB));
|
assert(rtype && rtype->itype && fval(rtype->itype, ITF_HERB));
|
||||||
rsetherbtype(r, rtype->itype);
|
rsetherbtype(r, rtype->itype);
|
||||||
}
|
}
|
||||||
|
@ -1016,17 +963,15 @@ static region *readregion(struct gamedata *data, int x, int y)
|
||||||
int n;
|
int n;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
const struct resource_type *rtype;
|
const struct resource_type *rtype;
|
||||||
READ_STR(data->store, token, sizeof(token));
|
READ_STR(data->store, name, sizeof(name));
|
||||||
if (!strcmp(token, "end"))
|
if (!strcmp(name, "end"))
|
||||||
break;
|
break;
|
||||||
rtype = rt_find(token);
|
rtype = rt_find(name);
|
||||||
assert(rtype && rtype->ltype);
|
assert(rtype && rtype->ltype);
|
||||||
READ_INT(data->store, &n);
|
READ_INT(data->store, &n);
|
||||||
r_setdemand(r, rtype->ltype, n);
|
r_setdemand(r, rtype->ltype, n);
|
||||||
}
|
}
|
||||||
if (data->version >= REGIONITEMS_VERSION) {
|
read_items(data->store, &r->land->items);
|
||||||
read_items(data->store, &r->land->items);
|
|
||||||
}
|
|
||||||
if (data->version >= REGIONOWNER_VERSION) {
|
if (data->version >= REGIONOWNER_VERSION) {
|
||||||
READ_INT(data->store, &n);
|
READ_INT(data->store, &n);
|
||||||
r->land->morale = (short)n;
|
r->land->morale = (short)n;
|
||||||
|
@ -1088,10 +1033,8 @@ void writeregion(struct gamedata *data, const region * r)
|
||||||
WRITE_INT(data->store, demand->value);
|
WRITE_INT(data->store, demand->value);
|
||||||
}
|
}
|
||||||
WRITE_TOK(data->store, "end");
|
WRITE_TOK(data->store, "end");
|
||||||
#if RELEASE_VERSION>=REGIONITEMS_VERSION
|
|
||||||
write_items(data->store, r->land->items);
|
write_items(data->store, r->land->items);
|
||||||
WRITE_SECTION(data->store);
|
WRITE_SECTION(data->store);
|
||||||
#endif
|
|
||||||
#if RELEASE_VERSION>=REGIONOWNER_VERSION
|
#if RELEASE_VERSION>=REGIONOWNER_VERSION
|
||||||
WRITE_INT(data->store, r->land->morale);
|
WRITE_INT(data->store, r->land->morale);
|
||||||
write_owner(data, r->land->ownership);
|
write_owner(data, r->land->ownership);
|
||||||
|
@ -1163,24 +1106,13 @@ void read_spellbook(spellbook **bookp, struct storage *store, int(*get_level)(co
|
||||||
char spname[64];
|
char spname[64];
|
||||||
int level = 0;
|
int level = 0;
|
||||||
|
|
||||||
if (global.data_version < SPELLNAME_VERSION) {
|
READ_TOK(store, spname, sizeof(spname));
|
||||||
int i;
|
if (strcmp(spname, "end") == 0)
|
||||||
READ_INT(store, &i);
|
break;
|
||||||
if (i < 0)
|
if (bookp) {
|
||||||
break;
|
sp = find_spell(spname);
|
||||||
if (bookp) {
|
if (!sp) {
|
||||||
sp = find_spellbyid((unsigned int)i);
|
log_error("read_spells: could not find spell '%s'\n", spname);
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
READ_TOK(store, spname, sizeof(spname));
|
|
||||||
if (strcmp(spname, "end") == 0)
|
|
||||||
break;
|
|
||||||
if (bookp) {
|
|
||||||
sp = find_spell(spname);
|
|
||||||
if (!sp) {
|
|
||||||
log_error("read_spells: could not find spell '%s'\n", spname);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (global.data_version >= SPELLBOOK_VERSION) {
|
if (global.data_version >= SPELLBOOK_VERSION) {
|
||||||
|
@ -1313,9 +1245,7 @@ faction *readfaction(struct gamedata * data)
|
||||||
}
|
}
|
||||||
|
|
||||||
a_read(data->store, &f->attribs, f);
|
a_read(data->store, &f->attribs, f);
|
||||||
if (data->version >= CLAIM_VERSION) {
|
read_items(data->store, &f->items);
|
||||||
read_items(data->store, &f->items);
|
|
||||||
}
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
READ_TOK(data->store, name, sizeof(name));
|
READ_TOK(data->store, name, sizeof(name));
|
||||||
if (strcmp("end", name) == 0)
|
if (strcmp("end", name) == 0)
|
||||||
|
@ -1342,36 +1272,16 @@ faction *readfaction(struct gamedata * data)
|
||||||
}
|
}
|
||||||
|
|
||||||
sfp = &f->allies;
|
sfp = &f->allies;
|
||||||
if (data->version < ALLIANCES_VERSION) {
|
for (;;) {
|
||||||
int p;
|
int aid = 0;
|
||||||
READ_INT(data->store, &p);
|
READ_INT(data->store, &aid);
|
||||||
while (--p >= 0) {
|
if (aid > 0) {
|
||||||
int aid, state;
|
int state;
|
||||||
READ_INT(data->store, &aid);
|
|
||||||
READ_INT(data->store, &state);
|
READ_INT(data->store, &state);
|
||||||
sfp = addally(f, sfp, aid, state);
|
sfp = addally(f, sfp, aid, state);
|
||||||
}
|
}
|
||||||
}
|
else {
|
||||||
else {
|
break;
|
||||||
for (;;) {
|
|
||||||
int aid = 0;
|
|
||||||
if (data->version < STORAGE_VERSION) {
|
|
||||||
READ_TOK(data->store, name, sizeof(name));
|
|
||||||
if (strcmp(name, "end") != 0) {
|
|
||||||
aid = atoi36(name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
READ_INT(data->store, &aid);
|
|
||||||
}
|
|
||||||
if (aid > 0) {
|
|
||||||
int state;
|
|
||||||
READ_INT(data->store, &state);
|
|
||||||
sfp = addally(f, sfp, aid, state);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
read_groups(data->store, f);
|
read_groups(data->store, f);
|
||||||
|
@ -1445,7 +1355,7 @@ void writefaction(struct gamedata *data, const faction * f)
|
||||||
|
|
||||||
int readgame(const char *filename, int backup)
|
int readgame(const char *filename, int backup)
|
||||||
{
|
{
|
||||||
int i, n, p, nread;
|
int n, p, nread;
|
||||||
faction *f, **fp;
|
faction *f, **fp;
|
||||||
region *r;
|
region *r;
|
||||||
building *b, **bp;
|
building *b, **bp;
|
||||||
|
@ -1503,9 +1413,8 @@ int readgame(const char *filename, int backup)
|
||||||
getchar();
|
getchar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (gdata.version >= SAVEXMLNAME_VERSION) {
|
else {
|
||||||
char basefile[32];
|
READ_STR(&store, NULL, 0);
|
||||||
READ_STR(&store, basefile, sizeof(basefile));
|
|
||||||
}
|
}
|
||||||
a_read(&store, &global.attribs, NULL);
|
a_read(&store, &global.attribs, NULL);
|
||||||
READ_INT(&store, &turn);
|
READ_INT(&store, &turn);
|
||||||
|
@ -1576,9 +1485,7 @@ int readgame(const char *filename, int backup)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read factions */
|
/* Read factions */
|
||||||
if (gdata.version >= ALLIANCES_VERSION) {
|
read_alliances(&store);
|
||||||
read_alliances(&store);
|
|
||||||
}
|
|
||||||
READ_INT(&store, &nread);
|
READ_INT(&store, &nread);
|
||||||
log_printf(stdout, " - Einzulesende Parteien: %d\n", nread);
|
log_printf(stdout, " - Einzulesende Parteien: %d\n", nread);
|
||||||
fp = &factions;
|
fp = &factions;
|
||||||
|
@ -1594,14 +1501,6 @@ int readgame(const char *filename, int backup)
|
||||||
}
|
}
|
||||||
*fp = 0;
|
*fp = 0;
|
||||||
|
|
||||||
/* ignore the obsolete list of "used" faction ids */
|
|
||||||
if (gdata.version < STORAGE_VERSION) {
|
|
||||||
READ_INT(&store, &i);
|
|
||||||
while (i--) {
|
|
||||||
READ_INT(&store, &n);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Regionen */
|
/* Regionen */
|
||||||
|
|
||||||
READ_INT(&store, &nread);
|
READ_INT(&store, &nread);
|
||||||
|
@ -1878,9 +1777,7 @@ int writegame(const char *filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write factions */
|
/* Write factions */
|
||||||
#if RELEASE_VERSION>=ALLIANCES_VERSION
|
|
||||||
write_alliances(&gdata);
|
write_alliances(&gdata);
|
||||||
#endif
|
|
||||||
n = listlen(factions);
|
n = listlen(factions);
|
||||||
WRITE_INT(&store, n);
|
WRITE_INT(&store, n);
|
||||||
WRITE_SECTION(&store);
|
WRITE_SECTION(&store);
|
||||||
|
@ -1975,9 +1872,6 @@ void a_writeint(const attrib * a, const void *owner, struct storage *store)
|
||||||
int a_readshorts(attrib * a, void *owner, struct storage *store)
|
int a_readshorts(attrib * a, void *owner, struct storage *store)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
if (global.data_version < ATTRIBREAD_VERSION) {
|
|
||||||
return a_readint(a, store, owner);
|
|
||||||
}
|
|
||||||
READ_INT(store, &n);
|
READ_INT(store, &n);
|
||||||
a->data.sa[0] = (short)n;
|
a->data.sa[0] = (short)n;
|
||||||
READ_INT(store, &n);
|
READ_INT(store, &n);
|
||||||
|
@ -1994,9 +1888,6 @@ void a_writeshorts(const attrib * a, const void *owner, struct storage *store)
|
||||||
int a_readchars(attrib * a, void *owner, struct storage *store)
|
int a_readchars(attrib * a, void *owner, struct storage *store)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
if (global.data_version < ATTRIBREAD_VERSION) {
|
|
||||||
return a_readint(a, store, owner);
|
|
||||||
}
|
|
||||||
for (i = 0; i != 4; ++i) {
|
for (i = 0; i != 4; ++i) {
|
||||||
int n;
|
int n;
|
||||||
READ_INT(store, &n);
|
READ_INT(store, &n);
|
||||||
|
@ -2016,9 +1907,6 @@ void a_writechars(const attrib * a, const void *owner, struct storage *store)
|
||||||
|
|
||||||
int a_readvoid(attrib * a, void *owner, struct storage *store)
|
int a_readvoid(attrib * a, void *owner, struct storage *store)
|
||||||
{
|
{
|
||||||
if (global.data_version < ATTRIBREAD_VERSION) {
|
|
||||||
return a_readint(a, store, owner);
|
|
||||||
}
|
|
||||||
return AT_READ_OK;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,52 +10,6 @@
|
||||||
without prior permission by the authors of Eressea.
|
without prior permission by the authors of Eressea.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* changes from->to: 72->73: struct unit::lock entfernt.
|
|
||||||
* 73->74: struct unit::flags eingeführt.
|
|
||||||
* 74->75: parteitarnung als flag.
|
|
||||||
* 75->76: #ifdef NEW_HP: hp
|
|
||||||
* 76->77: ship->damage
|
|
||||||
* 77->78: neue Message-Option "Orkvermehrung" (MAX_MSG +1)
|
|
||||||
* 78->79: showdata nicht mehr speichern
|
|
||||||
* 79->HEX_VERSION: hex
|
|
||||||
* 80->82: ATTRIB_VERSION
|
|
||||||
* 90: Ebenen
|
|
||||||
* 92: Magiegebiet-Auswahl f->magiegebiet
|
|
||||||
* 94: f->attribs wird gespeichert
|
|
||||||
* 100: NEWMAGIC, neue Message-Option "Zauber" (MAX_MSG +1)
|
|
||||||
* 108: Speichern von Timeouts
|
|
||||||
* 193: curse bekommen id aus struct unit-nummernraum
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
#define HEX_VERSION 81
|
|
||||||
#define GROWTREE_VERSION 305
|
|
||||||
#define RANDOMIZED_RESOURCES_VERSION 306
|
|
||||||
#define NEWRACE_VERSION 307
|
|
||||||
#define INTERIM_VERSION 309
|
|
||||||
#define NEWSKILL_VERSION 309
|
|
||||||
#define WATCHERS_VERSION 310
|
|
||||||
#define OVERRIDE_VERSION 311
|
|
||||||
*/
|
|
||||||
#define CURSETYPE_VERSION 312 /* turn 287 */
|
|
||||||
#define ALLIANCES_VERSION 313
|
|
||||||
#define DBLINK_VERSION 314
|
|
||||||
#define CURSEVIGOURISFLOAT_VERSION 315
|
|
||||||
#define SAVEXMLNAME_VERSION 316
|
|
||||||
#define SAVEALLIANCE_VERSION 317
|
|
||||||
#define CLAIM_VERSION 318
|
|
||||||
/* 319 is the HSE4 data version */
|
|
||||||
#define BACTION_VERSION 319 /* building action gets a param string */
|
|
||||||
#define NOLASTORDER_VERSION 320 /* do not use lastorder */
|
|
||||||
#define SPELLNAME_VERSION 321 /* reference spells by name */
|
|
||||||
#define TERRAIN_VERSION 322 /* terrains are a full type and saved by name */
|
|
||||||
#define REGIONITEMS_VERSION 323 /* regions have items */
|
|
||||||
#define ATTRIBREAD_VERSION 324 /* remove a_readint */
|
|
||||||
#define CURSEFLAGS_VERSION 325 /* remove a_readint */
|
|
||||||
#define UNICODE_VERSION 326 /* 2007-06-27 everything is stored as UTF8 */
|
|
||||||
#define UID_VERSION 327 /* regions have a unique id */
|
|
||||||
#define STORAGE_VERSION 328 /* with storage.h, some things are stored smarter (ids as base36, fractions as float) */
|
|
||||||
#define INTPAK_VERSION 329 /* in binary, ints can get packed */
|
#define INTPAK_VERSION 329 /* in binary, ints can get packed */
|
||||||
#define NOZEROIDS_VERSION 330 /* 2008-05-16 zero is not a valid ID for anything (including factions) */
|
#define NOZEROIDS_VERSION 330 /* 2008-05-16 zero is not a valid ID for anything (including factions) */
|
||||||
#define NOBORDERATTRIBS_VERSION 331 /* 2008-05-17 connection::attribs has been moved to userdata */
|
#define NOBORDERATTRIBS_VERSION 331 /* 2008-05-17 connection::attribs has been moved to userdata */
|
||||||
|
@ -74,6 +28,7 @@
|
||||||
#define SAVEGAMEID_VERSION 343 /* instead of XMLNAME, save the game.id parameter from the config */
|
#define SAVEGAMEID_VERSION 343 /* instead of XMLNAME, save the game.id parameter from the config */
|
||||||
#define BUILDNO_VERSION 344 /* storing the build number in the save */
|
#define BUILDNO_VERSION 344 /* storing the build number in the save */
|
||||||
#define AUTO_RACENAME_VERSION 345 /* NPC units with name==NULL will automatically get their race for a name */
|
#define AUTO_RACENAME_VERSION 345 /* NPC units with name==NULL will automatically get their race for a name */
|
||||||
|
|
||||||
#define MIN_VERSION INTPAK_VERSION /* minimal datafile we support */
|
#define MIN_VERSION INTPAK_VERSION /* minimal datafile we support */
|
||||||
#define RELEASE_VERSION AUTO_RACENAME_VERSION /* current datafile */
|
#define RELEASE_VERSION AUTO_RACENAME_VERSION /* current datafile */
|
||||||
|
|
||||||
|
|
|
@ -151,7 +151,6 @@ static void age_unit(region * r, unit * u)
|
||||||
u_race(u)->age(u);
|
u_race(u)->age(u);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef ASTRAL_ITEM_RESTRICTIONS
|
|
||||||
if (u->region && is_astral(u->region)) {
|
if (u->region && is_astral(u->region)) {
|
||||||
item **itemp = &u->items;
|
item **itemp = &u->items;
|
||||||
while (*itemp) {
|
while (*itemp) {
|
||||||
|
@ -168,7 +167,6 @@ static void age_unit(region * r, unit * u)
|
||||||
itemp = &itm->next;
|
itemp = &itm->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void live(region * r)
|
static void live(region * r)
|
||||||
|
@ -3606,11 +3604,7 @@ void monthly_healing(void)
|
||||||
|
|
||||||
p *= heal_factor(u);
|
p *= heal_factor(u);
|
||||||
if (u->hp < umhp) {
|
if (u->hp < umhp) {
|
||||||
#ifdef NEW_DAEMONHUNGER_RULE
|
|
||||||
double maxheal = _max(u->number, umhp / 20.0);
|
double maxheal = _max(u->number, umhp / 20.0);
|
||||||
#else
|
|
||||||
double maxheal = _max(u->number, umhp / 10.0);
|
|
||||||
#endif
|
|
||||||
int addhp;
|
int addhp;
|
||||||
struct building *b = inside_building(u);
|
struct building *b = inside_building(u);
|
||||||
const struct building_type *btype = b ? b->type : NULL;
|
const struct building_type *btype = b ? b->type : NULL;
|
||||||
|
|
43
src/magic.c
43
src/magic.c
|
@ -229,21 +229,12 @@ struct storage *store)
|
||||||
spell *sp;
|
spell *sp;
|
||||||
char spname[64];
|
char spname[64];
|
||||||
|
|
||||||
if (global.data_version < SPELLNAME_VERSION) {
|
READ_TOK(store, spname, sizeof(spname));
|
||||||
int i;
|
if (strcmp(spname, "end") == 0)
|
||||||
READ_INT(store, &i);
|
break;
|
||||||
if (i < 0)
|
sp = find_spell(spname);
|
||||||
break;
|
if (!sp) {
|
||||||
sp = find_spellbyid((unsigned int)i);
|
log_error("read_spells: could not find spell '%s' in school '%s'\n", spname, magic_school[mtype]);
|
||||||
}
|
|
||||||
else {
|
|
||||||
READ_TOK(store, spname, sizeof(spname));
|
|
||||||
if (strcmp(spname, "end") == 0)
|
|
||||||
break;
|
|
||||||
sp = find_spell(spname);
|
|
||||||
if (!sp) {
|
|
||||||
log_error("read_spells: could not find spell '%s' in school '%s'\n", spname, magic_school[mtype]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (sp) {
|
if (sp) {
|
||||||
add_spell(slistp, sp);
|
add_spell(slistp, sp);
|
||||||
|
@ -272,23 +263,13 @@ static int read_mage(attrib * a, void *owner, struct storage *store)
|
||||||
for (i = 0; i != MAXCOMBATSPELLS; ++i) {
|
for (i = 0; i != MAXCOMBATSPELLS; ++i) {
|
||||||
spell *sp = NULL;
|
spell *sp = NULL;
|
||||||
int level = 0;
|
int level = 0;
|
||||||
if (global.data_version < SPELLNAME_VERSION) {
|
READ_TOK(store, spname, sizeof(spname));
|
||||||
int spid;
|
READ_INT(store, &level);
|
||||||
READ_INT(store, &spid);
|
|
||||||
READ_INT(store, &level);
|
|
||||||
if (spid >= 0) {
|
|
||||||
sp = find_spellbyid((unsigned int)spid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
READ_TOK(store, spname, sizeof(spname));
|
|
||||||
READ_INT(store, &level);
|
|
||||||
|
|
||||||
if (strcmp("none", spname) != 0) {
|
if (strcmp("none", spname) != 0) {
|
||||||
sp = find_spell(spname);
|
sp = find_spell(spname);
|
||||||
if (!sp) {
|
if (!sp) {
|
||||||
log_error("read_mage: could not find combat spell '%s' in school '%s'\n", spname, magic_school[mage->magietyp]);
|
log_error("read_mage: could not find combat spell '%s' in school '%s'\n", spname, magic_school[mage->magietyp]);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sp && level >= 0) {
|
if (sp && level >= 0) {
|
||||||
|
|
|
@ -24,14 +24,11 @@
|
||||||
#define NEWATSROI 0
|
#define NEWATSROI 0
|
||||||
|
|
||||||
/* Vermehrungsrate Bauern in 1/10000.
|
/* Vermehrungsrate Bauern in 1/10000.
|
||||||
* Evt. Berechnungsfehler, reale Vermehrungsraten scheinen höher. */
|
* TODO: Evt. Berechnungsfehler, reale Vermehrungsraten scheinen höher. */
|
||||||
#define PEASANTGROWTH 10
|
#define PEASANTGROWTH 10
|
||||||
#define BATTLE_KILLS_PEASANTS 20
|
#define BATTLE_KILLS_PEASANTS 20
|
||||||
#define PEASANTLUCK 10
|
#define PEASANTLUCK 10
|
||||||
|
|
||||||
#define ASTRAL_ITEM_RESTRICTIONS /* keine grossen dinge im astralraum */
|
|
||||||
#define NEW_DAEMONHUNGER_RULE
|
|
||||||
#define NEW_COMBATSKILLS_RULE
|
|
||||||
#define ROW_FACTOR 3 /* factor for combat row advancement rule */
|
#define ROW_FACTOR 3 /* factor for combat row advancement rule */
|
||||||
|
|
||||||
/* optional game components. TODO: These should either be
|
/* optional game components. TODO: These should either be
|
||||||
|
@ -42,14 +39,5 @@
|
||||||
#define MUSEUM_MODULE 1
|
#define MUSEUM_MODULE 1
|
||||||
#define ARENA_MODULE 1
|
#define ARENA_MODULE 1
|
||||||
#define CHANGED_CROSSBOWS 0 /* use the WTF_ARMORPIERCING flag */
|
#define CHANGED_CROSSBOWS 0 /* use the WTF_ARMORPIERCING flag */
|
||||||
#undef GLOBAL_WARMING /* number of turns before global warming sets in */
|
|
||||||
|
|
||||||
#if defined(BINDINGS_LUABIND)
|
|
||||||
# undef BINDINGS_TOLUA
|
|
||||||
#elif defined(BINDINGS_TOLUA)
|
|
||||||
# undef BINDINGS_LUABIND
|
|
||||||
#else
|
|
||||||
# define BINDINGS_TOLUA /* new default */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#undef REGIONOWNERS /* (WIP) region-owner uses HELP_TRAVEL to control entry to region */
|
#undef REGIONOWNERS /* (WIP) region-owner uses HELP_TRAVEL to control entry to region */
|
||||||
|
|
|
@ -174,17 +174,8 @@ static void wall_read(connection * b, storage * store)
|
||||||
{
|
{
|
||||||
static wall_data dummy;
|
static wall_data dummy;
|
||||||
wall_data *fd = b->data.v ? (wall_data *) b->data.v : &dummy;
|
wall_data *fd = b->data.v ? (wall_data *) b->data.v : &dummy;
|
||||||
variant mno;
|
|
||||||
|
|
||||||
if (global.data_version < STORAGE_VERSION) {
|
read_reference(&fd->mage, store, read_unit_reference, resolve_unit);
|
||||||
READ_INT(store, &mno.i);
|
|
||||||
fd->mage = findunit(mno.i);
|
|
||||||
if (!fd->mage && b->data.v) {
|
|
||||||
ur_add(mno, &fd->mage, resolve_unit);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
read_reference(&fd->mage, store, read_unit_reference, resolve_unit);
|
|
||||||
}
|
|
||||||
READ_INT(store, &fd->force);
|
READ_INT(store, &fd->force);
|
||||||
if (global.data_version >= NOBORDERATTRIBS_VERSION) {
|
if (global.data_version >= NOBORDERATTRIBS_VERSION) {
|
||||||
READ_INT(store, &fd->countdown);
|
READ_INT(store, &fd->countdown);
|
||||||
|
|
|
@ -44,32 +44,33 @@
|
||||||
*/
|
*/
|
||||||
/* erhöht/senkt regeneration und maxaura um effect% */
|
/* erhöht/senkt regeneration und maxaura um effect% */
|
||||||
static message *cinfo_auraboost(const void *obj, objtype_t typ, const curse * c,
|
static message *cinfo_auraboost(const void *obj, objtype_t typ, const curse * c,
|
||||||
int self)
|
int self)
|
||||||
{
|
{
|
||||||
struct unit *u = (struct unit *)obj;
|
struct unit *u = (struct unit *)obj;
|
||||||
unused_arg(typ);
|
unused_arg(typ);
|
||||||
assert(typ == TYP_UNIT);
|
assert(typ == TYP_UNIT);
|
||||||
|
|
||||||
if (self != 0) {
|
if (self != 0) {
|
||||||
if (curse_geteffect(c) > 100) {
|
if (curse_geteffect(c) > 100) {
|
||||||
return msg_message("curseinfo::auraboost_0", "unit id", u, c->no);
|
return msg_message("curseinfo::auraboost_0", "unit id", u, c->no);
|
||||||
} else {
|
}
|
||||||
return msg_message("curseinfo::auraboost_1", "unit id", u, c->no);
|
else {
|
||||||
|
return msg_message("curseinfo::auraboost_1", "unit id", u, c->no);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
return NULL;
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct curse_type ct_auraboost = {
|
static struct curse_type ct_auraboost = {
|
||||||
"auraboost",
|
"auraboost",
|
||||||
CURSETYP_NORM, CURSE_SPREADMODULO, (NO_MERGE),
|
CURSETYP_NORM, CURSE_SPREADMODULO, (NO_MERGE),
|
||||||
cinfo_auraboost
|
cinfo_auraboost
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Magic Boost - Gabe des Chaos */
|
/* Magic Boost - Gabe des Chaos */
|
||||||
static struct curse_type ct_magicboost = {
|
static struct curse_type ct_magicboost = {
|
||||||
"magicboost",
|
"magicboost",
|
||||||
CURSETYP_UNIT, CURSE_SPREADMODULO | CURSE_IMMUNE, M_MEN, cinfo_simple
|
CURSETYP_UNIT, CURSE_SPREADMODULO | CURSE_IMMUNE, M_MEN, cinfo_simple
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
|
@ -77,24 +78,24 @@ static struct curse_type ct_magicboost = {
|
||||||
* C_SLAVE
|
* C_SLAVE
|
||||||
*/
|
*/
|
||||||
static message *cinfo_slave(const void *obj, objtype_t typ, const curse * c,
|
static message *cinfo_slave(const void *obj, objtype_t typ, const curse * c,
|
||||||
int self)
|
int self)
|
||||||
{
|
{
|
||||||
unit *u;
|
unit *u;
|
||||||
unused_arg(typ);
|
unused_arg(typ);
|
||||||
|
|
||||||
assert(typ == TYP_UNIT);
|
assert(typ == TYP_UNIT);
|
||||||
u = (unit *) obj;
|
u = (unit *)obj;
|
||||||
|
|
||||||
if (self != 0) {
|
if (self != 0) {
|
||||||
return msg_message("curseinfo::slave_1", "unit duration id", u, c->duration,
|
return msg_message("curseinfo::slave_1", "unit duration id", u, c->duration,
|
||||||
c->no);
|
c->no);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct curse_type ct_slavery = { "slavery",
|
static struct curse_type ct_slavery = { "slavery",
|
||||||
CURSETYP_NORM, 0, NO_MERGE,
|
CURSETYP_NORM, 0, NO_MERGE,
|
||||||
cinfo_slave
|
cinfo_slave
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
|
@ -102,28 +103,28 @@ static struct curse_type ct_slavery = { "slavery",
|
||||||
* C_CALM
|
* C_CALM
|
||||||
*/
|
*/
|
||||||
static message *cinfo_calm(const void *obj, objtype_t typ, const curse * c,
|
static message *cinfo_calm(const void *obj, objtype_t typ, const curse * c,
|
||||||
int self)
|
int self)
|
||||||
{
|
{
|
||||||
unused_arg(typ);
|
unused_arg(typ);
|
||||||
assert(typ == TYP_UNIT);
|
assert(typ == TYP_UNIT);
|
||||||
|
|
||||||
if (c->magician && c->magician->faction) {
|
if (c->magician && c->magician->faction) {
|
||||||
faction *f = c->magician->faction;
|
faction *f = c->magician->faction;
|
||||||
unit *u = (unit *) obj;
|
unit *u = (unit *)obj;
|
||||||
|
|
||||||
if (f == NULL || self == 0) {
|
if (f == NULL || self == 0) {
|
||||||
const struct race *rc = u_irace(c->magician);
|
const struct race *rc = u_irace(c->magician);
|
||||||
return msg_message("curseinfo::calm_0", "unit race id", u, rc, c->no);
|
return msg_message("curseinfo::calm_0", "unit race id", u, rc, c->no);
|
||||||
|
}
|
||||||
|
return msg_message("curseinfo::calm_1", "unit faction id", u, f, c->no);
|
||||||
}
|
}
|
||||||
return msg_message("curseinfo::calm_1", "unit faction id", u, f, c->no);
|
return NULL;
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct curse_type ct_calmmonster = {
|
static struct curse_type ct_calmmonster = {
|
||||||
"calmmonster",
|
"calmmonster",
|
||||||
CURSETYP_NORM, CURSE_SPREADNEVER | CURSE_ONLYONE, NO_MERGE,
|
CURSETYP_NORM, CURSE_SPREADNEVER | CURSE_ONLYONE, NO_MERGE,
|
||||||
cinfo_calm
|
cinfo_calm
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
|
@ -131,23 +132,23 @@ static struct curse_type ct_calmmonster = {
|
||||||
* C_SPEED
|
* C_SPEED
|
||||||
*/
|
*/
|
||||||
static message *cinfo_speed(const void *obj, objtype_t typ, const curse * c,
|
static message *cinfo_speed(const void *obj, objtype_t typ, const curse * c,
|
||||||
int self)
|
int self)
|
||||||
{
|
{
|
||||||
unused_arg(typ);
|
unused_arg(typ);
|
||||||
assert(typ == TYP_UNIT);
|
assert(typ == TYP_UNIT);
|
||||||
|
|
||||||
if (self != 0) {
|
if (self != 0) {
|
||||||
unit *u = (unit *) obj;
|
unit *u = (unit *)obj;
|
||||||
return msg_message("curseinfo::speed_1", "unit number duration id", u,
|
return msg_message("curseinfo::speed_1", "unit number duration id", u,
|
||||||
c->data.i, c->duration, c->no);
|
c->data.i, c->duration, c->no);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct curse_type ct_speed = {
|
static struct curse_type ct_speed = {
|
||||||
"speed",
|
"speed",
|
||||||
CURSETYP_UNIT, CURSE_SPREADNEVER, M_MEN,
|
CURSETYP_UNIT, CURSE_SPREADNEVER, M_MEN,
|
||||||
cinfo_speed
|
cinfo_speed
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
|
@ -156,21 +157,21 @@ static struct curse_type ct_speed = {
|
||||||
*/
|
*/
|
||||||
message *cinfo_unit(const void *obj, objtype_t typ, const curse * c, int self)
|
message *cinfo_unit(const void *obj, objtype_t typ, const curse * c, int self)
|
||||||
{
|
{
|
||||||
unused_arg(typ);
|
unused_arg(typ);
|
||||||
assert(typ == TYP_UNIT);
|
assert(typ == TYP_UNIT);
|
||||||
|
|
||||||
if (self != 0) {
|
if (self != 0) {
|
||||||
unit *u = (unit *) obj;
|
unit *u = (unit *)obj;
|
||||||
return msg_message(mkname("curseinfo", c->type->cname), "unit id", u,
|
return msg_message(mkname("curseinfo", c->type->cname), "unit id", u,
|
||||||
c->no);
|
c->no);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct curse_type ct_orcish = {
|
static struct curse_type ct_orcish = {
|
||||||
"orcish",
|
"orcish",
|
||||||
CURSETYP_UNIT, CURSE_SPREADMODULO | CURSE_ISNEW, M_MEN,
|
CURSETYP_UNIT, CURSE_SPREADMODULO | CURSE_ISNEW, M_MEN,
|
||||||
cinfo_unit
|
cinfo_unit
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
|
@ -178,23 +179,23 @@ static struct curse_type ct_orcish = {
|
||||||
* C_KAELTESCHUTZ
|
* C_KAELTESCHUTZ
|
||||||
*/
|
*/
|
||||||
static message *cinfo_kaelteschutz(const void *obj, objtype_t typ, const curse * c,
|
static message *cinfo_kaelteschutz(const void *obj, objtype_t typ, const curse * c,
|
||||||
int self)
|
int self)
|
||||||
{
|
{
|
||||||
unused_arg(typ);
|
unused_arg(typ);
|
||||||
assert(typ == TYP_UNIT);
|
assert(typ == TYP_UNIT);
|
||||||
|
|
||||||
if (self != 0) {
|
if (self != 0) {
|
||||||
unit *u = (unit *) obj;
|
unit *u = (unit *)obj;
|
||||||
return msg_message("curseinfo::warmth_1", "unit number id", u,
|
return msg_message("curseinfo::warmth_1", "unit number id", u,
|
||||||
get_cursedmen(u, c), c->no);
|
get_cursedmen(u, c), c->no);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct curse_type ct_insectfur = {
|
static struct curse_type ct_insectfur = {
|
||||||
"insectfur",
|
"insectfur",
|
||||||
CURSETYP_UNIT, CURSE_SPREADMODULO, (M_MEN | M_DURATION),
|
CURSETYP_UNIT, CURSE_SPREADMODULO, (M_MEN | M_DURATION),
|
||||||
cinfo_kaelteschutz
|
cinfo_kaelteschutz
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
|
@ -202,64 +203,64 @@ static struct curse_type ct_insectfur = {
|
||||||
* C_SPARKLE
|
* C_SPARKLE
|
||||||
*/
|
*/
|
||||||
static message *cinfo_sparkle(const void *obj, objtype_t typ, const curse * c,
|
static message *cinfo_sparkle(const void *obj, objtype_t typ, const curse * c,
|
||||||
int self)
|
int self)
|
||||||
{
|
{
|
||||||
const char *effects[] = {
|
const char *effects[] = {
|
||||||
NULL, /* end grau */
|
NULL, /* end grau */
|
||||||
"sparkle_1",
|
"sparkle_1",
|
||||||
"sparkle_2",
|
"sparkle_2",
|
||||||
NULL, /* end traum */
|
NULL, /* end traum */
|
||||||
"sparkle_3",
|
"sparkle_3",
|
||||||
"sparkle_4",
|
"sparkle_4",
|
||||||
NULL, /* end tybied */
|
NULL, /* end tybied */
|
||||||
"sparkle_5",
|
"sparkle_5",
|
||||||
"sparkle_6",
|
"sparkle_6",
|
||||||
"sparkle_7",
|
"sparkle_7",
|
||||||
"sparkle_8",
|
"sparkle_8",
|
||||||
NULL, /* end cerrdor */
|
NULL, /* end cerrdor */
|
||||||
"sparkle_9",
|
"sparkle_9",
|
||||||
"sparkle_10",
|
"sparkle_10",
|
||||||
"sparkle_11",
|
"sparkle_11",
|
||||||
"sparkle_12",
|
"sparkle_12",
|
||||||
NULL, /* end gwyrrd */
|
NULL, /* end gwyrrd */
|
||||||
"sparkle_13",
|
"sparkle_13",
|
||||||
"sparkle_14",
|
"sparkle_14",
|
||||||
"sparkle_15",
|
"sparkle_15",
|
||||||
"sparkle_16",
|
"sparkle_16",
|
||||||
"sparkle_17",
|
"sparkle_17",
|
||||||
"sparkle_18",
|
"sparkle_18",
|
||||||
NULL, /* end draig */
|
NULL, /* end draig */
|
||||||
};
|
};
|
||||||
int m, begin = 0, end = 0;
|
int m, begin = 0, end = 0;
|
||||||
unit *u;
|
unit *u;
|
||||||
unused_arg(typ);
|
unused_arg(typ);
|
||||||
|
|
||||||
assert(typ == TYP_UNIT);
|
assert(typ == TYP_UNIT);
|
||||||
u = (unit *) obj;
|
u = (unit *)obj;
|
||||||
|
|
||||||
if (!c->magician || !c->magician->faction)
|
if (!c->magician || !c->magician->faction)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
for (m = 0; m != c->magician->faction->magiegebiet; ++m) {
|
||||||
|
while (effects[end] != NULL)
|
||||||
|
++end;
|
||||||
|
begin = end + 1;
|
||||||
|
end = begin;
|
||||||
|
}
|
||||||
|
|
||||||
for (m = 0; m != c->magician->faction->magiegebiet; ++m) {
|
|
||||||
while (effects[end] != NULL)
|
while (effects[end] != NULL)
|
||||||
++end;
|
++end;
|
||||||
begin = end + 1;
|
if (end == begin)
|
||||||
end = begin;
|
return NULL;
|
||||||
}
|
else {
|
||||||
|
int index = begin + curse_geteffect_int(c) % (end - begin);
|
||||||
while (effects[end] != NULL)
|
return msg_message(mkname("curseinfo", effects[index]), "unit id", u,
|
||||||
++end;
|
c->no);
|
||||||
if (end == begin)
|
}
|
||||||
return NULL;
|
|
||||||
else {
|
|
||||||
int index = begin + curse_geteffect_int(c) % (end - begin);
|
|
||||||
return msg_message(mkname("curseinfo", effects[index]), "unit id", u,
|
|
||||||
c->no);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct curse_type ct_sparkle = { "sparkle",
|
static struct curse_type ct_sparkle = { "sparkle",
|
||||||
CURSETYP_UNIT, CURSE_SPREADMODULO, (M_MEN | M_DURATION), cinfo_sparkle
|
CURSETYP_UNIT, CURSE_SPREADMODULO, (M_MEN | M_DURATION), cinfo_sparkle
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
|
@ -267,7 +268,7 @@ static struct curse_type ct_sparkle = { "sparkle",
|
||||||
* C_STRENGTH
|
* C_STRENGTH
|
||||||
*/
|
*/
|
||||||
static struct curse_type ct_strength = { "strength",
|
static struct curse_type ct_strength = { "strength",
|
||||||
CURSETYP_UNIT, CURSE_SPREADMODULO, M_MEN, cinfo_simple
|
CURSETYP_UNIT, CURSE_SPREADMODULO, M_MEN, cinfo_simple
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
|
@ -275,7 +276,7 @@ static struct curse_type ct_strength = { "strength",
|
||||||
* C_ALLSKILLS (Alp)
|
* C_ALLSKILLS (Alp)
|
||||||
*/
|
*/
|
||||||
static struct curse_type ct_worse = {
|
static struct curse_type ct_worse = {
|
||||||
"worse", CURSETYP_UNIT, CURSE_SPREADMODULO | CURSE_NOAGE, M_MEN, cinfo_unit
|
"worse", CURSETYP_UNIT, CURSE_SPREADMODULO | CURSE_NOAGE, M_MEN, cinfo_unit
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
|
@ -284,24 +285,24 @@ static struct curse_type ct_worse = {
|
||||||
* C_ITEMCLOAK
|
* C_ITEMCLOAK
|
||||||
*/
|
*/
|
||||||
static struct curse_type ct_itemcloak = {
|
static struct curse_type ct_itemcloak = {
|
||||||
"itemcloak", CURSETYP_UNIT, CURSE_SPREADNEVER, M_DURATION, cinfo_unit
|
"itemcloak", CURSETYP_UNIT, CURSE_SPREADNEVER, M_DURATION, cinfo_unit
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
|
|
||||||
static struct curse_type ct_fumble = {
|
static struct curse_type ct_fumble = {
|
||||||
"fumble", CURSETYP_NORM, CURSE_SPREADNEVER | CURSE_ONLYONE, NO_MERGE,
|
"fumble", CURSETYP_NORM, CURSE_SPREADNEVER | CURSE_ONLYONE, NO_MERGE,
|
||||||
cinfo_unit
|
cinfo_unit
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
|
|
||||||
static struct curse_type ct_oldrace = {
|
static struct curse_type ct_oldrace = {
|
||||||
"oldrace", CURSETYP_NORM, CURSE_SPREADALWAYS, NO_MERGE, NULL
|
"oldrace", CURSETYP_NORM, CURSE_SPREADALWAYS, NO_MERGE, NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct curse_type ct_magicresistance = {
|
static struct curse_type ct_magicresistance = {
|
||||||
"magicresistance", CURSETYP_UNIT, CURSE_SPREADMODULO, M_MEN, cinfo_simple
|
"magicresistance", CURSETYP_UNIT, CURSE_SPREADMODULO, M_MEN, cinfo_simple
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
|
@ -311,62 +312,58 @@ static struct curse_type ct_magicresistance = {
|
||||||
|
|
||||||
static int read_skill(struct storage *store, curse * c, void *target)
|
static int read_skill(struct storage *store, curse * c, void *target)
|
||||||
{
|
{
|
||||||
int skill;
|
int skill;
|
||||||
if (global.data_version < CURSETYPE_VERSION) {
|
|
||||||
READ_INT(store, &skill);
|
READ_INT(store, &skill);
|
||||||
READ_INT(store, 0); /* men, ignored */
|
c->data.i = skill;
|
||||||
} else {
|
return 0;
|
||||||
READ_INT(store, &skill);
|
|
||||||
}
|
|
||||||
c->data.i = skill;
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
write_skill(struct storage *store, const curse * c, const void *target)
|
write_skill(struct storage *store, const curse * c, const void *target)
|
||||||
{
|
{
|
||||||
WRITE_INT(store, c->data.i);
|
WRITE_INT(store, c->data.i);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static message *cinfo_skillmod(const void *obj, objtype_t typ, const curse * c,
|
static message *cinfo_skillmod(const void *obj, objtype_t typ, const curse * c,
|
||||||
int self)
|
int self)
|
||||||
{
|
{
|
||||||
unused_arg(typ);
|
unused_arg(typ);
|
||||||
|
|
||||||
if (self != 0) {
|
if (self != 0) {
|
||||||
unit *u = (unit *) obj;
|
unit *u = (unit *)obj;
|
||||||
int sk = c->data.i;
|
int sk = c->data.i;
|
||||||
if (c->effect > 0) {
|
if (c->effect > 0) {
|
||||||
return msg_message("curseinfo::skill_1", "unit skill id", u, sk, c->no);
|
return msg_message("curseinfo::skill_1", "unit skill id", u, sk, c->no);
|
||||||
} else if (c->effect < 0) {
|
}
|
||||||
return msg_message("curseinfo::skill_2", "unit skill id", u, sk, c->no);
|
else if (c->effect < 0) {
|
||||||
|
return msg_message("curseinfo::skill_2", "unit skill id", u, sk, c->no);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
return NULL;
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct curse_type ct_skillmod = {
|
static struct curse_type ct_skillmod = {
|
||||||
"skillmod", CURSETYP_NORM, CURSE_SPREADMODULO, M_MEN, cinfo_skillmod,
|
"skillmod", CURSETYP_NORM, CURSE_SPREADMODULO, M_MEN, cinfo_skillmod,
|
||||||
NULL, read_skill, write_skill
|
NULL, read_skill, write_skill
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
void register_unitcurse(void)
|
void register_unitcurse(void)
|
||||||
{
|
{
|
||||||
ct_register(&ct_auraboost);
|
ct_register(&ct_auraboost);
|
||||||
ct_register(&ct_magicboost);
|
ct_register(&ct_magicboost);
|
||||||
ct_register(&ct_slavery);
|
ct_register(&ct_slavery);
|
||||||
ct_register(&ct_calmmonster);
|
ct_register(&ct_calmmonster);
|
||||||
ct_register(&ct_speed);
|
ct_register(&ct_speed);
|
||||||
ct_register(&ct_orcish);
|
ct_register(&ct_orcish);
|
||||||
ct_register(&ct_insectfur);
|
ct_register(&ct_insectfur);
|
||||||
ct_register(&ct_sparkle);
|
ct_register(&ct_sparkle);
|
||||||
ct_register(&ct_strength);
|
ct_register(&ct_strength);
|
||||||
ct_register(&ct_worse);
|
ct_register(&ct_worse);
|
||||||
ct_register(&ct_skillmod);
|
ct_register(&ct_skillmod);
|
||||||
ct_register(&ct_itemcloak);
|
ct_register(&ct_itemcloak);
|
||||||
ct_register(&ct_fumble);
|
ct_register(&ct_fumble);
|
||||||
ct_register(&ct_oldrace);
|
ct_register(&ct_oldrace);
|
||||||
ct_register(&ct_magicresistance);
|
ct_register(&ct_magicresistance);
|
||||||
}
|
}
|
||||||
|
|
10
src/study.c
10
src/study.c
|
@ -328,13 +328,8 @@ int teach_cmd(unit * u, struct order *ord)
|
||||||
} while (sk != NOSKILL);
|
} while (sk != NOSKILL);
|
||||||
while (teaching && student) {
|
while (teaching && student) {
|
||||||
if (student->faction == u->faction) {
|
if (student->faction == u->faction) {
|
||||||
#ifdef NEW_DAEMONHUNGER_RULE
|
|
||||||
if (LongHunger(student))
|
if (LongHunger(student))
|
||||||
continue;
|
continue;
|
||||||
#else
|
|
||||||
if (fval(student, UFL_HUNGER))
|
|
||||||
continue;
|
|
||||||
#endif
|
|
||||||
if (getkeyword(student->thisorder) == K_STUDY) {
|
if (getkeyword(student->thisorder) == K_STUDY) {
|
||||||
/* Input ist nun von student->thisorder !! */
|
/* Input ist nun von student->thisorder !! */
|
||||||
init_order(student->thisorder);
|
init_order(student->thisorder);
|
||||||
|
@ -358,13 +353,8 @@ int teach_cmd(unit * u, struct order *ord)
|
||||||
while (teaching && student) {
|
while (teaching && student) {
|
||||||
if (student->faction != u->faction
|
if (student->faction != u->faction
|
||||||
&& alliedunit(u, student->faction, HELP_GUARD)) {
|
&& alliedunit(u, student->faction, HELP_GUARD)) {
|
||||||
#ifdef NEW_DAEMONHUNGER_RULE
|
|
||||||
if (LongHunger(student))
|
if (LongHunger(student))
|
||||||
continue;
|
continue;
|
||||||
#else
|
|
||||||
if (fval(student, UFL_HUNGER))
|
|
||||||
continue;
|
|
||||||
#endif
|
|
||||||
if (getkeyword(student->thisorder) == K_STUDY) {
|
if (getkeyword(student->thisorder) == K_STUDY) {
|
||||||
/* Input ist nun von student->thisorder !! */
|
/* Input ist nun von student->thisorder !! */
|
||||||
init_order(student->thisorder);
|
init_order(student->thisorder);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
|
Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
|
||||||
Katja Zedel <katze@felidae.kn-bremen.de
|
Katja Zedel <katze@felidae.kn-bremen.de
|
||||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
|
@ -45,109 +45,98 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
**/
|
**/
|
||||||
|
|
||||||
typedef struct createcurse_data {
|
typedef struct createcurse_data {
|
||||||
struct unit *mage;
|
struct unit *mage;
|
||||||
struct unit *target;
|
struct unit *target;
|
||||||
const curse_type *type;
|
const curse_type *type;
|
||||||
float vigour;
|
float vigour;
|
||||||
int duration;
|
int duration;
|
||||||
float effect;
|
float effect;
|
||||||
int men;
|
int men;
|
||||||
} createcurse_data;
|
} createcurse_data;
|
||||||
|
|
||||||
static void createcurse_init(trigger * t)
|
static void createcurse_init(trigger * t)
|
||||||
{
|
{
|
||||||
t->data.v = calloc(sizeof(createcurse_data), 1);
|
t->data.v = calloc(sizeof(createcurse_data), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void createcurse_free(trigger * t)
|
static void createcurse_free(trigger * t)
|
||||||
{
|
{
|
||||||
free(t->data.v);
|
free(t->data.v);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int createcurse_handle(trigger * t, void *data)
|
static int createcurse_handle(trigger * t, void *data)
|
||||||
{
|
{
|
||||||
/* call an event handler on createcurse.
|
/* call an event handler on createcurse.
|
||||||
* data.v -> ( variant event, int timer )
|
* data.v -> ( variant event, int timer )
|
||||||
*/
|
*/
|
||||||
createcurse_data *td = (createcurse_data *) t->data.v;
|
createcurse_data *td = (createcurse_data *)t->data.v;
|
||||||
if (td->mage && td->target && td->mage->number && td->target->number) {
|
if (td->mage && td->target && td->mage->number && td->target->number) {
|
||||||
create_curse(td->mage, &td->target->attribs,
|
create_curse(td->mage, &td->target->attribs,
|
||||||
td->type, td->vigour, td->duration, td->effect, td->men);
|
td->type, td->vigour, td->duration, td->effect, td->men);
|
||||||
} else {
|
}
|
||||||
log_error("could not perform createcurse::handle()\n");
|
else {
|
||||||
}
|
log_error("could not perform createcurse::handle()\n");
|
||||||
unused_arg(data);
|
}
|
||||||
return 0;
|
unused_arg(data);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void createcurse_write(const trigger * t, struct storage *store)
|
static void createcurse_write(const trigger * t, struct storage *store)
|
||||||
{
|
{
|
||||||
createcurse_data *td = (createcurse_data *) t->data.v;
|
createcurse_data *td = (createcurse_data *)t->data.v;
|
||||||
write_unit_reference(td->mage, store);
|
write_unit_reference(td->mage, store);
|
||||||
write_unit_reference(td->target, store);
|
write_unit_reference(td->target, store);
|
||||||
WRITE_TOK(store, td->type->cname);
|
WRITE_TOK(store, td->type->cname);
|
||||||
WRITE_FLT(store, (float)td->vigour);
|
WRITE_FLT(store, (float)td->vigour);
|
||||||
WRITE_INT(store, td->duration);
|
WRITE_INT(store, td->duration);
|
||||||
WRITE_FLT(store, (float)td->effect);
|
WRITE_FLT(store, (float)td->effect);
|
||||||
WRITE_INT(store, td->men);
|
WRITE_INT(store, td->men);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int createcurse_read(trigger * t, struct storage *store)
|
static int createcurse_read(trigger * t, struct storage *store)
|
||||||
{
|
{
|
||||||
createcurse_data *td = (createcurse_data *) t->data.v;
|
createcurse_data *td = (createcurse_data *)t->data.v;
|
||||||
char zText[128];
|
char zText[128];
|
||||||
|
|
||||||
read_reference(&td->mage, store, read_unit_reference, resolve_unit);
|
read_reference(&td->mage, store, read_unit_reference, resolve_unit);
|
||||||
read_reference(&td->target, store, read_unit_reference, resolve_unit);
|
read_reference(&td->target, store, read_unit_reference, resolve_unit);
|
||||||
|
|
||||||
if (global.data_version < CURSETYPE_VERSION) {
|
|
||||||
int id1, id2, n;
|
|
||||||
READ_INT(store, &id1);
|
|
||||||
READ_INT(store, &id2);
|
|
||||||
assert(id2 == 0);
|
|
||||||
READ_FLT(store, &td->vigour);
|
|
||||||
READ_INT(store, &td->duration);
|
|
||||||
READ_INT(store, &n);
|
|
||||||
td->effect = (float)n;
|
|
||||||
READ_INT(store, &td->men);
|
|
||||||
td->type = ct_find(oldcursename(id1));
|
|
||||||
} else {
|
|
||||||
READ_TOK(store, zText, sizeof(zText));
|
READ_TOK(store, zText, sizeof(zText));
|
||||||
td->type = ct_find(zText);
|
td->type = ct_find(zText);
|
||||||
READ_FLT(store, &td->vigour);
|
READ_FLT(store, &td->vigour);
|
||||||
READ_INT(store, &td->duration);
|
READ_INT(store, &td->duration);
|
||||||
if (global.data_version < CURSEFLOAT_VERSION) {
|
if (global.data_version < CURSEFLOAT_VERSION) {
|
||||||
int n;
|
int n;
|
||||||
READ_INT(store, &n);
|
READ_INT(store, &n);
|
||||||
td->effect = (float)n;
|
td->effect = (float)n;
|
||||||
} else {
|
}
|
||||||
READ_FLT(store, &td->effect);
|
else {
|
||||||
|
READ_FLT(store, &td->effect);
|
||||||
}
|
}
|
||||||
READ_INT(store, &td->men);
|
READ_INT(store, &td->men);
|
||||||
}
|
return AT_READ_OK;
|
||||||
return AT_READ_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
trigger_type tt_createcurse = {
|
trigger_type tt_createcurse = {
|
||||||
"createcurse",
|
"createcurse",
|
||||||
createcurse_init,
|
createcurse_init,
|
||||||
createcurse_free,
|
createcurse_free,
|
||||||
createcurse_handle,
|
createcurse_handle,
|
||||||
createcurse_write,
|
createcurse_write,
|
||||||
createcurse_read
|
createcurse_read
|
||||||
};
|
};
|
||||||
|
|
||||||
trigger *trigger_createcurse(struct unit * mage, struct unit * target,
|
trigger *trigger_createcurse(struct unit * mage, struct unit * target,
|
||||||
const curse_type * ct, float vigour, int duration, float effect, int men)
|
const curse_type * ct, float vigour, int duration, float effect, int men)
|
||||||
{
|
{
|
||||||
trigger *t = t_new(&tt_createcurse);
|
trigger *t = t_new(&tt_createcurse);
|
||||||
createcurse_data *td = (createcurse_data *) t->data.v;
|
createcurse_data *td = (createcurse_data *)t->data.v;
|
||||||
td->mage = mage;
|
td->mage = mage;
|
||||||
td->target = target;
|
td->target = target;
|
||||||
td->type = ct;
|
td->type = ct;
|
||||||
td->vigour = vigour;
|
td->vigour = vigour;
|
||||||
td->duration = duration;
|
td->duration = duration;
|
||||||
td->effect = effect;
|
td->effect = effect;
|
||||||
td->men = men;
|
td->men = men;
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
33
src/vortex.c
33
src/vortex.c
|
@ -74,39 +74,16 @@ static int a_agedirection(attrib * a)
|
||||||
static int a_readdirection(attrib * a, void *owner, struct storage *store)
|
static int a_readdirection(attrib * a, void *owner, struct storage *store)
|
||||||
{
|
{
|
||||||
spec_direction *d = (spec_direction *)(a->data.v);
|
spec_direction *d = (spec_direction *)(a->data.v);
|
||||||
|
char lbuf[32];
|
||||||
|
|
||||||
(void) owner;
|
(void) owner;
|
||||||
READ_INT(store, &d->x);
|
READ_INT(store, &d->x);
|
||||||
READ_INT(store, &d->y);
|
READ_INT(store, &d->y);
|
||||||
READ_INT(store, &d->duration);
|
READ_INT(store, &d->duration);
|
||||||
if (global.data_version < UNICODE_VERSION) {
|
READ_TOK(store, lbuf, sizeof(lbuf));
|
||||||
char lbuf[16];
|
d->desc = _strdup(lbuf);
|
||||||
dir_lookup *dl = dir_name_lookup;
|
READ_TOK(store, lbuf, sizeof(lbuf));
|
||||||
|
d->keyword = _strdup(lbuf);
|
||||||
READ_TOK(store, NULL, 0);
|
|
||||||
READ_TOK(store, lbuf, sizeof(lbuf));
|
|
||||||
|
|
||||||
untilde(lbuf);
|
|
||||||
for (; dl; dl = dl->next) {
|
|
||||||
if (strcmp(lbuf, dl->oldname) == 0) {
|
|
||||||
d->keyword = _strdup(dl->name);
|
|
||||||
_snprintf(lbuf, sizeof(lbuf), "%s_desc", d->keyword);
|
|
||||||
d->desc = _strdup(dl->name);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (dl == NULL) {
|
|
||||||
log_error("unknown spec_direction '%s'\n", lbuf);
|
|
||||||
assert(!"not implemented");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
char lbuf[32];
|
|
||||||
READ_TOK(store, lbuf, sizeof(lbuf));
|
|
||||||
d->desc = _strdup(lbuf);
|
|
||||||
READ_TOK(store, lbuf, sizeof(lbuf));
|
|
||||||
d->keyword = _strdup(lbuf);
|
|
||||||
}
|
|
||||||
d->active = true;
|
d->active = true;
|
||||||
return AT_READ_OK;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue