src/hcode/btech/p.mech.tic.h File Reference

Go to the source code of this file.

Functions

int cleartic_sub_func (MECH *mech, dbref player, int low, int high)
void cleartic_sub (dbref player, MECH *mech, char *buffer)
int addtic_sub_func (MECH *mech, dbref player, int low, int high)
void addtic_sub (dbref player, MECH *mech, char *buffer)
int deltic_sub_func (MECH *mech, dbref player, int low, int high)
void deltic_sub (dbref player, MECH *mech, char *buffer)
int firetic_sub_func (MECH *mech, dbref player, int low, int high)
void firetic_sub (dbref player, MECH *mech, char *buffer)
void listtic_sub (dbref player, MECH *mech, char *buffer)
void mech_cleartic (dbref player, void *data, char *buffer)
void mech_addtic (dbref player, void *data, char *buffer)
void mech_deltic (dbref player, void *data, char *buffer)
void mech_firetic (dbref player, void *data, char *buffer)
void mech_listtic (dbref player, void *data, char *buffer)
void heat_cutoff (dbref player, void *data, char *buffer)


Function Documentation

void addtic_sub ( dbref  player,
MECH mech,
char *  buffer 
)

Definition at line 72 of file mech.tic.c.

References addtic_sub_func(), args, DOCHECK, mech_parseattributes(), multi_weap_sel(), NUM_TICS, and present_tic.

Referenced by mech_addtic(), and turret_addtic().

00073 {
00074         int ticnum, argc;
00075         char *args[3];
00076 
00077         DOCHECK((argc =
00078                          mech_parseattributes(buffer, args, 3)) != 2,
00079                         "Invalid number of arguments to function!");
00080         ticnum = atoi(args[0]);
00081         DOCHECK(!(ticnum >= 0 && ticnum < NUM_TICS), "Invalid tic number!");
00082         present_tic = ticnum;
00083         multi_weap_sel(mech, player, args[1], 0, addtic_sub_func);
00084 }

int addtic_sub_func ( MECH mech,
dbref  player,
int  low,
int  high 
)

Definition at line 55 of file mech.tic.c.

References notify_printf(), present_tic, SINGLE_TICLONG_SIZE, and MECH::tic.

Referenced by addtic_sub().

00056 {
00057         int i, j;
00058 
00059         for(i = low; i <= high; i++) {
00060                 j = i / SINGLE_TICLONG_SIZE;
00061                 mech->tic[present_tic][j] |= 1 << (i % SINGLE_TICLONG_SIZE);
00062         }
00063         if(low != high)
00064                 notify_printf(player, "Weapons #%d - #%d added to TIC %d!", low,
00065                                           high, present_tic);
00066         else
00067                 notify_printf(player, "Weapon #%d added to TIC %d!", low,
00068                                           present_tic);
00069         return 0;
00070 }

void cleartic_sub ( dbref  player,
MECH mech,
char *  buffer 
)

Definition at line 42 of file mech.tic.c.

References args, cleartic_sub_func(), DOCHECK, mech_parseattributes(), and multi_weap_sel().

Referenced by deltic_sub(), mech_cleartic(), and turret_cleartic().

00043 {
00044         int argc;
00045         char *args[3];
00046 
00047         DOCHECK((argc =
00048                          mech_parseattributes(buffer, args, 3)) != 1,
00049                         "Invalid number of arguments to function");
00050         multi_weap_sel(mech, player, args[0], 2, cleartic_sub_func);
00051 }

int cleartic_sub_func ( MECH mech,
dbref  player,
int  low,
int  high 
)

Definition at line 30 of file mech.tic.c.

References notify_printf(), MECH::tic, and TICLONGS.

Referenced by cleartic_sub().

00031 {
00032         int i, j;
00033 
00034         for(i = low; i <= high; i++) {
00035                 for(j = 0; j < TICLONGS; j++)
00036                         mech->tic[i][j] = 0;
00037                 notify_printf(player, "TIC #%d cleared!", i);
00038         }
00039         return 0;
00040 }

void deltic_sub ( dbref  player,
MECH mech,
char *  buffer 
)

Definition at line 103 of file mech.tic.c.

References args, cleartic_sub(), deltic_sub_func(), DOCHECK, mech_parseattributes(), multi_weap_sel(), NUM_TICS, and present_tic.

Referenced by mech_deltic(), and turret_deltic().

