forked from github/server
add a fix for 2367 to fix_familiars
This commit is contained in:
parent
bb54e0d5ab
commit
0537d39b17
|
@ -24,8 +24,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include "alchemy.h"
|
||||
#include "alliance.h"
|
||||
#include "ally.h"
|
||||
#include "connection.h"
|
||||
#include "building.h"
|
||||
#include "connection.h"
|
||||
#include "equipment.h"
|
||||
#include "faction.h"
|
||||
#include "group.h"
|
||||
#include "item.h"
|
||||
|
@ -1600,11 +1601,31 @@ static void fix_familiars(void) {
|
|||
if (u->_race != u->faction->race && (u->_race->flags & RCF_FAMILIAR)) {
|
||||
/* unit is potentially a familiar */
|
||||
attrib * a = a_find(u->attribs, &at_mage);
|
||||
if (a) {
|
||||
/* unit is magical */
|
||||
attrib * am = a_find(u->attribs, &at_familiarmage);
|
||||
if (!am) {
|
||||
/* but it is not a familiar? */
|
||||
if (am) {
|
||||
sc_mage *mage = a ? (sc_mage *)a->data.v : NULL;
|
||||
/* a familiar */
|
||||
if (!mage) {
|
||||
log_error("%s seems to be a familiar with no magic.",
|
||||
unitname(u));
|
||||
mage = create_mage(u, M_GRAY);
|
||||
}
|
||||
if (!mage->spellbook) {
|
||||
char eqname[32];
|
||||
equipment *eq;
|
||||
|
||||
snprintf(eqname, sizeof(eqname), "fam_%s", u->_race->_name);
|
||||
eq = get_equipment(eqname);
|
||||
if (eq && eq->spells) {
|
||||
log_error("%s seems to be a familiar with no spells.",
|
||||
unitname(u));
|
||||
/* magical familiar, no spells */
|
||||
equip_unit_mask(u, eq, EQUIP_SPELLS);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (a) {
|
||||
/* not a familiar, but magical */
|
||||
attrib * ae = a_find(u->attribs, &at_eventhandler);
|
||||
if (ae) {
|
||||
trigger **tlist;
|
||||
|
@ -1640,7 +1661,6 @@ static void fix_familiars(void) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int read_game(gamedata *data)
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
/* unfinished: */
|
||||
#define CRYPT_VERSION 400 /* passwords are encrypted */
|
||||
|
||||
#define RELEASE_VERSION SKILLSORT_VERSION /* current datafile */
|
||||
#define RELEASE_VERSION LANDDISPLAY_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 */
|
||||
|
||||
|
|
Loading…
Reference in New Issue