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

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void drop_thru_ice (MECH *mech)
void break_thru_ice (MECH *mech)
int possibly_drop_thru_ice (MECH *mech)
int growable (MAP *map, int x, int y)
int meltable (MAP *map, int x, int y)
void ice_growth (dbref player, MAP *map, int num)
void ice_melt (dbref player, MAP *map, int num)
void map_addice (dbref player, MAP *map, char *buffer)
void map_delice (dbref player, MAP *map, char *buffer)
void possibly_blow_ice (MECH *mech, int weapindx, int x, int y)
void possibly_blow_bridge (MECH *mech, int weapindx, int x, int y)


Function Documentation

void break_thru_ice ( MECH mech  ) 

Definition at line 92 of file mech.ice.c.

References break_sub(), FindObjectsData(), MECH::mapindex, MarkForLOSUpdate(), mech_notify(), MECHALL, MechLOSBroadcast(), MechTerrain, MechX, MechY, and WATER.

Referenced by mech_pickup(), mech_stand(), and move_mech().

00093 {
00094         MAP *map = FindObjectsData(mech->mapindex);
00095 
00096         MarkForLOSUpdate(mech);
00097         mech_notify(mech, MECHALL, "You break through the ice!");
00098         MechLOSBroadcast(mech, "breaks through the ice!");
00099         break_sub(map, mech, MechX(mech), MechY(mech), "goes swimming!");
00100         MechTerrain(mech) = WATER;
00101 }

void drop_thru_ice ( MECH mech  ) 

Definition at line 65 of file mech.ice.c.

References break_sub(), ChannelEmitKill(), CLASS_VEH_GROUND, Destroy, Destroyed, FindObjectsData(), MECH::mapindex, mech_notify(), MECHALL, MechElev, MechFalls(), MechLOSBroadcast(), MechMove, MechSpecials2, MechTerrain, MechType, MechX, MechY, MOVE_FOIL, WATER, and WATERPROOF_TECH.

Referenced by mech_pickup(), move_mech(), and possibly_drop_thru_ice().

00066 {
00067         MAP *map = FindObjectsData(mech->mapindex);
00068 
00069         mech_notify(mech, MECHALL, "You break the ice!");
00070         MechLOSBroadcast(mech, "breaks the ice!");
00071         if(MechMove(mech) != MOVE_FOIL) {
00072                 if(MechElev(mech) > 0)
00073                         MechLOSBroadcast(mech, "vanishes into the waters!");
00074         }
00075         break_sub(map, mech, MechX(mech), MechY(mech), "goes swimming!");
00076         MechTerrain(mech) = WATER;
00077         if(MechMove(mech) != MOVE_FOIL) {
00078                 if(MechElev(mech) > 0)
00079                         MechFalls(mech, MechElev(mech), 0);
00080         }
00081         if(MechElev(mech) > 0 && MechType(mech) == CLASS_VEH_GROUND &&
00082            !Destroyed(mech) && !(MechSpecials2(mech) & WATERPROOF_TECH)) {
00083                 mech_notify(mech, MECHALL, "Water renders your vehicle inoperable.");
00084                 MechLOSBroadcast(mech,
00085                                                  "fizzles and pops as water renders it inoperable.");
00086                 Destroy(mech);
00087                 ChannelEmitKill(mech, mech);
00088         }
00089 }

int growable ( MAP map,
int  x,
int  y 
)

Definition at line 125 of file mech.ice.c.

References growable_callback(), Number, visit_neighbor_hexes(), and watercount.

Referenced by ice_growth().

00126 {
00127         watercount = 0;
00128         visit_neighbor_hexes(map, x, y, growable_callback);
00129 
00130         if(watercount <= 4 && (watercount < 2 || (Number(1, 6) > watercount)))
00131                 return 1;
00132         return 0;
00133 }

void ice_growth ( dbref  player,
MAP map,
int  num 
)

Definition at line 151 of file mech.ice.c.

References GetRTerrain, growable(), ICE, MAP::map_height, MAP::map_width, notify, notify_printf(), Number, SetTerrain, TMP_TERR, WATER, x, and y.

Referenced by map_addice().

00152 {
00153         int x, y;
00154         int count = 0;
00155 
00156         for(x = 0; x < map->map_width; x++)
00157                 for(y = 0; y < map->map_height; y++)
00158                         if(GetRTerrain(map, x, y) == WATER)
00159                                 if(Number(1, 100) <= num && growable(map, x, y)) {
00160                                         SetTerrain(map, x, y, TMP_TERR);
00161                                         count++;
00162                                 }
00163         for(x = 0; x < map->map_width; x++)
00164                 for(y = 0; y < map->map_height; y++)
00165                         if(GetRTerrain(map, x, y) == TMP_TERR)
00166                                 SetTerrain(map, x, y, ICE);
00167         if(count)
00168                 notify_printf(player, "%d hexes 'iced'.", count);
00169         else
00170                 notify(player, "No hexes 'iced'.");
00171 }

void ice_melt ( dbref  player,
MAP map,
int  num 
)

Definition at line 173 of file mech.ice.c.

