src/hcode/btech/mech.tech.do.c File Reference

#include "config.h"
#include "mech.h"
#include "muxevent.h"
#include "mech.events.h"
#include "mech.tech.h"
#include "p.econ.h"
#include "p.mech.tech.h"
#include "p.mech.status.h"
#include "p.mech.utils.h"

Include dependency graph for mech.tech.do.c:

Go to the source code of this file.

Defines

#define PARTCHECK_SUB(m, a, b, c)
#define PARTCHECK(m, a, b, c)   { PARTCHECK_SUB(m, alias_part(m, a), b, c); }
#define PARTCHECKTWO(m, a, b, c, d, e, f)
#define PARTCHECKTHREE(m, a, b, c, d, e, f, g, h, i)
#define PARTCHECKFOUR(m, a, b, c, d, e, f, g, h, i, j, k, l)
#define BSUIT_REPAIR_INTERNAL_NEEDED   10
#define BSUIT_REPAIR_SENSORS_NEEDED   2
#define BSUIT_REPAIR_LIFESUPPORT_NEEDED   2
#define BSUIT_REPAIR_ELECTRONICS_NEEDED   10

Functions

int valid_ammo_mode (MECH *mech, int loc, int part, int let)
int FindAmmoType (MECH *mech, int loc, int part)
 TFUNC_LOCPOS (replace_econ)
 TFUNC_LOCPOS_VAL (reload_econ)
 TFUNC_LOC_VAL (fixarmor_econ)
 TFUNC_LOC_VAL (fixinternal_econ)
 TFUNC_LOCPOS (repair_econ)
 TFUNC_LOCPOS (repairenhcrit_econ)
 TFUNC_LOC (reattach_econ)
 TFUNC_LOC (replacesuit_econ)
 TFUNC_LOC (reseal_econ)
 NFUNC (TFUNC_LOCPOS(replacep_succ))
 NFUNC (TFUNC_LOCPOS(replaceg_succ))
 NFUNC (TFUNC_LOCPOS_VAL(reload_succ))
 NFUNC (TFUNC_LOC_VAL(fixinternal_succ))
 NFUNC (TFUNC_LOC_VAL(fixarmor_succ))
 NFUNC (TFUNC_LOC(reattach_succ))
 NFUNC (TFUNC_LOC_RESEAL(reseal_succ))
 NFUNC (TFUNC_LOC(replacesuit_succ))
 NFUNC (TFUNC_LOCPOS(repairg_succ))
 NFUNC (TFUNC_LOCPOS(repairenhcrit_succ))
 NFUNC (TFUNC_LOCPOS(repairp_succ))
 TFUNC_LOCPOS (replaceg_fail)
 TFUNC_LOCPOS (repairg_fail)
 TFUNC_LOCPOS (repairenhcrit_fail)
 TFUNC_LOCPOS (replacep_fail)
 TFUNC_LOCPOS (repairp_fail)
 TFUNC_LOCPOS_VAL (reload_fail)
 TFUNC_LOC_VAL (fixarmor_fail)
 TFUNC_LOC_VAL (fixinternal_fail)
 TFUNC_LOC (reattach_fail)
 TFUNC_LOC (replacesuit_fail)
 TFUNC_LOC_RESEAL (reseal_fail)

Variables

struct {
   char   name
   char *   lname
   int   aflag
   int   rtype
   int   ntype
   int   rspec
   int   nspec
ammo_types []


Define Documentation

#define BSUIT_REPAIR_ELECTRONICS_NEEDED   10

Definition at line 356 of file mech.tech.do.c.

Referenced by TFUNC_LOC().

#define BSUIT_REPAIR_INTERNAL_NEEDED   10

Definition at line 353 of file mech.tech.do.c.

Referenced by TFUNC_LOC().

#define BSUIT_REPAIR_LIFESUPPORT_NEEDED   2

Definition at line 355 of file mech.tech.do.c.

Referenced by TFUNC_LOC().

#define BSUIT_REPAIR_SENSORS_NEEDED   2

Definition at line 354 of file mech.tech.do.c.

Referenced by TFUNC_LOC().

#define PARTCHECK ( m,
a,
b,
c   )     { PARTCHECK_SUB(m, alias_part(m, a), b, c); }

Definition at line 28 of file mech.tech.do.c.

Referenced by TFUNC_LOC(), TFUNC_LOC_VAL(), TFUNC_LOCPOS(), and TFUNC_LOCPOS_VAL().

