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
|
@ -2334,7 +2334,6 @@ sell(unit * u, request ** sellorders, struct order * ord)
|
||||||
if (o->type.ltype==ltype && o->unit->faction == u->faction) {
|
if (o->type.ltype==ltype && o->unit->faction == u->faction) {
|
||||||
int fpool = o->qty - get_pooled(o->unit, itype->rtype, GET_RESERVE, INT_MAX);
|
int fpool = o->qty - get_pooled(o->unit, itype->rtype, GET_RESERVE, INT_MAX);
|
||||||
available -= max(0, fpool);
|
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) {
|
} else if (itype->give==NULL || itype->give(src, dest, itype, n, ord)!=0) {
|
||||||
int use = use_pooled(src, item2resource(itype), GET_SLACK, n);
|
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);
|
if (use<n) use += use_pooled(src, item2resource(itype), GET_RESERVE|GET_POOLED_SLACK, n-use);
|
||||||
assert(n>=use);
|
|
||||||
n = use;
|
|
||||||
if (dest) {
|
if (dest) {
|
||||||
i_change(&dest->items, itype, n);
|
i_change(&dest->items, itype, n);
|
||||||
#ifdef RESERVE_GIVE
|
#ifdef RESERVE_GIVE
|
||||||
|
|
|
@ -956,6 +956,41 @@ fix_chaosgates(void)
|
||||||
return 0;
|
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
|
static void
|
||||||
fix_groups(void)
|
fix_groups(void)
|
||||||
{
|
{
|
||||||
|
@ -1015,6 +1050,7 @@ korrektur(void)
|
||||||
fix_astralplane();
|
fix_astralplane();
|
||||||
fix_firewalls();
|
fix_firewalls();
|
||||||
fix_gates();
|
fix_gates();
|
||||||
|
fix_toads();
|
||||||
verify_owners(false);
|
verify_owners(false);
|
||||||
/* fix_herbtypes(); */
|
/* fix_herbtypes(); */
|
||||||
/* In Vin 3+ können Parteien komplett übergeben werden. */
|
/* In Vin 3+ können Parteien komplett übergeben werden. */
|
||||||
|
|
Loading…
Reference in a new issue