Merge pull request #876 from ennorehling/master

Bug 2608 repair
This commit is contained in:
Enno Rehling 2019-09-15 14:24:14 +02:00 committed by GitHub
commit 8a8dd08b19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 298 additions and 96 deletions

2
clibs

@ -1 +1 @@
Subproject commit 1854780fe3073e491775836c22f709668b1fff62
Subproject commit f8969f44de1ec413cfee82b23c9f4b3c32d49b56

76
scripts/fix-death.lua Normal file
View File

@ -0,0 +1,76 @@
require 'config'
eressea.read_game('1137.dat')
local dead = {"cwz", "rama"}
local function list_items(f)
local items = {}
for u in f.units do
local r = u.region
for name in u.items do
local count = u:get_item(name)
if not items[r.id] then
items[r.id] = {}
end
if not items[r.id][name] then
items[r.id][name] = count
else
items[r.id][name] = items[r.id][name] + count
end
end
end
return items
end
gifts = {}
info = {}
for _, no in ipairs(dead) do
f = get_faction(no)
gifts[f.id] = list_items(f)
local allies = {}
for fno, as in pairs(f.allies) do
local f2 = get_faction(fno)
if f2:get_ally(f, 'give') then
allies[fno] = as
end
end
info[f.id] = {
['name'] = f.name,
['race'] = f.race,
['allies'] = allies
}
end
eressea.free_game()
eressea.read_game('1138.dat')
newf = {}
for fid, rlist in pairs(gifts) do
local name = "Erben von " . info[fid].name
local race = info[fid].race
local f = faction.create(race, "noreply@eressea.de")
f.name = name
f.age = 10
f.lastturn = 1130
table.insert(newf, f)
for rid, items in pairs(rlist) do
local r = get_region_by_id(rid)
local u = unit.create(f, r, 1)
for name, count in pairs(items) do
u:add_item(name, count)
end
end
for fno, as in pairs(info[fid].allies) do
local f2 = get_faction(fno)
for _, s in ipairs(as) do
f:set_ally(f2, s)
end
f2:set_ally(f, "give")
end
end
eressea.write_game('1138.new.dat')

View File