00104 {
00105         int ticnum, argc;
00106         char *args[3];
00107 
00108         argc = mech_parseattributes(buffer, args, 3);
00109         DOCHECK(argc < 1 ||
00110                         argc > 2, "Invalid number of arguments to the function!");
00111         if(argc == 1) {
00112                 cleartic_sub(player, mech, buffer);
00113                 return;
00114         }
00115         ticnum = atoi(args[0]);
00116         DOCHECK(!(ticnum >= 0 && ticnum < NUM_TICS), "Invalid tic number!");
00117         present_tic = ticnum;
00118         multi_weap_sel(mech, player, args[1], 0, deltic_sub_func);
00119 }

int deltic_sub_func ( MECH mech,
dbref  player,
int  low,
int  high 
)

Definition at line 86 of file mech.tic.c.

References notify_printf(), present_tic, SINGLE_TICLONG_SIZE, and MECH::tic.

Referenced by deltic_sub().

00087 {
00088         int i, j;
00089 
00090         for(i = low; i <= high; i++) {
00091                 j = i / SINGLE_TICLONG_SIZE;
00092                 mech->tic[present_tic][j] &= ~(1 << (i % SINGLE_TICLONG_SIZE));
00093         }
00094         if(low != high)
00095                 notify_printf(player, "Weapons #%d - #%d removed from TIC %d!",
00096                                           low, high, present_tic);
00097         else
00098                 notify_printf(player, "Weapon #%d removed from TIC %d!", low,
00099                                           present_tic);
00100         return 0;
00101 }

void firetic_sub ( dbref  player,
MECH mech,
char *  buffer 
)

Definition at line 155 of file mech.tic.c.

References args, DOCHECK, firetic_sub_func(), ftflag, getMap(), MECH::mapindex, mech_parseattributes(), multi_weap_sel(), NUM_TICS, temp_argc, and temp_args.

Referenced by mech_firetic(), and turret_firetic().

00156 {
00157         MAP *mech_map;
00158         int ticnum, argc;
00159         char *args[5];
00160         unsigned long weaps;
00161 
00162         DOCHECK((argc =
00163                          mech_parseattributes(buffer, args, 5)) < 1,
00164                         "Not enough arguments to function");
00165         mech_map = getMap(mech->mapindex);
00166         ticnum = atoi(args[0]);
00167         DOCHECK(!(ticnum >= 0 && ticnum < NUM_TICS), "TIC out of range!");
00168 
00169 /*   notify (player, tprintf ("Firing all weapons in TIC #%d at default target!", ticnum)); */
00170         weaps = 1;
00171         ftflag = 1;
00172         temp_args = args;
00173         temp_argc = argc;       
00174         multi_weap_sel(mech, player, args[0], 2, firetic_sub_func);
00175         ftflag = 0;
00176 }

int firetic_sub_func ( MECH mech,
dbref  player,
int  low,
int  high 
)

Definition at line 124 of file mech.tic.c.

References Fallen, FindObjectsData(), FireWeaponNumber(), MECH::mapindex, mech_notify(), MECHALL, notify_printf(), SINGLE_TICLONG_SIZE, Started, temp_argc, temp_args, MECH::tic, and TICLONGS.

Referenced by firetic_sub().

00125 {
00126         int i, j, k, count, weapnum;
00127         MAP *mech_map = FindObjectsData(mech->mapindex);
00128         int f = Fallen(mech);
00129 
00130         for(i = low; i <= high; i++) {
00131                 notify_printf(player, "Firing weapons in tic #%d!", i);
00132                 count = 0;
00133                 for(k = 0; k < TICLONGS; k++)
00134                         if(mech->tic[i][k])
00135                                 for(j = 0; j < SINGLE_TICLONG_SIZE; j++)
00136                                         if(mech->tic[i][k] & (1 << j)) {
00137                                                 weapnum = k * SINGLE_TICLONG_SIZE + j;
00138                                                 FireWeaponNumber(player, mech, mech_map, weapnum,
00139                                                                                  temp_argc, temp_args, 0);
00140                                                 if(f != (Fallen(mech))) {
00141                                                         if(Started(mech))
00142                                                                 mech_notify(mech, MECHALL,
00143                                                                                         "That fall causes you to stop your fire!");
00144                                                         return 1;
00145                                                 } else if(!Started(mech))
00146                                                         return 1;
00147                                                 count++;
00148                                         }
00149                 if(!count)
00150                         notify_printf(player, "*Click* (the tic contained no weapons)");
00151         }
00152         return 0;
00153 }

void heat_cutoff ( dbref  player,
void *  data,
char *  buffer 
)

Definition at line 303 of file mech.tic.c.