#define PARTCHECK_SUB ( m,
a,
b,
c   ) 

Value:

AVCHECKM(m,a,b,c); \
GrabPartsM(m,a,b,c);

Definition at line 23 of file mech.tech.do.c.

#define PARTCHECKFOUR ( m,
a,
b,
c,
d,
e,
f,
g,
h,
i,
j,
k,
 ) 

Value:

AVCHECKM(m,a,b,c); \
AVCHECKM(m,d,e,f); \
AVCHECKM(m,g,h,i); \
AVCHECKM(m,j,k,l); \
GrabPartsM(m,a,b,c); \
GrabPartsM(m,d,e,f); \
GrabPartsM(m,g,h,i); \
GrabPartsM(m,j,k,l);

Definition at line 49 of file mech.tech.do.c.

Referenced by TFUNC_LOC().

#define PARTCHECKTHREE ( m,
a,
b,
c,
d,
e,
f,
g,
h,
 ) 

Value:

AVCHECKM(m,a,b,c); \
AVCHECKM(m,d,e,f); \
AVCHECKM(m,g,h,i); \
GrabPartsM(m,a,b,c); \
GrabPartsM(m,d,e,f); \
GrabPartsM(m,g,h,i);

Definition at line 41 of file mech.tech.do.c.

#define PARTCHECKTWO ( m,
a,
b,
c,
d,
e,
 ) 

Value:

AVCHECKM(m,a,b,c); \
AVCHECKM(m,d,e,f); \
GrabPartsM(m,a,b,c); \
GrabPartsM(m,d,e,f);

Definition at line 35 of file mech.tech.do.c.

Referenced by TFUNC_LOC(), and TFUNC_LOCPOS().


Function Documentation

int FindAmmoType ( MECH mech,
int  loc,
int  part 
)

Definition at line 130 of file mech.tech.do.c.

References AC10_AP_AMMO, AC10_CASELESS_AMMO, AC10_FLECHETTE_AMMO, AC10_INCENDIARY_AMMO, AC10_PRECISION_AMMO, AC20_AP_AMMO, AC20_CASELESS_AMMO, AC20_FLECHETTE_AMMO, AC20_INCENDIARY_AMMO, AC20_PRECISION_AMMO, AC2_AP_AMMO, AC2_CASELESS_AMMO, AC2_FLECHETTE_AMMO, AC2_INCENDIARY_AMMO, AC2_PRECISION_AMMO, AC5_AP_AMMO, AC5_CASELESS_AMMO, AC5_FLECHETTE_AMMO, AC5_INCENDIARY_AMMO, AC5_PRECISION_AMMO, AC_AP_MODE, AC_CASELESS_MODE, AC_FLECHETTE_MODE, AC_INCENDIARY_MODE, AC_MODES, AC_PRECISION_MODE, Ammo2I, AMMO_LRM_SGUIDED, AMMO_LRM_STINGER, AMMO_MODES, ARTEMIS_LRM_AMMO, ARTEMIS_MODE, Cargo, ELRM_AMMO, GetPartAmmoMode, GetPartType, I2Ammo, INARC_ECM_AMMO, INARC_ECM_MODE, INARC_EXPLO_AMMO, INARC_EXPLO_MODE, INARC_HAYWIRE_AMMO, INARC_HAYWIRE_MODE, INARC_NEMESIS_AMMO, INARC_NEMESIS_MODE, INFERNO_MODE, INFERNO_SRM_AMMO, IsAmmo, LAC2_AP_AMMO, LAC2_CASELESS_AMMO, LAC2_FLECHETTE_AMMO, LAC2_INCENDIARY_AMMO, LAC2_PRECISION_AMMO, LAC5_AP_AMMO, LAC5_CASELESS_AMMO, LAC5_FLECHETTE_AMMO, LAC5_INCENDIARY_AMMO, LAC5_PRECISION_AMMO, LBX10_AMMO, LBX20_AMMO, LBX2_AMMO, LBX5_AMMO, LBX_MODE, LR_DFM_AMMO, LRM_AMMO, MechWeapons, MRM_AMMO, name, NARC_LRM_AMMO, NARC_MODE, SGUIDED_MODE, SLRM_AMMO, SR_DFM_AMMO, SRM_AMMO, SSRM_AMMO, STINGER_MODE, SWARM1_LRM_AMMO, SWARM1_MODE, SWARM_LRM_AMMO, and SWARM_MODE.