References break_sub(), GetRTerrain, ICE, MAP::map_height, MAP::map_width, meltable(), notify, notify_printf(), Number, SetTerrain, TMP_TERR, WATER, x, and y.

Referenced by map_delice().

00174 {
00175         int x, y;
00176         int count = 0;
00177 
00178         for(x = 0; x < map->map_width; x++)
00179                 for(y = 0; y < map->map_height; y++)
00180                         if(GetRTerrain(map, x, y) == ICE)
00181                                 if(Number(1, 100) <= num && meltable(map, x, y)) {
00182                                         break_sub(map, NULL, x, y,
00183                                                           "goes swimming as ice breaks!");
00184                                         SetTerrain(map, x, y, TMP_TERR);
00185                                         count++;
00186                                 }
00187         for(x = 0; x < map->map_width; x++)
00188                 for(y = 0; y < map->map_height; y++)
00189                         if(GetRTerrain(map, x, y) == TMP_TERR)
00190                                 SetTerrain(map, x, y, WATER);
00191         if(count)
00192                 notify_printf(player, "%d hexes melted.", count);
00193         else
00194                 notify(player, "No hexes melted.");
00195 }

void map_addice ( dbref  player,
MAP map,
char *  buffer 
)

Definition at line 197 of file mech.ice.c.

References args, DOCHECK, ice_growth(), mech_parseattributes(), and Readnum.

00198 {
00199         char *args[2];
00200         int num;
00201 
00202         DOCHECK(mech_parseattributes(buffer, args, 2) != 1, "Invalid arguments!");
00203         DOCHECK(Readnum(num, args[0]), "Invalid number!");
00204         ice_growth(player, map, num);
00205 }

void map_delice ( dbref  player,
MAP map,
char *  buffer 
)

Definition at line 207 of file mech.ice.c.

References args, DOCHECK, ice_melt(), mech_parseattributes(), and Readnum.

00208 {
00209         char *args[2];
00210         int num;
00211 
00212         DOCHECK(mech_parseattributes(buffer, args, 2) != 1, "Invalid arguments!");
00213         DOCHECK(Readnum(num, args[0]), "Invalid number!");
00214         ice_melt(player, map, num);
00215 }

int meltable ( MAP map,
int  x,
int  y 
)

Definition at line 141 of file mech.ice.c.

References meltable_callback(), Number, visit_neighbor_hexes(), and watercount.

Referenced by ice_melt().

00142 {
00143         watercount = 0;
00144         visit_neighbor_hexes(map, x, y, meltable_callback);
00145 
00146         if(watercount > 4 && Number(1, 3) > 1)
00147                 return 0;
00148         return 1;
00149 }

void possibly_blow_bridge ( MECH mech,
int  weapindx,
int  x,
int  y 
)

Definition at line 229 of file mech.ice.c.

References break_sub(), BRIDGE, FindObjectsData(), GetElev, GetRTerrain, HexLOSBroadcast(), MapBridgesCS, MECH::mapindex, MechWeapons, and Number.

Referenced by hex_hit().

00230 {
00231         MAP *map = FindObjectsData(mech->mapindex);
00232 
00233         if(GetRTerrain(map, x, y) != BRIDGE)
00234                 return;
00235         if(MapBridgesCS(map))
00236                 return;
00237         if(Number(1, 10 * (1 + GetElev(map, x,
00238                                                                    y))) > MechWeapons[weapindx].damage) {
00239                 HexLOSBroadcast(map, x, y,
00240                                                 "The bridge at $H shudders from direct hit!");
00241                 return;
00242         }
00243         HexLOSBroadcast(map, x, y, "The bridge at $H is blown apart!");
00244         break_sub(map, NULL, x, y, "goes swimming as the bridge is blown apart!");
00245 }

void possibly_blow_ice ( MECH mech,
int  weapindx,
int  x,
int  y 
)

Definition at line 217 of file mech.ice.c.

References break_sub(), FindObjectsData(), GetRTerrain, HexLOSBroadcast(), ICE, MECH::mapindex, MechWeapons, and Number.

Referenced by hex_hit().

00218 {
00219         MAP *map = FindObjectsData(mech->mapindex);
00220 
00221         if(GetRTerrain(map, x, y) != ICE)
00222                 return;
00223         if(Number(1, 15) > MechWeapons[weapindx].damage)
00224                 return;
00225         HexLOSBroadcast(map, x, y, "The ice breaks from the blast!");
00226         break_sub(map, NULL, x, y, "goes swimming as ice breaks!");
00227 }

int possibly_drop_thru_ice ( MECH mech  ) 

Definition at line 104 of file mech.ice.c.

References CLASS_BSUIT, drop_thru_ice(), MechMove, MechType, MOVE_HOVER, MOVE_SUB, and Number.

Referenced by DropSetElevation(), and move_mech().

00105 {
00106         if((MechMove(mech) == MOVE_HOVER) || (MechMove(mech) == MOVE_SUB) ||
00107            (MechType(mech) == CLASS_BSUIT))
00108                 return 0;
00109         if(Number(1, 6) != 1)
00110                 return 0;
00111         drop_thru_ice(mech);
00112         return 1;
00113 }


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