References cch, EVENT_HEATCUTOFFCHANGING, heat_cutoff_event(), Heatcutoff, HeatcutoffChanging, MECH_USUALSMO, MECHEVENT, and notify.

00304 {
00305         MECH *mech = (MECH *) data;
00306 
00307         cch(MECH_USUALSMO);
00308         if(HeatcutoffChanging(mech)) {
00309                 notify(player,
00310                            "You are already toggling heat cutoff status. Please be patient.");
00311                 return;
00312         }
00313         if(Heatcutoff(mech)) {
00314                 notify(player, "Disengaging heat dissipation cutoff...");
00315                 MECHEVENT(mech, EVENT_HEATCUTOFFCHANGING, heat_cutoff_event, 4, 0);
00316         } else {
00317                 notify(player, "Engaging heat dissipation cutoff...");
00318                 MECHEVENT(mech, EVENT_HEATCUTOFFCHANGING, heat_cutoff_event, 4, 1);
00319         }
00320 }

void listtic_sub ( dbref  player,
MECH mech,
char *  buffer 
)

Definition at line 221 of file mech.tic.c.

References args, c, DOCHECK, GetMechID(), KillCoolMenu(), listtic_fun(), MAX, MAX_WEAPONS_PER_MECH, mech_parseattributes(), NUM_TICS, present_count, present_mech, present_tic, SelCol_FunStringMenuK(), ShowCoolMenu(), SINGLE_TICLONG_SIZE, MECH::tic, and tprintf().

Referenced by mech_listtic(), and turret_listtic().

00222 {
00223         int ticnum, argc;
00224         char *args[2];
00225         int i, j, k, count = 0;
00226         coolmenu *c;
00227 
00228         DOCHECK((argc =
00229                          mech_parseattributes(buffer, args, 2)) != 1,
00230                         "Invalid number of arguments!");
00231         ticnum = atoi(args[0]);
00232         DOCHECK(!(ticnum >= 0 && ticnum < NUM_TICS), "TIC out of range!");
00233         present_mech = mech;
00234         present_tic = ticnum;
00235         for(i = 0; i < MAX_WEAPONS_PER_MECH; i++) {
00236                 j = i / SINGLE_TICLONG_SIZE;
00237                 k = i % SINGLE_TICLONG_SIZE;
00238                 if(mech->tic[ticnum][j] & (1 << k))
00239                         count++;
00240         }
00241         present_count = count;
00242         c = SelCol_FunStringMenuK(2, tprintf("TIC #%d listing for %s", ticnum,
00243                                                                                  GetMechID(mech)), listtic_fun, MAX(1,
00244                                                                                                                                                         count));
00245         ShowCoolMenu(player, c);
00246         KillCoolMenu(c);
00247 }

void mech_addtic ( dbref  player,
void *  data,
char *  buffer 
)

Definition at line 257 of file mech.tic.c.

References addtic_sub(), cch, and MECH_USUALSM.

00258 {
00259         MECH *mech = (MECH *) data;
00260 
00261         cch(MECH_USUALSM);
00262         addtic_sub(player, mech, buffer);
00263 }

void mech_cleartic ( dbref  player,
void *  data,
char *  buffer 
)

Definition at line 249 of file mech.tic.c.

References cch, cleartic_sub(), and MECH_USUALSM.

00250 {
00251         MECH *mech = (MECH *) data;
00252 
00253         cch(MECH_USUALSM);
00254         cleartic_sub(player, mech, buffer);
00255 }

void mech_deltic ( dbref  player,
void *  data,
char *  buffer 
)

Definition at line 265 of file mech.tic.c.

References cch, deltic_sub(), and MECH_USUALSM.

00266 {
00267         MECH *mech = (MECH *) data;
00268 
00269         cch(MECH_USUALSM);
00270         deltic_sub(player, mech, buffer);
00271 }

void mech_firetic ( dbref  player,
void *  data,
char *  buffer 
)

Definition at line 273 of file mech.tic.c.

References cch, firetic_sub(), and MECH_USUALO.

00274 {
00275         MECH *mech = (MECH *) data;
00276 
00277         cch(MECH_USUALO);
00278         firetic_sub(player, mech, buffer);
00279 }

void mech_listtic ( dbref  player,
void *  data,
char *  buffer 
)

Definition at line 281 of file mech.tic.c.

References cch, listtic_sub(), and MECH_USUALSM.

00282 {
00283         MECH *mech = (MECH *) data;
00284 
00285         cch(MECH_USUALSM);
00286         listtic_sub(player, mech, buffer);
00287 }


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