Referenced by critslot_func(), critstatus_func(), muxevent_tickmech_reload(), muxevent_tickmech_removegun(), muxevent_tickmech_removepart(), TFUNC_LOCPOS(), and TFUNC_LOCPOS_VAL().

00131 {
00132         int t = GetPartType(mech, loc, part);
00133         int m = GetPartAmmoMode(mech, loc, part);
00134         int base = -1;
00135 
00136         if(!IsAmmo(t))
00137                 return t;
00138         t = Ammo2I(t);
00139 
00140         if(strstr(MechWeapons[t].name, "StreakSRM"))
00141                 base = SSRM_AMMO;
00142         else if(strstr(MechWeapons[t].name, "StreakLRM"))
00143                 base = SLRM_AMMO;
00144         else if(strstr(MechWeapons[t].name, "ELRM"))
00145                 base = ELRM_AMMO;
00146         else if(strstr(MechWeapons[t].name, "LR_DFM"))
00147                 base = LR_DFM_AMMO;
00148         else if(strstr(MechWeapons[t].name, "SR_DFM"))
00149                 base = SR_DFM_AMMO;
00150         else if(strstr(MechWeapons[t].name, "LRM"))
00151                 base = LRM_AMMO;
00152         else if(strstr(MechWeapons[t].name, "SRM"))
00153                 base = SRM_AMMO;
00154         else if(strstr(MechWeapons[t].name, "MRM"))
00155                 base = MRM_AMMO;
00156 
00157         if(!(m & AMMO_MODES)) {
00158                 if(base < 0)
00159                         return I2Ammo(t);
00160                 else
00161                         return Cargo(base);
00162         }
00163 
00164         if(m & LBX_MODE) {
00165                 if(strstr(MechWeapons[t].name, "LB20"))
00166                         base = LBX20_AMMO;
00167                 else if(strstr(MechWeapons[t].name, "LB10"))
00168                         base = LBX10_AMMO;
00169                 else if(strstr(MechWeapons[t].name, "LB5"))
00170                         base = LBX5_AMMO;
00171                 else if(strstr(MechWeapons[t].name, "LB2"))
00172                         base = LBX2_AMMO;
00173                 if(base < 0)
00174                         return I2Ammo(t);
00175                 return Cargo(base);
00176         }
00177 
00178         if(m & AC_MODES) {
00179                 if(m & AC_AP_MODE) {
00180                         if(strstr(MechWeapons[t].name, "AC/2"))
00181                                 base = AC2_AP_AMMO;
00182                         if(strstr(MechWeapons[t].name, "AC/5"))
00183                                 base = AC5_AP_AMMO;
00184                         if(strstr(MechWeapons[t].name, "AC/10"))
00185                                 base = AC10_AP_AMMO;
00186                         if(strstr(MechWeapons[t].name, "AC/20"))
00187                                 base = AC20_AP_AMMO;
00188                         if(strstr(MechWeapons[t].name, "LightAC/2"))
00189                                 base = LAC2_AP_AMMO;
00190                         if(strstr(MechWeapons[t].name, "LightAC/5"))
00191                                 base = LAC5_AP_AMMO;
00192                 }
00193 
00194                 if(m & AC_FLECHETTE_MODE) {
00195                         if(strstr(MechWeapons[t].name, "AC/2"))
00196                                 base = AC2_FLECHETTE_AMMO;
00197                         if(strstr(MechWeapons[t].name, "AC/5"))
00198                                 base = AC5_FLECHETTE_AMMO;
00199                         if(strstr(MechWeapons[t].name, "AC/10"))
00200                                 base = AC10_FLECHETTE_AMMO;
00201                         if(strstr(MechWeapons[t].name, "AC/20"))
00202                                 base = AC20_FLECHETTE_AMMO;
00203                         if(strstr(MechWeapons[t].name, "LightAC/2"))
00204                                 base = LAC2_FLECHETTE_AMMO;
00205                         if(strstr(MechWeapons[t].name, "LightAC/5"))
00206                                 base = LAC5_FLECHETTE_AMMO;
00207                 }
00208 
00209                 if(m & AC_INCENDIARY_MODE) {
00210                         if(strstr(MechWeapons[t].name, "AC/2"))
00211                                 base = AC2_INCENDIARY_AMMO;
00212                         if(strstr(MechWeapons[t].name, "AC/5"))
00213                                 base = AC5_INCENDIARY_AMMO;
00214                         if(strstr(MechWeapons[t].name, "AC/10"))
00215                                 base = AC10_INCENDIARY_AMMO;
00216                         if(strstr(MechWeapons[t].name, "AC/20"))
00217                                 base = AC20_INCENDIARY_AMMO;
00218                         if(strstr(MechWeapons[t].name, "LightAC/2"))
00219                                 base = LAC2_INCENDIARY_AMMO;
00220                         if(strstr(MechWeapons[t].name, "LightAC/5"))
00221                                 base = LAC5_INCENDIARY_AMMO;
00222                 }
00223 
00224                 if(m & AC_PRECISION_MODE) {
00225                         if(strstr(MechWeapons[t].name, "AC/2"))
00226                                 base = AC2_PRECISION_AMMO;
00227                         if(strstr(MechWeapons[t].name, "AC/5"))
00228                                 base = AC5_PRECISION_AMMO;
00229                         if(strstr(MechWeapons[t].name, "AC/10"))
00230                                 base = AC10_PRECISION_AMMO;
00231                         if(strstr(MechWeapons[t].name, "AC/20"))
00232                                 base = AC20_PRECISION_AMMO;
00233                         if(strstr(MechWeapons[t].name, "LightAC/2"))
00234                                 base = LAC2_PRECISION_AMMO;
00235                         if(strstr(MechWeapons[t].name, "LightAC/5"))
00236                                 base = LAC5_PRECISION_AMMO;
00237                 }
00238 
00239                 if(m & AC_CASELESS_MODE) {
00240                         if(strstr(MechWeapons[t].name, "AC/2"))
00241                                 base = AC2_CASELESS_AMMO;
00242                         if(strstr(MechWeapons[t].name, "AC/5"))
00243                                 base = AC5_CASELESS_AMMO;
00244                         if(strstr(MechWeapons[t].name, "AC/10"))
00245                                 base = AC10_CASELESS_AMMO;
00246                         if(strstr(MechWeapons[t].name, "AC/20"))
00247                                 base = AC20_CASELESS_AMMO;
00248                         if(strstr(MechWeapons[t].name, "LightAC/2"))
00249                                 base = LAC2_CASELESS_AMMO;
00250                         if(strstr(MechWeapons[t].name, "LightAC/5"))
00251                                 base = LAC5_CASELESS_AMMO;
00252                 }
00253                 if(base < 0)
00254                         return I2Ammo(t);
00255                 return Cargo(base);
00256         }
00257 
00258         if(m & INARC_EXPLO_MODE)
00259                 return Cargo(INARC_EXPLO_AMMO);
00260         else if(m & INARC_HAYWIRE_MODE)
00261                 return Cargo(INARC_HAYWIRE_AMMO);
00262         else if(m & INARC_ECM_MODE)
00263                 return Cargo(INARC_ECM_AMMO);
00264         else if(m & INARC_NEMESIS_MODE)
00265                 return Cargo(INARC_NEMESIS_AMMO);
00266 
00267         if(base < 0)
00268                 return I2Ammo(t);
00269         if(m & NARC_MODE)
00270                 return Cargo(base) + NARC_LRM_AMMO - LRM_AMMO;
00271         if(m & ARTEMIS_MODE)
00272                 return Cargo(base) + ARTEMIS_LRM_AMMO - LRM_AMMO;
00273         if(m & SWARM_MODE)
00274                 return Cargo(base) + SWARM_LRM_AMMO - LRM_AMMO;
00275         if(m & SWARM1_MODE)
00276                 return Cargo(base) + SWARM1_LRM_AMMO - LRM_AMMO;
00277         if(m & INFERNO_MODE)
00278                 return Cargo(base) + INFERNO_SRM_AMMO - SRM_AMMO;
00279         if(m & STINGER_MODE)
00280                 return Cargo(base) + AMMO_LRM_STINGER - LRM_AMMO;
00281         if(m & SGUIDED_MODE)
00282                 return Cargo(base) + AMMO_LRM_SGUIDED - LRM_AMMO;
00283         return Cargo(base);
00284 }

