forked from github/server
fix shapeshifted units without a timer do not transfer shapeshift spell when giving to a new unit.
This commit is contained in:
parent
fb294d9118
commit
af2dadfc8e
|
@ -530,9 +530,14 @@ message * give_men(int n, unit * u, unit * u2, struct order *ord)
|
|||
}
|
||||
|
||||
if (u2->number == 0) {
|
||||
const race* rc = u_race(u);
|
||||
if (rc->flags & RCF_SHAPESHIFT) {
|
||||
set_racename(&u2->attribs, get_racename(u->attribs));
|
||||
u_setrace(u2, u_race(u));
|
||||
}
|
||||
u_setrace(u2, rc);
|
||||
if (rc == get_race(RC_DAEMON)) {
|
||||
u2->irace = u->irace;
|
||||
}
|
||||
if (fval(u, UFL_HERO)) {
|
||||
fset(u2, UFL_HERO);
|
||||
}
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <attributes/attributes.h>
|
||||
#include <attributes/key.h>
|
||||
#include <attributes/racename.h>
|
||||
#include <triggers/changerace.h>
|
||||
#include <triggers/timeout.h>
|
||||
#include <triggers/shock.h>
|
||||
|
||||
|
@ -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,11 +527,12 @@ 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 (data->version < FIX_SHAPESHIFT_VERSION) {
|
||||
const char* zRace = get_racename(u->attribs);
|
||||
if (zRace) {
|
||||
const struct race *rc = rc_find(zRace);
|
||||
const struct race* rc = rc_find(zRace);
|
||||
if (rc) {
|
||||
set_racename(&u->attribs, NULL);
|
||||
u->irace = rc;
|
||||
|
@ -536,6 +540,30 @@ unit *read_unit(gamedata *data)
|
|||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
resolve_unit(u);
|
||||
return u;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue