src/hcode/btech/mech.tech.repairs.c

Go to the documentation of this file.
00001 
00002 /*
00003  * $Id: mech.tech.repairs.c,v 1.1.1.1 2005/01/11 21:18:26 kstevens Exp $
00004  *
00005  * Author: Markus Stenberg <fingon@iki.fi>
00006  *
00007  *  Copyright (c) 1997 Markus Stenberg
00008  *  Copyright (c) 1998-2002 Thomas Wouters
00009  *  Copyright (c) 2000-2002 Cord Awtry
00010  *       All rights reserved
00011  *
00012  * Created: Sat Aug 23 19:12:32 1997 fingon
00013  * Last modified: Sat Jun  6 20:45:48 1998 fingon
00014  *
00015  */
00016 
00017 #include "mech.h"
00018 #include "mech.events.h"
00019 #include "mech.tech.h"
00020 #include "mech.tech.damages.h"
00021 #include "coolmenu.h"
00022 #include "mycool.h"
00023 #include "failures.h"
00024 #include "p.mech.tech.h"
00025 #include "p.mech.build.h"
00026 #include "p.mech.status.h"
00027 
00028 static coolmenu *c;
00029 
00030 static void describe_repairs(MUXEVENT * e)
00031 {
00032         int type = e->type;
00033         MECH *mech = (MECH *) e->data;
00034         int earg = ((int) e->data2) % PLAYERPOS;
00035         dbref player = ((int) e->data2) / PLAYERPOS;
00036         int loc, pos, extra;
00037         char buf[MBUF_SIZE];
00038         char buf2[LBUF_SIZE];
00039         int fail = (e->function == very_fake_func);
00040 
00041         UNPACK_LOCPOS_E(earg, loc, pos, extra);
00042         sprintf(buf, "%s%s", ShortArmorSectionString(MechType(mech),
00043                                                                                                  MechMove(mech), loc % 8),
00044                         loc >= 8 ? "(R)" : "");
00045         sprintf(buf2, "%-5d ", player);
00046         sprintf(buf2 + strlen(buf2), "%-4d ",
00047                         game_lag_time((e->tick - muxevent_tick) / 60));
00048         switch (type) {
00049         case EVENT_REPAIR_REPL:
00050                 sprintf(buf2 + strlen(buf2), "%5s:%-2d Replacement of %s", buf,
00051                                 pos + 1, pos_part_name(mech, loc, pos));
00052                 if(fail)
00053                         sprintf(buf2 + strlen(buf2), " (Failure)");
00054                 break;
00055         case EVENT_REPAIR_REPLG:
00056                 sprintf(buf2 + strlen(buf2), "%5s:%-2d Replacement of %s", buf,
00057                                 pos + 1, pos_part_name(mech, loc, pos));
00058                 if(fail)
00059                         sprintf(buf2 + strlen(buf2), " (Failure)");
00060                 break;
00061         case EVENT_REPAIR_REAT:
00062                 sprintf(buf2 + strlen(buf2), "%5s Reattachment", buf);
00063                 if(fail)
00064                         sprintf(buf2 + strlen(buf2), " (Failure)");
00065                 break;
00066         case EVENT_REPAIR_RELO:
00067                 sprintf(buf2 + strlen(buf2), "%5s:%-2d %sload of %s", buf, pos + 1,
00068                                 extra ? "Un" : "Re", pos_part_name(mech, loc, pos));
00069                 if(fail)
00070                         sprintf(buf2 + strlen(buf2), " (Failure)");
00071                 break;
00072         case EVENT_REPAIR_FIX:
00073                 if(fail)
00074                         sprintf(buf2 + strlen(buf2), "%5s:%-2d Failed armor repair",
00075                                         buf, 0);
00076                 else
00077                         sprintf(buf2 + strlen(buf2),
00078                                         "%5s:%-2d Repair of armor - possibly next point", buf,
00079                                         pos);
00080                 break;
00081         case EVENT_REPAIR_FIXI:
00082                 if(fail)
00083                         sprintf(buf2 + strlen(buf2), "%5s:%-2d Failed internal repair",
00084                                         buf, 0);
00085                 else
00086                         sprintf(buf2 + strlen(buf2),
00087                                         "%5s:%-2d Repair of internals - possibly next point", buf,
00088                                         pos);
00089                 break;
00090         case EVENT_REPAIR_SCRL:
00091                 sprintf(buf2 + strlen(buf2), "%5s Removal", buf);
00092                 break;
00093         case EVENT_REPAIR_SCRP:
00094                 sprintf(buf2 + strlen(buf2), "%5s:%-2d Scrapping of %s", buf,
00095                                 pos + 1, pos_part_name(mech, loc, pos));
00096                 break;
00097         case EVENT_REPAIR_SCRG:
00098                 sprintf(buf2 + strlen(buf2), "%5s:%-2d Scrapping of %s", buf,
00099                                 pos + 1, pos_part_name(mech, loc, pos));
00100                 break;
00101         case EVENT_REPAIR_REPAG:
00102                 sprintf(buf2 + strlen(buf2), "%5s:%-2d Repair of %s", buf, pos + 1,
00103                                 pos_part_name(mech, loc, pos));
00104                 if(fail)
00105                         sprintf(buf2 + strlen(buf2), " (Failure)");
00106                 break;
00107         case EVENT_REPAIR_REPAP:
00108                 sprintf(buf2 + strlen(buf2), "%5s:%-2d Repair of %s", buf, pos + 1,
00109                                 pos_part_name(mech, loc, pos));
00110                 if(fail)
00111                         sprintf(buf2 + strlen(buf2), " (Failure)");
00112                 break;
00113         case EVENT_REPAIR_REPENHCRIT:
00114                 sprintf(buf2 + strlen(buf2), "%5s:%-2d Repair of %s", buf, pos + 1,
00115                                 pos_part_name(mech, loc, pos));
00116                 if(fail)
00117                         sprintf(buf2 + strlen(buf2), " (Failure)");
00118                 break;
00119         case EVENT_REPAIR_MOB:
00120                 sprintf(buf2 + strlen(buf2), "%5s:%-2d Mounting of %s", buf,
00121                                 pos + 1, pos_part_name(mech, loc, pos));
00122                 if(fail)
00123                         sprintf(buf2 + strlen(buf2), " (Failure)");
00124                 break;
00125         case EVENT_REPAIR_UMOB:
00126                 sprintf(buf2 + strlen(buf2), "%5s:%-2d Removing of %s", buf,
00127                                 pos + 1, pos_part_name(mech, loc, pos));
00128                 if(fail)
00129                         sprintf(buf2 + strlen(buf2), " (Failure)");
00130                 break;
00131         case EVENT_REPAIR_REPSUIT:
00132                 sprintf(buf2 + strlen(buf2), "%5s Replacing suit", buf);
00133                 if(fail)
00134                         sprintf(buf2 + strlen(buf2), " (Failure)");
00135                 break;
00136         }
00137 
00138 /*   sprintf(buf2+strlen(buf2), " - %s", */
00139 
00140 /*        get_uptime_to_string(e->tick - muxevent_tick)); */
00141         vsi(buf2);
00142 }
00143 
00144 void tech_repairs(dbref player, MECH * mech, char *buffer)
00145 {
00146         int i, isds = IsDS(mech);
00147 
00148         TECHCOMMANDD;
00149 
00150         DOCHECK(!figure_latest_tech_event(mech),
00151                         "This 'mech has no repairs pending!");
00152         c = NULL;
00153         addline();
00154         cent(tprintf("Repairs/Scrapping in progress (%s)", GetMechID(mech)));
00155         vsi(tprintf("%-5s %-4s %s", "Plr", "Time", "Location + Description"));
00156         addline();
00157         for(i = FIRST_TECH_EVENT; i <= LAST_TECH_EVENT; i++)
00158                 muxevent_gothru_type_data(i, (void *) mech, describe_repairs);
00159         addline();
00160         vsi("Note: Time = Time remaining in minutes. Plr = Tech's dbref");
00161         addline();
00162         ShowCoolMenu(player, c);
00163         KillCoolMenu(c);
00164 }

Generated on Mon May 28 04:25:23 2007 for BattletechMUX by  doxygen 1.4.7