NFUNC ( TFUNC_LOCPOS(repairp_succ)   ) 

NFUNC ( TFUNC_LOCPOS(repairenhcrit_succ)   ) 

NFUNC ( TFUNC_LOCPOS(repairg_succ)   ) 

NFUNC ( TFUNC_LOC(replacesuit_succ)   ) 

NFUNC ( TFUNC_LOC_RESEAL(reseal_succ)   ) 

NFUNC ( TFUNC_LOC(reattach_succ)   ) 

NFUNC ( TFUNC_LOC_VAL(fixarmor_succ)   ) 

NFUNC ( TFUNC_LOC_VAL(fixinternal_succ)   ) 

NFUNC ( TFUNC_LOCPOS_VAL(reload_succ)   ) 

NFUNC ( TFUNC_LOCPOS(replaceg_succ)   ) 

NFUNC ( TFUNC_LOCPOS(replacep_succ)   ) 

TFUNC_LOC ( replacesuit_fail   ) 

Definition at line 540 of file mech.tech.do.c.

References AddPartsM, BSUIT_ELECTRONIC, BSUIT_LIFESUPPORT, BSUIT_REPAIR_ELECTRONICS_NEEDED, BSUIT_REPAIR_INTERNAL_NEEDED, BSUIT_REPAIR_LIFESUPPORT_NEEDED, BSUIT_REPAIR_SENSORS_NEEDED, BSUIT_SENSOR, Cargo, loc, MAX, notify_printf(), ProperInternal, random, REATTACH_DIFFICULTY, and tech_roll().