@ -0,0 +1,30 @@
require "lunit"
module("tests.e2.allies", package.seeall, lunit.testcase)
function skip_test_get_set_ally()
local f1 = faction.create("human")
local f2 = faction.create("human")
assert_equal(false, f1:get_ally(f2, "guard"))
f1:set_ally(f2, "guard", true)
assert_equal(true, f1:get_ally(f2, "guard"))
assert_equal(false, f1:get_ally(f2, "give"))
f1:set_ally(f2, "give", true)
assert_equal(true, f1:get_ally(f2, "give"))
end
function test_get_allies()
local f1 = faction.create("human")
local f2 = faction.create("human")
local allies = f1.allies
assert_equal('table', type(allies))
assert_equal(0, #allies)
f1:set_ally(f2, "give", true)
allies = f1.allies
assert_not_nil(allies[f2.id])
assert_equal('table', type(allies[f2.id]))
assert_equal(1, #allies[f2.id])
assert_equal("give", allies[f2.id][1])
end

View File

@ -1,3 +1,4 @@
require 'tests.e2.allies'
require 'tests.e2.quit'
require 'tests.e2.movement'
require 'tests.e2.astral'

View File

@ -19,6 +19,7 @@ without prior permission by the authors of Eressea.
#include "bindings.h"
#include "magic.h"
#include <kernel/ally.h>
#include <kernel/alliance.h>
#include <kernel/faction.h>
#include <kernel/unit.h>
@ -42,7 +43,10 @@ without prior permission by the authors of Eressea.
#include <lauxlib.h>
#include <tolua.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h> // for bool
#include <stdio.h> // for puts
struct allies;
int tolua_factionlist_next(lua_State * L)
{
@ -59,13 +63,13 @@ int tolua_factionlist_next(lua_State * L)
static int tolua_faction_get_units(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
unit **unit_ptr = (unit **)lua_newuserdata(L, sizeof(unit *));
luaL_getmetatable(L, TOLUA_CAST "unit");
lua_setmetatable(L, -2);
*unit_ptr = self->units;
*unit_ptr = f->units;
lua_pushcclosure(L, tolua_unitlist_nextf, 1);
return 1;
@ -73,7 +77,7 @@ static int tolua_faction_get_units(lua_State * L)
int tolua_faction_add_item(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
const char *iname = tolua_tostring(L, 2, NULL);
int number = (int)tolua_tonumber(L, 3, 0);
int result = -1;
@ -81,7 +85,7 @@ int tolua_faction_add_item(lua_State * L)
if (iname != NULL) {
const resource_type *rtype = rt_find(iname);
if (rtype && rtype->itype) {
item *i = i_change(&self->items, rtype->itype, number);
item *i = i_change(&f->items, rtype->itype, number);
result = i ? i->number : 0;
} /* if (itype!=NULL) */
}
@ -91,38 +95,38 @@ int tolua_faction_add_item(lua_State * L)
static int tolua_faction_get_maxheroes(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
lua_pushinteger(L, maxheroes(self));
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
lua_pushinteger(L, maxheroes(f));
return 1;
}
static int tolua_faction_get_heroes(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
lua_pushinteger(L, countheroes(self));
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
lua_pushinteger(L, countheroes(f));
return 1;
}
static int tolua_faction_get_score(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
lua_pushnumber(L, (lua_Number)self->score);
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
lua_pushnumber(L, (lua_Number)f->score);
return 1;
}
static int tolua_faction_get_id(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
lua_pushinteger(L, self->no);
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
lua_pushinteger(L, f->no);
return 1;
}
static int tolua_faction_set_id(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
int id = (int)tolua_tonumber(L, 2, 0);
if (findfaction(id) == NULL) {
renumber_faction(self, id);
renumber_faction(f, id);
lua_pushboolean(L, 1);
}
else {
@ -133,20 +137,20 @@ static int tolua_faction_set_id(lua_State * L)
static int tolua_faction_get_magic(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
lua_pushstring(L, magic_school[self->magiegebiet]);
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
lua_pushstring(L, magic_school[f->magiegebiet]);
return 1;
}
static int tolua_faction_set_magic(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
const char *type = tolua_tostring(L, 2, NULL);
int mtype;
for (mtype = 0; mtype != MAXMAGIETYP; ++mtype) {
if (strcmp(magic_school[mtype], type) == 0) {
self->magiegebiet = (magic_t)mtype;
f->magiegebiet = (magic_t)mtype;
break;
}
}
@ -155,89 +159,89 @@ static int tolua_faction_set_magic(lua_State * L)
static int tolua_faction_get_age(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
lua_pushinteger(L, self->age);
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
lua_pushinteger(L, f->age);
return 1;
}
static int tolua_faction_set_age(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
int age = (int)tolua_tonumber(L, 2, 0);
self->age = age;
f->age = age;
return 0;
}
static int tolua_faction_get_flags(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
lua_pushinteger(L, self->flags);
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
lua_pushinteger(L, f->flags);
return 1;
}
static int tolua_faction_set_flags(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
int flags = (int)tolua_tonumber(L, 2, self->flags);
self->flags = flags;
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
int flags = (int)tolua_tonumber(L, 2, f->flags);
f->flags = flags;
return 1;
}
static int tolua_faction_get_options(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
lua_pushinteger(L, self->options);
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
lua_pushinteger(L, f->options);
return 1;
}
static int tolua_faction_set_options(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
int options = (int)tolua_tonumber(L, 2, self->options);
self->options = options;
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
int options = (int)tolua_tonumber(L, 2, f->options);
f->options = options;
return 1;
}
static int tolua_faction_get_lastturn(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
lua_pushinteger(L, self->lastorders);
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
lua_pushinteger(L, f->lastorders);
return 1;
}
static int tolua_faction_set_lastturn(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
if (self) {
self->lastorders = (int)tolua_tonumber(L, 2, self->lastorders);
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
if (f) {
f->lastorders = (int)tolua_tonumber(L, 2, f->lastorders);
}
return 0;
}
static int tolua_faction_renumber(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
int no = (int)tolua_tonumber(L, 2, 0);
renumber_faction(self, no);
renumber_faction(f, no);
return 0;
}
static int tolua_faction_addnotice(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
const char *str = tolua_tostring(L, 2, NULL);
addmessage(NULL, self, str, MSG_MESSAGE, ML_IMPORTANT);
addmessage(NULL, f, str, MSG_MESSAGE, ML_IMPORTANT);
return 0;
}
static int tolua_faction_getkey(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
const char *name = tolua_tostring(L, 2, NULL);
int flag = atoi36(name);
int value = key_get(self->attribs, flag);
int value = key_get(f->attribs, flag);
if (value != 0) {
lua_pushinteger(L, value);
return 1;
@ -247,30 +251,30 @@ static int tolua_faction_getkey(lua_State * L)
static int tolua_faction_setkey(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
const char *name = tolua_tostring(L, 2, NULL);
int value = (int)tolua_tonumber(L, 3, 1);
int flag = atoi36(name);
if (value) {
key_set(&self->attribs, flag, value);
key_set(&f->attribs, flag, value);
}
else {
key_unset(&self->attribs, flag);
key_unset(&f->attribs, flag);
}
return 0;
}
static int tolua_faction_get_messages(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
int i = 1;
mlist *ml;
if (!self->msgs) {
if (!f->msgs) {
return 0;
}
lua_newtable(L);
for (ml = self->msgs->begin; ml; ml = ml->next, ++i) {
for (ml = f->msgs->begin; ml; ml = ml->next, ++i) {
lua_pushnumber(L, i);
lua_pushstring(L, ml->msg->type->name);
lua_rawset(L, -3);
@ -279,11 +283,11 @@ static int tolua_faction_get_messages(lua_State * L)
}
static int tolua_faction_count_msg_type(lua_State *L) {
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
const char *str = tolua_tostring(L, 2, NULL);
int n = 0;
if (self->msgs) {
mlist * ml = self->msgs->begin;
if (f->msgs) {
mlist * ml = f->msgs->begin;
while (ml) {
if (strcmp(str, ml->msg->type->name) == 0) {
++n;
@ -324,9 +328,9 @@ static int tolua_faction_set_origin(lua_State * L)
static int tolua_faction_get_origin(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
int x = 0, y = 0;
faction_getorigin(self, 0, &x, &y);
faction_getorigin(f, 0, &x, &y);
lua_pushinteger(L, x);
lua_pushinteger(L, y);
@ -374,48 +378,48 @@ static int tolua_faction_create(lua_State * L)
static int tolua_faction_get_password(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
tolua_pushstring(L, faction_getpassword(self));
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
tolua_pushstring(L, faction_getpassword(f));
return 1;
}
static int tolua_faction_set_password(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
const char * passw = tolua_tostring(L, 2, NULL);
faction_setpassword(self,
faction_setpassword(f,
passw ? password_hash(passw, PASSWORD_DEFAULT) : NULL);
return 0;
}
static int tolua_faction_get_email(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
tolua_pushstring(L, faction_getemail(self));
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
tolua_pushstring(L, faction_getemail(f));
return 1;
}
static int tolua_faction_set_email(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
faction_setemail(self, tolua_tostring(L, 2, NULL));
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
faction_setemail(f, tolua_tostring(L, 2, NULL));
return 0;
}
static int tolua_faction_get_locale(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
tolua_pushstring(L, locale_name(self->locale));
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
tolua_pushstring(L, locale_name(f->locale));
return 1;
}
static int tolua_faction_set_locale(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
const char *name = tolua_tostring(L, 2, NULL);
const struct locale *loc = get_locale(name);
if (loc) {
self->locale = loc;
f->locale = loc;
}
else {
tolua_pushstring(L, "invalid locale");
@ -426,18 +430,18 @@ static int tolua_faction_set_locale(lua_State * L)
static int tolua_faction_get_race(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
tolua_pushstring(L, self->race->_name);
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
tolua_pushstring(L, f->race->_name);
return 1;
}
static int tolua_faction_set_race(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
const char *name = tolua_tostring(L, 2, NULL);
const race *rc = rc_find(name);
if (rc != NULL) {
self->race = rc;
f->race = rc;
}
return 0;
@ -445,15 +449,15 @@ static int tolua_faction_set_race(lua_State * L)
static int tolua_faction_get_name(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
tolua_pushstring(L, faction_getname(self));
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
tolua_pushstring(L, faction_getname(f));
return 1;
}
static int tolua_faction_set_name(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
faction_setname(self, tolua_tostring(L, 2, NULL));
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
faction_setname(f, tolua_tostring(L, 2, NULL));
return 0;
}
@ -473,44 +477,108 @@ static int tolua_faction_set_uid(lua_State * L)
static int tolua_faction_get_info(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
tolua_pushstring(L, faction_getbanner(self));
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
tolua_pushstring(L, faction_getbanner(f));
return 1;
}
static int tolua_faction_set_info(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
faction_setbanner(self, tolua_tostring(L, 2, NULL));
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
faction_setbanner(f, tolua_tostring(L, 2, NULL));
return 0;
}
static int tolua_faction_get_alliance(lua_State * L)
/* TODO: this is probably useful elsewhere */
static const char *status_names[] = {
"money", "fight", "observe", "give", "guard", "stealth", "travel", NULL
};
static int cb_ally_push(struct allies *af, struct faction *f, int status, void *udata) {
struct lua_State *L = (struct lua_State *)udata;
int len = 1;
int i;
lua_pushnumber(L, f->no);
lua_newtable(L);
for (i = 0; status_names[i]; ++i) {
int flag = 1 << i;
if (status & flag) {
lua_pushstring(L, status_names[i]);
lua_rawseti(L, -2, len++);
}
}
lua_rawset(L, -3);
return 0;
}
static int tolua_faction_get_allies(lua_State * L) {
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
lua_newtable(L);
allies_walk(f->allies, cb_ally_push, L);
return 1;
}
static int tolua_faction_set_ally(lua_State * L) {
faction *f1 = (faction *)tolua_tousertype(L, 1, NULL);
faction *f2 = (faction *)tolua_tousertype(L, 2, NULL);
const char *status = tolua_tostring(L, 3, NULL);
bool value = tolua_toboolean(L, 4, 1);
if (status) {
int flag = ally_status(status);
int flags = ally_get(f1->allies, f2);
if (value) {
flags |= flag;
}
else {
flags &= ~flag;
}
ally_set(&f1->allies, f2, flags);
}
return 0;
}
static int tolua_faction_get_ally(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
tolua_pushusertype(L, f_get_alliance(self), TOLUA_CAST "alliance");
faction *f1 = (faction *)tolua_tousertype(L, 1, NULL);
faction *f2 = (faction *)tolua_tousertype(L, 2, NULL);
const char *status = tolua_tostring(L, 3, NULL);
if (f1 && f2 && status) {
int test = ally_status(status);
int flags = ally_get(f1->allies, f2);
lua_pushboolean(L, (test & flags) == test);
return 1;
}
return 0;
}
static int tolua_faction_get_alliances(lua_State * L)
{
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
tolua_pushusertype(L, f_get_alliance(f), TOLUA_CAST "alliance");
return 1;
}
static int tolua_faction_set_alliance(lua_State * L)
{
struct faction *self = (struct faction *)tolua_tousertype(L, 1, NULL);
struct faction *f = (struct faction *)tolua_tousertype(L, 1, NULL);
struct alliance *alli = (struct alliance *) tolua_tousertype(L, 2, NULL);
setalliance(self, alli);
setalliance(f, alli);
return 0;
}
static int tolua_faction_get_items(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
item **item_ptr = (item **)lua_newuserdata(L, sizeof(item *));
luaL_getmetatable(L, TOLUA_CAST "item");
lua_setmetatable(L, -2);
*item_ptr = self->items;
*item_ptr = f->items;
lua_pushcclosure(L, tolua_itemlist_next, 1);
@ -519,8 +587,8 @@ static int tolua_faction_get_items(lua_State * L)
static int tolua_faction_tostring(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
lua_pushstring(L, factionname(self));
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
lua_pushstring(L, factionname(f));
return 1;
}
@ -563,8 +631,6 @@ void tolua_faction_open(lua_State * L)
tolua_faction_set_locale);
tolua_variable(L, TOLUA_CAST "race", tolua_faction_get_race,
tolua_faction_set_race);
tolua_variable(L, TOLUA_CAST "alliance", tolua_faction_get_alliance,
tolua_faction_set_alliance);
tolua_variable(L, TOLUA_CAST "score", tolua_faction_get_score, NULL);
tolua_variable(L, TOLUA_CAST "magic", tolua_faction_get_magic,
tolua_faction_set_magic);
@ -576,6 +642,13 @@ void tolua_faction_open(lua_State * L)
tolua_variable(L, TOLUA_CAST "lastturn", tolua_faction_get_lastturn,
tolua_faction_set_lastturn);
tolua_variable(L, TOLUA_CAST "alliance", tolua_faction_get_alliances,
tolua_faction_set_alliance);
tolua_variable(L, TOLUA_CAST "allies", tolua_faction_get_allies, NULL);
tolua_function(L, TOLUA_CAST "set_ally", tolua_faction_set_ally);
tolua_function(L, TOLUA_CAST "get_ally", tolua_faction_get_ally);
tolua_function(L, TOLUA_CAST "get_origin", tolua_faction_get_origin);
tolua_function(L, TOLUA_CAST "set_origin", tolua_faction_set_origin);
tolua_function(L, TOLUA_CAST "normalize", tolua_faction_normalize);

View File

@ -185,6 +185,29 @@ static int ally_flag(const char *s, int help_mask)
return 0;
}
int ally_status(const char *s)
{
if (strcmp(s, "give") == 0) {
return HELP_GIVE;
}
else if (strcmp(s, "fight") == 0) {
return HELP_FIGHT;
}
else if (strcmp(s, "money") == 0) {
return HELP_MONEY;
}
else if (strcmp(s, "travel") == 0) {
return HELP_TRAVEL;
}
else if (strcmp(s, "guard") == 0) {
return HELP_GUARD;
}
else if (strcmp(s, "all") == 0) {
return HELP_ALL;
}
return 0;
}
/** Specifies automatic alliance modes.
* If this returns a value then the bits set are immutable between alliance
* partners (faction::alliance) and cannot be changed with the HELP command.

View File

@ -32,6 +32,7 @@ struct allies;
extern struct attrib_type at_npcfaction;
int ally_status(const char *s);
int ally_get(struct allies *al, const struct faction *f);
void ally_set(struct allies **p_al, struct faction *f, int status);
void write_allies(struct gamedata * data, const struct allies *alist);

View File

@ -426,9 +426,6 @@ void destroyfaction(faction ** fp)
f->next = dead_factions;
dead_factions = f;
fset(f, FFL_QUIT);
f->_alive = false;
if (f->spellbook) {
spellbook_clear(f->spellbook);
free(f->spellbook);
@ -481,6 +478,8 @@ void destroyfaction(faction ** fp)
setalliance(f, NULL);
}
fset(f, FFL_QUIT);
f->_alive = false;
funhash(f);
/* units of other factions that were disguised as this faction

View File

@ -963,8 +963,7 @@ int sp_hero(struct castorder * co)
}
}
m =
msg_message("cast_hero_effect", "mage spell amount", fi->unit, sp, targets);
m = msg_message("cast_hero_effect", "mage spell amount", fi->unit, sp, targets);
message_all(b, m);
msg_release(m);