static int Leave_DS_Bay(MAP * map, MECH * ds, MECH * mech, dbref frombay) { MECH *car = NULL; StopBSuitSwarmers(FindObjectsData(mech->mapindex), mech, 1); MechLOSBroadcast(mech, "has left the bay."); /* We escape confines of the bay to open air/land! */ mech_Rsetmapindex(GOD, (void *) mech, tprintf("%d", ds->mapindex)); if(MechCarrying(mech) > 0) car = getMech(MechCarrying(mech)); if(car) mech_Rsetmapindex(GOD, (void *) car, tprintf("%d", ds->mapindex)); DOCHECKMA0(mech->mapindex == map->mynum, "Fatal error: Unable to find the map 'ship is on."); loud_teleport(mech->mynum, mech->mapindex); if(car) loud_teleport(car->mynum, mech->mapindex); mech_notify(mech, MECHALL, "You have left the bay."); DS_Place(ds, mech, frombay); if(car) MirrorPosition(mech, car, 0); MechLOSBroadcasti(mech, ds, "has left %s's bay."); mech_notify(ds, MECHALL, tprintf("%s has left the bay.", GetMechID(mech))); ContinueFlying(mech); if(In_Character(mech->mynum) && Location(MechPilot(mech)) != mech->mynum) { mech_notify(mech, MECHALL, "%ch%cr%cf%ciINTRUDER ALERT! INTRUDER ALERT!%c"); mech_notify(mech, MECHALL, "%ch%cr%cfAutomatic self-destruct sequence initiated.%c"); mech_shutdown(GOD, (void *) mech, ""); } return 1; }
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; }
static void mech_enterbay_event(MUXEVENT * e) { MECH *mech = (MECH *) e->data, *ds, *tmpm = NULL; long ref = (long) e->data2; long bayn; int x = 5, y = 5; MAP *tmpmap; if(!Started(mech) || Uncon(mech) || Jumping(mech) || (MechType(mech) == CLASS_MECH && (Fallen(mech) || Standing(mech))) || OODing(mech) || (fabs(MechSpeed(mech)) * 5 >= MMaxSpeed(mech) && fabs(MMaxSpeed(mech)) >= MP1) || (MechType(mech) == CLASS_VTOL && AeroFuel(mech) <= 0)) return; tmpmap = getMap(ref); if(!(ds = getMech(tmpmap->onmap))) return; if(!Find_DS_Bay_In_MechHex(mech, ds, &bayn)) return; /* whee */ ref = AeroBay(ds, bayn); StopBSuitSwarmers(FindObjectsData(mech->mapindex), mech, 1); mech_notify(mech, MECHALL, "You enter the bay."); MechLOSBroadcast(mech, tprintf("has entered %s at %d,%d.", GetMechID(ds), MechX(mech), MechY(mech))); MarkForLOSUpdate(mech); if(MechType(mech) == CLASS_MW && !In_Character(ref)) { enter_mw_bay(mech, ref); return; } if(MechCarrying(mech) > 0) tmpm = getMech(MechCarrying(mech)); mech_Rsetmapindex(GOD, (void *) mech, tprintf("%d", ref)); mech_Rsetxy(GOD, (void *) mech, tprintf("%d %d", x, y)); MechLOSBroadcast(mech, "has entered the bay."); loud_teleport(mech->mynum, ref); if(tmpm) { mech_Rsetmapindex(GOD, (void *) tmpm, tprintf("%d", ref)); mech_Rsetxy(GOD, (void *) tmpm, tprintf("%d %d", x, y)); loud_teleport(tmpm->mynum, ref); } }