00541 {
00542         int wRand = 0;
00543 
00544         if(tech_roll(player, mech, REATTACH_DIFFICULTY) >= 0)
00545                 return 0;
00546 
00547         wRand = random() % 90 + 5;
00548         notify_printf(player,
00549                                   "Despite your disastrous failure, you recover %d%% of the materials.",
00550                                   wRand);
00551 #ifndef BT_COMPLEXREPAIRS
00552         AddPartsM(mech, Cargo(BSUIT_SENSOR), 0,
00553                           MAX(((BSUIT_REPAIR_SENSORS_NEEDED * wRand) / 100), 1));
00554         AddPartsM(mech, Cargo(BSUIT_LIFESUPPORT), 0,
00555                           ((BSUIT_REPAIR_LIFESUPPORT_NEEDED * wRand) / 100));
00556         AddPartsM(mech, Cargo(BSUIT_ELECTRONIC), 0,
00557                           ((BSUIT_REPAIR_ELECTRONICS_NEEDED * wRand) / 100));
00558         AddPartsM(mech, ProperInternal(mech), 0,
00559                           MAX(((BSUIT_REPAIR_INTERNAL_NEEDED * wRand) / 100), 1));
00560 #else
00561         AddPartsM(mech, loc, Cargo(BSUIT_SENSOR), 0,
00562                           MAX(((BSUIT_REPAIR_SENSORS_NEEDED * wRand) / 100), 1));
00563         AddPartsM(mech, loc, Cargo(BSUIT_LIFESUPPORT), 0,
00564                           ((BSUIT_REPAIR_LIFESUPPORT_NEEDED * wRand) / 100));
00565         AddPartsM(mech, loc, Cargo(BSUIT_ELECTRONIC), 0,
00566                           ((BSUIT_REPAIR_ELECTRONICS_NEEDED * wRand) / 100));
00567         AddPartsM(mech, loc, ProperInternal(mech), 0,
00568                           MAX(((BSUIT_REPAIR_INTERNAL_NEEDED * wRand) / 100), 1));
00569 #endif
00570         return -1;
00571 }

TFUNC_LOC ( reattach_fail   ) 

Definition at line 513 of file mech.tech.do.c.

References AddPartsM, Cargo, CLASS_MECH, GetSectOInt, loc, MechType, mudconf, notify_printf(), ProperInternal, random, REATTACH_DIFFICULTY, S_ELECTRONIC, and tech_roll().

00514 {
00515         int tot;
00516 
00517         if(tech_roll(player, mech, REATTACH_DIFFICULTY) >= 0)
00518                 return 0;
00519         tot = random() % 90 + 5;
00520         notify_printf(player,
00521                                   "Despite your disastrous failure, you recover %d%% of the materials.",
00522                                   tot);
00523         tot = (tot * GetSectOInt(mech, loc)) / 100;
00524         if(tot == 0)
00525                 tot = 1;
00526         if(tot == GetSectOInt(mech, loc))
00527                 tot = GetSectOInt(mech, loc) - 1;
00528 #ifndef BT_COMPLEXREPAIRS
00529         AddPartsM(mech, Cargo(S_ELECTRONIC), 0, tot);
00530         AddPartsM(mech, ProperInternal(mech), 0, tot);
00531 #else
00532         AddPartsM(mech, loc, Cargo(S_ELECTRONIC), 0, tot);
00533         AddPartsM(mech, loc, ProperInternal(mech), 0, tot);
00534         if(mudconf.btech_complexrepair && MechType(mech) == CLASS_MECH)
00535                 AddPartsM(mech, loc, ProperMyomer(mech), 0, 1);
00536 #endif
00537         return -1;
00538 }

