diff --git a/src/give.c b/src/give.c index df1d64640..6e3e53a9f 100644 --- a/src/give.c +++ b/src/give.c @@ -530,9 +530,14 @@ message * give_men(int n, unit * u, unit * u2, struct order *ord) } if (u2->number == 0) { - set_racename(&u2->attribs, get_racename(u->attribs)); - u_setrace(u2, u_race(u)); - u2->irace = u->irace; + const race* rc = u_race(u); + if (rc->flags & RCF_SHAPESHIFT) { + set_racename(&u2->attribs, get_racename(u->attribs)); + } + u_setrace(u2, rc); + if (rc == get_race(RC_DAEMON)) { + u2->irace = u->irace; + } if (fval(u, UFL_HERO)) { fset(u2, UFL_HERO); } diff --git a/src/kernel/gamedata.h b/src/kernel/gamedata.h index 4e553fa43..f2b9238c1 100644 --- a/src/kernel/gamedata.h +++ b/src/kernel/gamedata.h @@ -48,8 +48,9 @@ #define SHIP_NUMBER_VERSION 370 /* ships have a number */ #define FIX_SHAPESHIFT_VERSION 371 /* shapeshifting demons */ #define FIX_SEAROADS_VERSION 372 /* removing roads in ocean regions */ +#define FIX_SHAPESHIFT_SPELL_VERSION 373 /* shapeshift spell, bug 2719 */ -#define RELEASE_VERSION FIX_SEAROADS_VERSION /* current datafile */ +#define RELEASE_VERSION FIX_SHAPESHIFT_SPELL_VERSION /* current datafile */ #define MIN_VERSION UIDHASH_VERSION /* minimal datafile we support */ #define MAX_VERSION RELEASE_VERSION /* change this if we can need to read the future datafile, and we can do so */ diff --git a/src/kernel/save.c b/src/kernel/save.c index e99ad2612..6a55aeb36 100644 --- a/src/kernel/save.c +++ b/src/kernel/save.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -444,10 +445,12 @@ unit *read_unit(gamedata *data) u_setrace(u, rc); READ_TOK(data->store, rname, sizeof(rname)); - if (rname[0]) + if (rname[0]) { u->irace = rc_find(rname); - else + } + else { u->irace = NULL; + } READ_INT(data->store, &bn); READ_INT(data->store, &sn); @@ -524,14 +527,39 @@ unit *read_unit(gamedata *data) u->hp = u->number; } read_attribs(data, &u->attribs, u); - if (rc_demon && data->version < FIX_SHAPESHIFT_VERSION) { + if (rc_demon) { if (u_race(u) == rc_demon) { - const char *zRace = get_racename(u->attribs); - if (zRace) { - const struct race *rc = rc_find(zRace); - if (rc) { - set_racename(&u->attribs, NULL); - u->irace = rc; + if (data->version < FIX_SHAPESHIFT_VERSION) { + const char* zRace = get_racename(u->attribs); + if (zRace) { + const struct race* rc = rc_find(zRace); + if (rc) { + set_racename(&u->attribs, NULL); + u->irace = rc; + } + } + } + } + else { + if (data->version < FIX_SHAPESHIFT_SPELL_VERSION) { + if (u->irace) { + /* Einheit ist rassengetarnt, aber hat sie einen changerace timer? */ + trigger** trigs = get_triggers(u->attribs, "timer"); + if (trigs) { + trigger* t = *trigs; + while (t != NULL) { + if (t->type == &tt_changerace) { + break; + } + t = t->next; + } + if (t == NULL) { + u->irace = NULL; + } + } + else { + u->irace = NULL; + } } } } diff --git a/src/spy.c b/src/spy.c index 530607a37..063adfca7 100644 --- a/src/spy.c +++ b/src/spy.c @@ -218,7 +218,7 @@ static void stealth_race(unit *u, const char *s) { } /* Schablonen können sich als alles mögliche tarnen */ - if (u_race(u)->flags & RCF_SHAPESHIFT) { + else if (u_race(u)->flags & RCF_SHAPESHIFT) { u->irace = trace; set_racename(&u->attribs, NULL); }