static int load_update4(void *key, void *data, int depth, void *arg) { XCODE *const xcode_obj = data; if (xcode_obj->type == GTYPE_MECH) { MECH *const mech = (MECH *)xcode_obj; MAP *map; if (!(map = getMap(mech->mapindex))) { /* Ugly kludge */ if ((map = getMap(Location(mech->mynum)))) mech_Rsetmapindex(GOD, mech, tprintf("%d", Location(mech->mynum))); if (!(map = getMap(mech->mapindex))) return 1; } if (!Started(mech)) return 1; StartSeeing(mech); UpdateRecycling(mech); MaybeMove(mech); } return 1; }
void MaybeRecycle(MECH * mech, int wticks) { int nr, dat; if (!(Started(mech) && !Destroyed(mech))) return; nr = NextRecycle(mech); UpdateRecycling(mech); if (nr < 0) MechLWRT(mech) = event_tick; if (nr < 0 || nr > ((wticks + 1) * WEAPON_TICK)) { dat = MAX(1, wticks * WEAPON_TICK); MECHEVENT(mech, EVENT_RECYCLE, mech_recycle_event, dat, 0); #ifdef WEAPON_RECYCLE_DEBUG SendDebug(tprintf("%6d Recycle event for #%d set in %ds.", event_tick, mech->mynum, dat)); #endif } #ifdef WEAPON_RECYCLE_DEBUG else SendDebug(tprintf("%6d Recycle event for #%d exists at %d secs", event_tick, mech->mynum, nr)); #endif }