TFUNC_LOC ( reseal_econ   ) 

Definition at line 374 of file mech.tech.do.c.

References Cargo, GetSectOInt, loc, PARTCHECKTWO, ProperInternal, and S_ELECTRONIC.

00375 {
00376         PARTCHECKTWO(mech, ProperInternal(mech), 0, GetSectOInt(mech, loc),
00377                                  Cargo(S_ELECTRONIC), 0, GetSectOInt(mech, loc));
00378         return 0;
00379 }

TFUNC_LOC ( replacesuit_econ   ) 

Definition at line 358 of file mech.tech.do.c.

References BSUIT_ELECTRONIC, BSUIT_LIFESUPPORT, BSUIT_REPAIR_ELECTRONICS_NEEDED, BSUIT_REPAIR_INTERNAL_NEEDED, BSUIT_REPAIR_LIFESUPPORT_NEEDED, BSUIT_REPAIR_SENSORS_NEEDED, BSUIT_SENSOR, Cargo, PARTCHECKFOUR, and ProperInternal.

TFUNC_LOC ( reattach_econ   ) 

Definition at line 332 of file mech.tech.do.c.

References Cargo, CLASS_MECH, GetSectOInt, loc, MechType, mudconf, PARTCHECK, PARTCHECKTWO, ProperInternal, and S_ELECTRONIC.

00333 {
00334 #ifndef BT_COMPLEXREPAIRS
00335         PARTCHECKTWO(mech, ProperInternal(mech), 0, GetSectOInt(mech, loc),
00336                                  Cargo(S_ELECTRONIC), 0, GetSectOInt(mech, loc));
00337 #else
00338         if(mudconf.btech_complexrepair) {
00339                 if(MechType(mech) == CLASS_MECH) {
00340                         PARTCHECKTWO(mech, ProperInternal(mech), 0,
00341                                                  GetSectOInt(mech, loc), ProperMyomer(mech), 0, 1);
00342                 } else {
00343                         PARTCHECK(mech, ProperInternal(mech), 0, GetSectOInt(mech, loc));
00344                 }
00345         } else {
00346                 PARTCHECKTWO(mech, ProperInternal(mech), 0, GetSectOInt(mech, loc),
00347                                          Cargo(S_ELECTRONIC), 0, GetSectOInt(mech, loc));
00348         }
00349 #endif
00350         return 0;
00351 }

TFUNC_LOC_RESEAL ( reseal_fail   ) 

Definition at line 578 of file mech.tech.do.c.

References AddPartsM, Cargo, GetSectOInt, loc, notify_printf(), ProperInternal, random, RESEAL_DIFFICULTY, S_ELECTRONIC, and tech_roll().

00579 {
00580         int tot;
00581 
00582         if(tech_roll(player, mech, RESEAL_DIFFICULTY) >= 0)
00583                 return 0;
00584         tot = random() % 90 + 5;
00585         notify_printf(player,
00586                                   "You don't manage to get all the water out and seal the section, though you recover %d%% of the materials.",
00587                                   tot);
00588         tot = (tot * GetSectOInt(mech, loc)) / 100;
00589         if(tot == 0)
00590                 tot = 1;
00591         if(tot == GetSectOInt(mech, loc))
00592                 tot = GetSectOInt(mech, loc) - 1;
00593 #ifndef BT_COMPLEXREPAIRS
00594         AddPartsM(mech, Cargo(S_ELECTRONIC), 0, tot);
00595         AddPartsM(mech, ProperInternal(mech), 0, tot);
00596 #else
00597         AddPartsM(mech, loc, Cargo(S_ELECTRONIC), 0, tot);
00598         AddPartsM(mech, loc, ProperInternal(mech), 0, tot);
00599 #endif
00600         return -1;
00601 }

TFUNC_LOC_VAL ( fixinternal_fail   ) 

Definition at line 489 of file mech.tech.do.c.

References FIXARMOR_DIFFICULTY, notify_printf(), random, and tech_roll().

00490 {
00491         int tot = 0;
00492         int should = *val;
00493 
00494         if(tech_roll(player, mech, FIXARMOR_DIFFICULTY) >= 0)
00495                 tot += 50;
00496         tot += random() % 40 + 5;
00497         tot = (tot * should) / 100;
00498         if(tot == 0)
00499                 tot = 1;
00500         if(tot == should)
00501                 tot = should - 1;
00502         notify_printf(player,
00503                                   "Your internal patching isn't exactly perfect.. You managed to fix %d out of %d.",
00504                                   tot, should);
00505         *val = tot;
00506         return 0;
00507 }

