コード例 #1
0
ファイル: mech.events.c プロジェクト: fstltna/Battletech-MUX
void mech_move_event(EVENT * e)
{
    MECH *mech = (MECH *) e->data;

    if (MechType(mech) == CLASS_VTOL)
	if (Landed(mech) || FuelCheck(mech))
	    return;
    UpdateHeading(mech);
    if ((IsMechLegLess(mech)) || Jumping(mech) || OODing(mech)) {
	if (MechDesiredFacing(mech) != MechFacing(mech))
	    MECHEVENT(mech, EVENT_MOVE, mech_move_event, MOVE_TICK, 0);
	return;
    }
    UpdateSpeed(mech);
    move_mech(mech);

    if (mech->mapindex < 0)
	return;

    if (MechType(mech) == CLASS_VEH_NAVAL && MechRTerrain(mech) != BRIDGE &&
        MechRTerrain(mech) != ICE && MechRTerrain(mech) != WATER)
	    return;

    if (MechSpeed(mech) || MechDesiredSpeed(mech) ||
        MechDesiredFacing(mech) != MechFacing(mech) ||
        ((MechType(mech) == CLASS_VTOL || MechMove(mech) == MOVE_SUB) &&
         MechVerticalSpeed(mech)))
	MECHEVENT(mech, EVENT_MOVE, mech_move_event, MOVE_TICK, 0);
}
コード例 #2
0
void tech_fix(dbref player, void *data, char *buffer)
{
    MECH *mech = data;
    int n = atoi(buffer);
    int low, high;
    int isds;

    skipws(buffer);
    TECHCOMMANDC;
    if (unit_is_fixable(mech))
	make_damage_table(mech);
    else
	make_scrap_table(mech);
    DOCHECK(!damage_last &&
	MechType(mech) == CLASS_MECH,
	"The 'mech is in pristine condition!");
    DOCHECK(!damage_last, "It's in pristine condition!");
    if (sscanf(buffer, "%d-%d", &low, &high) == 2) {
	DOCHECK(low < 1 || low > damage_last, "Invalid low #!");
	DOCHECK(high < 1 || high > damage_last, "Invalid high #!");
	for (n = low; n <= high; n++)
	    fix_entry(player, mech, n);
	return;
    }
    DOCHECK(n < 1 || n > damage_last, "Invalid #!");
    fix_entry(player, mech, n);
}
コード例 #3
0
ファイル: mech.events.c プロジェクト: fstltna/Battletech-MUX
void mech_fall_event(EVENT * e)
{
    MECH *mech = (MECH *) e->data;
    int fallspeed = (int) e->data2;
    int fallen_elev;

    if (Started(mech) && fallspeed >= 0)
	return;
    if (fallspeed <= 0 && (!Started(mech) || !(FlyingT(mech)) ||
	    ((AeroFuel(mech) <= 0) && !AeroFreeFuel(mech)) ||
	    ((MechType(mech) == CLASS_VTOL) &&
		(SectIsDestroyed(mech, ROTOR)))))
	fallspeed -= FALL_ACCEL;
    else
	fallspeed += FALL_ACCEL;
    MarkForLOSUpdate(mech);
    if (MechsElevation(mech) > abs(fallspeed)) {
	MechZ(mech) -= abs(fallspeed);
	MechFZ(mech) = MechZ(mech) * ZSCALE;
	MECHEVENT(mech, EVENT_FALL, mech_fall_event, FALL_TICK, fallspeed);
	return;
    }
    /* Time to hit da ground */
    fallen_elev = factoral(abs(fallspeed));
    mech_notify(mech, MECHALL, "You hit the ground!");
    MechLOSBroadcast(mech, "hits the ground!");
    MechFalls(mech, fallen_elev, 0);
    MechStatus(mech) &= ~JUMPING;
}
コード例 #4
0
ファイル: mech.events.c プロジェクト: fstltna/Battletech-MUX
void check_stagger_event(EVENT * event)
{
    MECH *mech = (MECH *) event->data;	/* get the mech */

    SendDebug(tprintf("Triggered stagger check for %d.", mech->mynum));

    if ((StaggerLevel(mech) < 1) || Fallen(mech) ||
	(MechType(mech) != CLASS_MECH)) {
	StopStaggerCheck(mech);
	return;
    }

    if (Jumping(mech)) {
	return;
    }

    mech_notify(mech, MECHALL, "You stagger from the damage!");
    if (!MadePilotSkillRoll(mech, calcStaggerBTHMod(mech))) {
	mech_notify(mech, MECHALL,
	    "You loose the battle with gravity and tumble over!!");
	MechLOSBroadcast(mech, "tumbles over, staggered by the damage!");
	MechFalls(mech, 1, 0);
    }

    StopStaggerCheck(mech);
}
コード例 #5
0
ファイル: ds.bay.c プロジェクト: gtaylor/btmux
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);
	}
}
コード例 #6
0
ファイル: mech.tech.c プロジェクト: chazu/btmux
int tech_parsepart_advanced(MECH * mech, char *buffer, int *loc, int *pos,
							int *extra, int allowrear)
{
	char *args[5];
	int l, argc, isrear = 0;

	if(!(argc = mech_parseattributes(buffer, args, 4)))
		return -1;
	if(argc > (2 + (extra != NULL)))
		return -1;
	if(!allowrear) {
		if((!extra && argc != (1 + (pos != NULL))) || (extra &&
													   (argc <
														(1 + (pos != NULL))
														|| argc >
														(2 + (pos != NULL)))))
			return -1;
	} else {
		if(argc == 2) {
			if(toupper(args[1][0]) != 'R')
				return -1;
			isrear = 8;
		}
	}
	if((*loc =
		ArmorSectionFromString(MechType(mech), MechMove(mech), args[0])) < 0)
		return -1;
	if(allowrear)
		*loc += isrear;
	if(pos) {
		l = atoi(args[1]) - 1;
		if(l < 0 || l >= CritsInLoc(mech, *loc))
			return -2;
		*pos = l;
	}
	if(extra) {
		if(argc > 2)
			*extra = args[2][0];
		else
			*extra = 0;
	}
	return 0;
}
コード例 #7
0
ファイル: glue.c プロジェクト: chazu/btmux
static int Can_Use_Command(MECH * mech, int cmdflag)
{
#define TYPE2FLAG(a) \
    ((a)==CLASS_MECH?GFLAG_MECH:(a)==CLASS_VEH_GROUND?GFLAG_GROUNDVEH:\
     (a)==CLASS_AERO?GFLAG_AERO:DropShip(a)?GFLAG_DS:(a)==CLASS_VTOL?GFLAG_VTOL:\
     (a)==CLASS_VEH_NAVAL?GFLAG_NAVAL:\
     (a)==CLASS_BSUIT?GFLAG_BSUIT:\
     (a)==CLASS_MW?GFLAG_MW:0)
	int i;

	if(!cmdflag)
		return 1;
	if(!mech || !(i = TYPE2FLAG(MechType(mech))))
		return 0;
	if(cmdflag > 0) {
		if(cmdflag & i)
			return 1;
	} else if(!((0 - cmdflag) & i))
		return 1;
	return 0;
}
コード例 #8
0
void make_damage_table(MECH * mech)
{
    int i;

    damage_last = 0;
    if (MechType(mech) == CLASS_MECH) {
	if (check_for_damage(mech, CTORSO)) {
	    if (check_for_damage(mech, LTORSO)) {
		CHECK(LARM);
	    }
	    if (check_for_damage(mech, RTORSO)) {
		CHECK(RARM);
	    }
	    CHECK(LLEG);
	    CHECK(RLEG);
	    CHECK(HEAD);
	}
    } else
	for (i = 0; i < NUM_SECTIONS; i++)
	    if (GetSectOInt(mech, i))
		check_for_damage(mech, i);
}
コード例 #9
0
void make_scrap_table(MECH * mech)
{
    int i = 4;

    damage_last = 0;
    if (MechType(mech) == CLASS_MECH) {
	if (check_for_scrappage(mech, RARM))
	    i -= check_for_scrappage(mech, RTORSO);
	if (check_for_scrappage(mech, LARM))
	    i -= check_for_scrappage(mech, LTORSO);
	i -= check_for_scrappage(mech, RLEG);
	i -= check_for_scrappage(mech, LLEG);

	if (!i)
	    check_for_scrappage(mech, CTORSO);

	check_for_scrappage(mech, HEAD);
    } else
	for (i = 0; i < NUM_SECTIONS; i++)
	    if (GetSectOInt(mech, i))
		check_for_scrappage(mech, i);
}
コード例 #10
0
ファイル: mech.tech.c プロジェクト: chazu/btmux
int tech_parsegun(MECH * mech, char *buffer, int *loc, int *pos, int *brand)
{
	char *args[3];
	int l, argc, t, c = 0, pi, pb;

	argc = mech_parseattributes(buffer, args, 3);
	if(argc < 1 || argc > (2 + (brand != NULL)))
		return -1;
	if(argc == (2 + (brand != NULL)) || (brand && argc == 2 && atoi(args[1]))) {
		if((*loc =
			ArmorSectionFromString(MechType(mech), MechMove(mech),
								   args[0])) < 0)
			return -1;
		l = atoi(args[1]);
		if(l <= 0 || l > CritsInLoc(mech, *loc))
			return -4;
		*pos = l - 1;
	} else {
		/* Check if it's a number */
		if(args[0][0] < '0' || args[0][0] > '9')
			return -1;
		l = atoi(args[0]);
		if(l < 0)
			return -1;
		if((t = FindWeaponNumberOnMech(mech, l, loc, pos)) == -1)
			return -1;
	}
	t = GetPartType(mech, *loc, *pos);
	if(brand != NULL && argc > 1 && !atoi(args[argc - 1])) {
		if(!find_matching_long_part(args[argc - 1], &c, &pi, &pb))
			return -2;
		if(pi != t)
			return -3;
		*brand = pb;
	} else if(brand != NULL)
		*brand = GetPartBrand(mech, *loc, *pos);
	return 0;
}
コード例 #11
0
ファイル: ds.bay.c プロジェクト: gtaylor/btmux
void mech_enterbay(dbref player, void *data, char *buffer)
{
	char *args[3];
	int argc;
	dbref ref = -1, bayn = -1;
	MECH *mech = data, *ds;
	MAP *map;

	cch(MECH_USUAL);
	DOCHECK(MechType(mech) == CLASS_VTOL &&
			AeroFuel(mech) <= 0, "You lack fuel to maneuver in!");
	DOCHECK(Jumping(mech), "While in mid-jump? No way.");
	DOCHECK(MechType(mech) == CLASS_MECH && (Fallen(mech) ||
											 Standing(mech)),
			"Crawl inside? I think not. Stand first.");
	DOCHECK(OODing(mech), "While in mid-flight? No way.");
	DOCHECK((argc =
			 mech_parseattributes(buffer, args, 2)) == 2,
			"Hmm, invalid number of arguments?");
	if(argc > 0)
		DOCHECK((ref =
				 FindTargetDBREFFromMapNumber(mech, args[0])) <= 0,
				"Invalid target!");
	if(ref < 0) {
		DOCHECK(!Find_Single_DS_In_MechHex(mech, &ref, &bayn),
				"No DS bay found in your hex!");
		DOCHECK(ref < 0,
				"Multiple enterable things found ; use the id for specifying which you want.");
		DOCHECK(!(ds =
				  getMech(ref)), "You sense wrongness in fabric of space.");
	} else {
		DOCHECK(!(ds =
				  getMech(ref)), "You sense wrongness in fabric of space.");
		DOCHECK(!Find_DS_Bay_In_MechHex(mech, ds, &bayn),
				"You see no bays in your hex.");
	}
	DOCHECK(IsDS(mech)
			&& !(MechSpecials2(mech) & CARRIER_TECH),
			"Your craft can't enter bays.");
	DOCHECK(!DS_Bay_Is_Open(mech, ds, AeroBay(ds, bayn)),
			"The door has been jammed!");
	DOCHECK(IsDS(mech), "Your unit is a bit too large to fit in there.");
	DOCHECK((fabs((float) (MechSpeed(mech) - MechSpeed(ds)))) > MP1,
			"Speed difference's too large to enter!");
	DOCHECK(MechZ(ds) != MechZ(mech),
			"Get to same elevation before thinking about entering!");
	DOCHECK(abs(MechVerticalSpeed(mech) - MechVerticalSpeed(ds)) > 10,
			"Vertical speed difference is too great to enter safely!");
	DOCHECK(MechType(mech) == CLASS_MECH && !MechIsQuad(mech) &&
			(IsMechLegLess(mech)), "Without legs? Are you kidding?");
	ref = AeroBay(ds, bayn);
	map = getMap(ref);

	DOCHECK(!map, "You sense wrongness in fabric of space.");

	DOCHECK(EnteringHangar(mech), "You are already entering the hangar!");
	if(!can_pass_lock(mech->mynum, ref, A_LENTER)) {
		char *msg = silly_atr_get(ref, A_FAIL);
		if(!msg || !*msg)
			msg = "You are unable to enter the bay!";
		notify(player, msg);
		return;
	}
	DOCHECK(!DS_Bay_Is_EnterOK(mech, ds, AeroBay(ds, bayn)),
			"Someone else is using the door at the moment.");
	DOCHECK(!(map =
			  getMap(mech->mapindex)),
			"You sense a wrongness in fabric of space.");
	HexLOSBroadcast(map, MechX(mech), MechY(mech),
					"The bay doors at $h start to open..");
	MECHEVENT(mech, EVENT_ENTER_HANGAR, mech_enterbay_event, 12, ref);
}
コード例 #12
0
static int check_for_damage(MECH * mech, int loc)
{
    int a, b, c, d;

    if (SectIsDestroyed(mech, loc)) {
	if (MechType(mech) != CLASS_BSUIT)
	    DAMAGE2(REATTACH, loc);
	else
	    DAMAGE2(REPLACESUIT, loc);
	return 0;
    }

    /*
       * Added by Kipsta
       * 8/4/99
     */

    if (SectIsFlooded(mech, loc)) {
	DAMAGE2(RESEAL, loc);
	return 0;
    }
    if ((a = GetSectInt(mech, loc)) != (b = GetSectOInt(mech, loc)))
	DAMAGE3(FIXINTERNAL, loc, (b - a));
    else {
	if ((a = GetSectArmor(mech, loc)) != (b =
		GetSectOArmor(mech, loc)))
	    DAMAGE3(FIXARMOR, loc, (b - a));
	if ((a = GetSectRArmor(mech, loc)) != (b =
		GetSectORArmor(mech, loc)))
	    DAMAGE3(FIXARMOR_R, loc, (b - a));
    }
    for (a = 0; a < NUM_CRITICALS; a++) {
	if (!(b = GetPartType(mech, loc, a)))
	    continue;
	if (IsAmmo(b) && !PartIsDestroyed(mech, loc, a) &&
	    (c = GetPartData(mech, loc, a)) != (d =
		FullAmmo(mech, loc, a)))
	    DAMAGE3(RELOAD, loc, a);
	if (!PartIsNonfunctional(mech, loc, a) &&
	    !PartTempNuke(mech, loc, a) && !PartIsDamaged(mech, loc, a))
	    continue;
	if (IsCrap(b))
	    continue;
	/* Destroyed / tempnuke'd part. Either case, it works for us :) */

	if (PartIsDamaged(mech, loc, a)) {
	    if (GetPartDamageFlags(mech, loc, a) & WEAP_DAM_EN_FOCUS)
		DAMAGE3(ENHCRIT_FOCUS, loc, a);
	    else if (GetPartDamageFlags(mech, loc,
		    a) & WEAP_DAM_EN_CRYSTAL)
		DAMAGE3(ENHCRIT_CRYSTAL, loc, a);
	    else if (GetPartDamageFlags(mech, loc,
		    a) & WEAP_DAM_BALL_BARREL)
		DAMAGE3(ENHCRIT_BARREL, loc, a);
	    else if (GetPartDamageFlags(mech, loc, a) & WEAP_DAM_BALL_AMMO)
		DAMAGE3(ENHCRIT_AMMOB, loc, a);
	    else if (GetPartDamageFlags(mech, loc,
		    a) & WEAP_DAM_MSL_RANGING)
		DAMAGE3(ENHCRIT_RANGING, loc, a);
	    else if (GetPartDamageFlags(mech, loc, a) & WEAP_DAM_MSL_AMMO)
		DAMAGE3(ENHCRIT_AMMOM, loc, a);
	    else
		DAMAGE3(ENHCRIT_MISC, loc, a);

	} else if (IsWeapon(b) && GetWeaponCrits(mech, Weapon2I(b)) > 4 &&
	    !PartIsDestroyed(mech, loc, a + 1))
	    DAMAGE3(REPAIRP_T, loc, a);
	else
	    DAMAGE3(IsWeapon(b) ? REPAIRG : REPAIRP, loc, a);

	if (IsWeapon(b))
	    a += GetWeaponCrits(mech, Weapon2I(b)) - 1;
    }
    return 1;
}
コード例 #13
0
static void fix_entry(dbref player, MECH * mech, int n)
{
    char buf[MBUF_SIZE];
    char *c;

    /* whee */
    n--;
    c = ShortArmorSectionString(MechType(mech), MechMove(mech),
	damage_table[n][1]);
    switch (damage_table[n][0]) {
    case REPAIRP_T:
	sprintf(buf, "%s %d", c, damage_table[n][2] + 1);
	tech_repairgun(player, mech, buf);
	break;
    case ENHCRIT_MISC:
    case ENHCRIT_FOCUS:
    case ENHCRIT_CRYSTAL:
    case ENHCRIT_BARREL:
    case ENHCRIT_AMMOB:
    case ENHCRIT_RANGING:
    case ENHCRIT_AMMOM:
	sprintf(buf, "%s %d", c, damage_table[n][2] + 1);
	tech_fixenhcrit(player, mech, buf);
	break;
    case REPAIRG:
	sprintf(buf, "%s %d", c, damage_table[n][2] + 1);
	tech_replacegun(player, mech, buf);
	break;
    case REPAIRP:
	sprintf(buf, "%s %d", c, damage_table[n][2] + 1);
	tech_replacepart(player, mech, buf);
	break;
    case RELOAD:
	sprintf(buf, "%s %d", c, damage_table[n][2] + 1);
	tech_reload(player, mech, buf);
	break;
    case REATTACH:
	sprintf(buf, "%s", c);
	tech_reattach(player, mech, buf);
	break;
    case RESEAL:
	sprintf(buf, "%s", c);
	tech_reseal(player, mech, buf);
	break;
    case FIXARMOR:
	sprintf(buf, "%s", c);
	tech_fixarmor(player, mech, buf);
	break;
    case FIXARMOR_R:
	sprintf(buf, "%s r", c);
	tech_fixarmor(player, mech, buf);
	break;
    case FIXINTERNAL:
	sprintf(buf, "%s", c);
	tech_fixinternal(player, mech, buf);
	break;
    case DETACH:
	sprintf(buf, "%s", c);
	tech_removesection(player, mech, buf);
	break;
    case SCRAPP:
	sprintf(buf, "%s %d", c, damage_table[n][2] + 1);
	tech_removepart(player, mech, buf);
	break;
    case SCRAPG:
	sprintf(buf, "%s %d", c, damage_table[n][2] + 1);
	tech_removegun(player, mech, buf);
	break;
    case UNLOAD:
	sprintf(buf, "%s %d", c, damage_table[n][2] + 1);
	tech_unload(player, mech, buf);
	break;
    case REPLACESUIT:
	sprintf(buf, "%s", c);
	tech_replacesuit(player, mech, buf);
	break;
    }
}
コード例 #14
0
void show_mechs_damage(dbref player, void *data, char *buffer)
{
    MECH *mech = data;
    coolmenu *c = NULL;
    int i, j, v1, v2;
    char buf[MBUF_SIZE];
    char buf2[MBUF_SIZE];
    int isds;

    TECHCOMMANDD;
    if (unit_is_fixable(mech))
	make_damage_table(mech);
    else
	make_scrap_table(mech);
    DOCHECK(!damage_last &&
	MechType(mech) == CLASS_MECH,
	"The 'mech is in pristine condition!");
    DOCHECK(!damage_last, "It's in pristine condition!");
    addline();
    cent(tprintf("Damage for %s", GetMechID(mech)));
    addline();
    for (i = 0; i < damage_last; i++) {
	v1 = damage_table[i][1];
	v2 = damage_table[i][2];
	switch (damage_table[i][0]) {
	case REATTACH:
	case DETACH:
	case RESEAL:
	case REPLACESUIT:
	    strcpy(buf, repair_need_msgs[(int) damage_table[i][0]]);
	    break;
	case REPAIRP:
	case REPAIRP_T:
	case REPAIRG:
	case ENHCRIT_MISC:
	case ENHCRIT_FOCUS:
	case ENHCRIT_CRYSTAL:
	case ENHCRIT_BARREL:
	case ENHCRIT_AMMOB:
	case ENHCRIT_RANGING:
	case ENHCRIT_AMMOM:
	case SCRAPP:
	case SCRAPG:
	    sprintf(buf, repair_need_msgs[(int) damage_table[i][0]],
		pos_part_name(mech, v1, v2));
	    break;
	case RELOAD:
	    sprintf(buf, repair_need_msgs[(int) damage_table[i][0]],
		pos_part_name(mech, v1, v2), FullAmmo(mech, v1,
		    v2) - GetPartData(mech, v1, v2));
	    break;
	case UNLOAD:
	    sprintf(buf, repair_need_msgs[(int) damage_table[i][0]],
		pos_part_name(mech, v1, v2), GetPartData(mech, v1, v2));
	    break;
	case FIXARMOR:
	case FIXARMOR_R:
	case FIXINTERNAL:
	    sprintf(buf, repair_need_msgs[(int) damage_table[i][0]],
		damage_table[i][2]);
	    break;
	}
	j = is_under_repair(mech, i);
	sprintf(buf2, "%%ch%s%-2d:%s %%cn%s%s", j ? "%cg" : "%cy", i + 1,
	    ShortArmorSectionString(MechType(mech), MechMove(mech), v1),
	    buf, j ? " (*)" : "");
	vsi(buf2);
    }
    addline();
    vsi("(*) / %ch%cgGreen%cn = Job already done. %ch%cyYellow%cn = To be done.");
    addline();
    ShowCoolMenu(player, c);
    KillCoolMenu(c);
}
コード例 #15
0
char *damages_func(MECH * mech)
{
    static char buffer[MBUF_SIZE];
    int i;

    if (unit_is_fixable(mech))
	make_damage_table(mech);
    else
	make_scrap_table(mech);

    buffer[0] = '\0';
    if (!damage_last)
	return "";
    for (i = 0; i < damage_last; i++) {
	/* Ok... i think we want: */
	/* repairnum|location|typenum|data|fixing? */
	if (i)
	    sprintf(buffer, "%s,", buffer);
	sprintf(buffer, "%s%d|%s|%d|", buffer, i + 1,
	    ShortArmorSectionString(MechType(mech), MechMove(mech),
		damage_table[i][1]), (int) damage_table[i][0]);
	switch (damage_table[i][0]) {
	case REPAIRP:
	case REPAIRP_T:
	case REPAIRG:
	case ENHCRIT_MISC:
	case ENHCRIT_FOCUS:
	case ENHCRIT_CRYSTAL:
	case ENHCRIT_BARREL:
	case ENHCRIT_AMMOB:
	case ENHCRIT_RANGING:
	case ENHCRIT_AMMOM:
	case SCRAPP:
	case SCRAPG:
	    sprintf(buffer, "%s%s", buffer, pos_part_name(mech,
		    damage_table[i][1], damage_table[i][2]));
	    break;
	case RELOAD:
	    sprintf(buffer, "%s%s:%d", buffer, pos_part_name(mech,
		    damage_table[i][1], damage_table[i][2]), FullAmmo(mech,
		    damage_table[i][1],
		    damage_table[i][2]) - GetPartData(mech,
		    damage_table[i][1], damage_table[i][2]));
	    break;
	case UNLOAD:
	    sprintf(buffer, "%s%s:%d", buffer, pos_part_name(mech,
		    damage_table[i][1], damage_table[i][2]),
		GetPartData(mech, damage_table[i][1], damage_table[i]
		    [2]));
	    break;
	case FIXARMOR:
	case FIXARMOR_R:
	case FIXINTERNAL:
	    sprintf(buffer, "%s%d", buffer, damage_table[i][2]);
	    break;
	default:
	    sprintf(buffer, "%s-", buffer);
	}
	sprintf(buffer, "%s|%d", buffer, is_under_repair(mech, i));
    }
    return buffer;
}