forked from github/server
- fixing toads that lose their changerace attribute
This commit is contained in:
parent
536b177387
commit
1e8af4e0e5
4 changed files with 41 additions and 8 deletions
|
@ -2256,7 +2256,7 @@ sell(unit * u, request ** sellorders, struct order * ord)
|
|||
|
||||
init_tokens(ord);
|
||||
skip_token();
|
||||
s = getstrtoken();
|
||||
s = getstrtoken();
|
||||
|
||||
if (findparam(s, u->faction->locale) == P_ANY) {
|
||||
unlimited = false;
|
||||
|
@ -2334,7 +2334,6 @@ sell(unit * u, request ** sellorders, struct order * ord)
|
|||
if (o->type.ltype==ltype && o->unit->faction == u->faction) {
|
||||
int fpool = o->qty - get_pooled(o->unit, itype->rtype, GET_RESERVE, INT_MAX);
|
||||
available -= max(0, fpool);
|
||||
assert(available>=0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -107,8 +107,6 @@ give_item(int want, const item_type * itype, unit * src, unit * dest, struct ord
|
|||
} else if (itype->give==NULL || itype->give(src, dest, itype, n, ord)!=0) {
|
||||
int use = use_pooled(src, item2resource(itype), GET_SLACK, n);
|
||||
if (use<n) use += use_pooled(src, item2resource(itype), GET_RESERVE|GET_POOLED_SLACK, n-use);
|
||||
assert(n>=use);
|
||||
n = use;
|
||||
if (dest) {
|
||||
i_change(&dest->items, itype, n);
|
||||
#ifdef RESERVE_GIVE
|
||||
|
|
|
@ -521,13 +521,13 @@ has_spell(const unit *u, const spell * sp)
|
|||
int
|
||||
get_combatspelllevel(const unit *u, int nr)
|
||||
{
|
||||
sc_mage *m = get_mage(u);
|
||||
sc_mage *m = get_mage(u);
|
||||
|
||||
assert(nr < MAXCOMBATSPELLS);
|
||||
if (m) {
|
||||
assert(nr < MAXCOMBATSPELLS);
|
||||
if (m) {
|
||||
int level = eff_skill(u, SK_MAGIC, u->region);
|
||||
return min(m->combatspells[nr].level, level);
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -956,6 +956,41 @@ fix_chaosgates(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
fix_toads(void)
|
||||
{
|
||||
region * r;
|
||||
const struct race * toad = rc_find("toad");
|
||||
|
||||
for (r=regions;r!=NULL;r=r->next) {
|
||||
unit * u;
|
||||
for (u=r->units; u; u=u->next) {
|
||||
if (u->race==toad) {
|
||||
int found = 0;
|
||||
handler_info * td = NULL;
|
||||
attrib * a = a_find(u->attribs, &at_eventhandler);
|
||||
while (!found && a!=NULL && a->type==&at_eventhandler) {
|
||||
td = (handler_info *)a->data.v;
|
||||
if (strcmp(td->event, "timer")==0) {
|
||||
trigger * tr = td->triggers;
|
||||
while (tr && !found) {
|
||||
if (tr->type==&tt_changerace) {
|
||||
found = 1;
|
||||
}
|
||||
tr = tr->next;
|
||||
}
|
||||
}
|
||||
a = a->next;
|
||||
}
|
||||
if (!found) {
|
||||
log_error(("fixed toad %s.\n", unitname(u)));
|
||||
u->race=u->faction->race;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
fix_groups(void)
|
||||
{
|
||||
|
@ -1015,6 +1050,7 @@ korrektur(void)
|
|||
fix_astralplane();
|
||||
fix_firewalls();
|
||||
fix_gates();
|
||||
fix_toads();
|
||||
verify_owners(false);
|
||||
/* fix_herbtypes(); */
|
||||
/* In Vin 3+ können Parteien komplett übergeben werden. */
|
||||
|
|
Loading…
Reference in a new issue