TFUNC_LOC_VAL ( fixarmor_fail   ) 

Definition at line 470 of file mech.tech.do.c.

References FIXARMOR_DIFFICULTY, notify_printf(), random, and tech_roll().

00471 {
00472         int tot = 0;
00473         int should = *val;
00474 
00475         if(tech_roll(player, mech, FIXARMOR_DIFFICULTY) >= 0)
00476                 tot += 50;
00477         tot += random() % 40 + 5;
00478         tot = (tot * should) / 100;
00479         if(tot == 0)
00480                 tot = 1;
00481         if(tot == should)
00482                 tot = should - 1;
00483         notify_printf(player, "Your armor patching isn't exactly perfect.. "
00484                                   "You managed to fix %d out of %d.", tot, should);
00485         *val = tot;
00486         return 0;
00487 }

TFUNC_LOC_VAL ( fixinternal_econ   ) 

Definition at line 309 of file mech.tech.do.c.

References PARTCHECK, and ProperInternal.

00310 {
00311         PARTCHECK(mech, ProperInternal(mech), 0, *val);
00312         return 0;
00313 }

TFUNC_LOC_VAL ( fixarmor_econ   ) 

Definition at line 303 of file mech.tech.do.c.

References PARTCHECK, and ProperArmor.

00304 {
00305         PARTCHECK(mech, ProperArmor(mech), 0, *val);
00306         return 0;
00307 }

TFUNC_LOCPOS ( repairp_fail   ) 

Definition at line 456 of file mech.tech.do.c.

References loc, and repairg_fail().

00457 {
00458         return repairg_fail(player, mech, loc, part);
00459 }

TFUNC_LOCPOS ( replacep_fail   ) 

Definition at line 449 of file mech.tech.do.c.

References notify.

00450 {
00451         notify(player, "Your repair fails.. all the parts are wasted for good.");
00452         return -1;
00453 }

TFUNC_LOCPOS ( repairenhcrit_fail   ) 

Definition at line 442 of file mech.tech.do.c.

References notify.

00443 {
00444         notify(player, "You don't manage to repair the damage.");
00445         return -1;
00446 }

TFUNC_LOCPOS ( repairg_fail   ) 

Definition at line 426 of file mech.tech.do.c.

References DestroyPart, GetPartType, GetWeaponCrits(), loc, notify, PartIsDestroyed, and Weapon2I.

00427 {
00428         if(PartIsDestroyed(mech, loc, part))
00429                 /* If we are calling repairgun on a thing that is actually destroyed
00430                  * the following check *should not* be necessary. Nevertheless... */
00431                 if(GetWeaponCrits(mech, Weapon2I(GetPartType(mech, loc, part)))
00432                    > 4) {
00433                         DestroyPart(mech, loc, part + 1);
00434                         notify(player,
00435                                    "You muck around, trashing the gun in the process.");
00436                         return -1;
00437                 }
00438         notify(player, "Your repair fails.. all the parts are wasted for good.");
00439         return -1;
00440 }

TFUNC_LOCPOS ( replaceg_fail   ) 

Definition at line 403 of file mech.tech.do.c.

References AddPartsM, FindAmmoType(), GetPartBrand, GetPartType, IsWeapon, loc, notify_printf(), REPLACE_DIFFICULTY, and tech_roll().

00404 {
00405         int w = (IsWeapon(GetPartType(mech, loc, part)));
00406 
00407         if(tech_roll(player, mech, REPLACE_DIFFICULTY) < 0) {
00408                 notify_printf(player,
00409                                           "You muck around, wasting the %s in the progress.",
00410                                           w ? "weapon" : "part");
00411                 return -1;
00412         }
00413         notify_printf(player,
00414                                   "Despite messing the repair, you manage not to waste the %s.",
00415                                   w ? "weapon" : "part");
00416 #ifndef BT_COMPLEXREPAIRS
00417         AddPartsM(mech, FindAmmoType(mech, loc, part), GetPartBrand(mech, loc,
00418                                                                                                                                 part), 1);
00419 #else
00420         AddPartsM(mech, loc, FindAmmoType(mech, loc, part),
00421                           GetPartBrand(mech, loc, part), 1);
00422 #endif
00423         return -1;
00424 }

TFUNC_LOCPOS ( repairenhcrit_econ   ) 

Definition at line 326 of file mech.tech.do.c.

References Cargo, PARTCHECK, and S_ELECTRONIC.

00327 {
00328         PARTCHECK(mech, Cargo(S_ELECTRONIC), 0, 1);
00329         return 0;
00330 }

TFUNC_LOCPOS ( repair_econ   ) 

Definition at line 315 of file mech.tech.do.c.

References Cargo, GetPartType, IsAmmo, loc, PARTCHECKTWO, PartIsDestroyed, ProperInternal, and S_ELECTRONIC.

00316 {
00317         if(IsAmmo(GetPartType(mech, loc, part)))
00318                 return 0;
00319         PARTCHECKTWO(mech, Cargo(S_ELECTRONIC), 0, PartIsDestroyed(mech, loc,
00320                                                                                                                            part) ? 3 : 1,
00321                                  ProperInternal(mech), 0, PartIsDestroyed(mech, loc,
00322                                                                                                                   part) ? 3 : 1);
00323         return 0;
00324 }

TFUNC_LOCPOS ( replace_econ   ) 

Definition at line 286 of file mech.tech.do.c.

References GetPartBrand, GetPartType, IsAmmo, loc, and PARTCHECK.

00287 {
00288         if(IsAmmo(GetPartType(mech, loc, part)))
00289                 return 0;
00290         PARTCHECK(mech, GetPartType(mech, loc, part), GetPartBrand(mech, loc,
00291                                                                                                                            part), 1);
00292         return 0;
00293 }

TFUNC_LOCPOS_VAL ( reload_fail   ) 

Definition at line 462 of file mech.tech.do.c.

References notify.

00463 {
00464         notify(player, "You fumble around, wasting the ammo in the progress.");
00465         return -1;
00466 }

TFUNC_LOCPOS_VAL ( reload_econ   ) 

Definition at line 295 of file mech.tech.do.c.

References FindAmmoType(), GetPartBrand, loc, and PARTCHECK.

00296 {
00297         int ammotype = FindAmmoType(mech, loc, part);
00298 
00299         PARTCHECK(mech, ammotype, GetPartBrand(mech, loc, part), 1);
00300         return 0;
00301 }

int valid_ammo_mode ( MECH mech,
int  loc,
int  part,
int  let 
)

Definition at line 98 of file mech.tech.do.c.

References Ammo2I, ammo_types, GetPartType, IsAmmo, MechWeapons, name, NOSPA, nspec, ntype, rspec, and rtype.

Referenced by TECHCOMMANDH().

00099 {
00100         int w, i;
00101 
00102         if(!IsAmmo(GetPartType(mech, loc, part)) || !let)
00103                 return -1;
00104         let = toupper(let);
00105         w = Ammo2I(GetPartType(mech, loc, part));
00106 
00107         if(MechWeapons[w].special & NOSPA)
00108                 return -1;
00109 
00110         for(i = 0; ammo_types[i].name; i++) {
00111                 if(ammo_types[i].name != let)
00112                         continue;
00113                 if(ammo_types[i].rtype >= 0 &&
00114                    MechWeapons[w].type != ammo_types[i].rtype)
00115                         continue;
00116                 if(ammo_types[i].rspec &&
00117                    !(MechWeapons[w].special & ammo_types[i].rspec))
00118                         continue;
00119                 if(ammo_types[i].ntype >= 0 &&
00120                    MechWeapons[w].type == ammo_types[i].ntype)
00121                         continue;
00122                 if(ammo_types[i].nspec &&
00123                    (MechWeapons[w].special & ammo_types[i].nspec))
00124                         continue;
00125                 return ammo_types[i].aflag;
00126         }
00127         return -1;
00128 }


Variable Documentation

int aflag

Definition at line 62 of file mech.tech.do.c.

struct { ... } ammo_types[] [static]

Referenced by valid_ammo_mode().

char* lname

Definition at line 61 of file mech.tech.do.c.

char name

Definition at line 60 of file mech.tech.do.c.

int nspec

Definition at line 71 of file mech.tech.do.c.

Referenced by valid_ammo_mode().

int ntype

Definition at line 65 of file mech.tech.do.c.

Referenced by valid_ammo_mode().

int rspec

Definition at line 67 of file mech.tech.do.c.

Referenced by valid_ammo_mode().

int rtype

Definition at line 63 of file mech.tech.do.c.

Referenced by valid_ammo_mode().


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