This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Functions | |
void | add_mine (MAP *map, int x, int y, int dam) |
void | make_mine_explode (MECH *mech, MAP *map, mapobj *o, int x, int y, int reason) |
void | possible_mine_poof (MECH *mech, int reason) |
void | possibly_remove_mines (MECH *mech, int x, int y) |
void | recalculate_minefields (MAP *map) |
void | map_add_mine (dbref player, void *data, char *buffer) |
void | explode_mines (MECH *mech, int chn) |
void | show_mines_in_hex (dbref player, MECH *mech, float range, int x, int y) |
void add_mine | ( | MAP * | map, | |
int | x, | |||
int | y, | |||
int | dam | |||
) |
Definition at line 52 of file mine.c.
References add_mapobj(), is_mine_hex(), MAP::mapobj, MINE_STANDARD, mapobj_struct::next, TYPE_MINE, mapobj_struct::x, and mapobj_struct::y.
Referenced by artillery_hit_hex().
00053 { 00054 mapobj *o, foo; 00055 00056 if(is_mine_hex(map, x, y)) { 00057 for(o = map->mapobj[TYPE_MINE]; o; o = o->next) 00058 if(o->x == x && o->y == y) 00059 break; 00060 if(o) 00061 return; 00062 } 00063 bzero(&foo, sizeof(foo)); 00064 foo.x = x; 00065 foo.y = y; 00066 foo.datas = dam; 00067 foo.datac = MINE_STANDARD; 00068 add_mapobj(map, &map->mapobj[TYPE_MINE], &foo, 1); 00069 }
void explode_mines | ( | MECH * | mech, | |
int | chn | |||
) |
Definition at line 383 of file mine.c.
References mapobj_struct::datac, mapobj_struct::datai, getMap(), make_mine_explode(), MECH::mapindex, MAP::mapobj, MINE_COMMAND, mapobj_struct::next, recalculate_minefields(), and TYPE_MINE.
00384 { 00385 MAP *map = getMap(mech->mapindex); 00386 mapobj *o, *o2; 00387 int count = 0; 00388 00389 if(!map) 00390 return; 00391 for(o = map->mapobj[TYPE_MINE]; o; o = o2) { 00392 o2 = o->next; 00393 if(o->datac == MINE_COMMAND) 00394 if(o->datai == chn) { 00395 make_mine_explode(mech, map, o, 0, 0, 0); 00396 count++; 00397 } 00398 } 00399 if(count) 00400 recalculate_minefields(map); 00401 }
Definition at line 89 of file mine.c.
References A_AMINETRIGGER, mapobj_struct::datac, mapobj_struct::datas, did_it(), GetMechID(), HexLOSBroadcast(), mapobj_del(), mech_notify(), mech_printf(), MECHALL, MechLOSBroadcast(), MINE_COMMAND, mine_damage_mechs(), MINE_DROP, MINE_FALL, MINE_INFERNO, MINE_LAND, MINE_MIN, MINE_STANDARD, MINE_STEP, MINE_TRIGGER, MINE_VIBRA, MECH::mynum, recalculate_minefields(), SendTrigger, tprintf(), TYPE_MINE, unset_hex_mine(), update_mine(), mapobj_struct::x, and mapobj_struct::y.
Referenced by explode_mines(), and possible_mine_explosion().
00091 { 00092 int cool = (o->datas >= MINE_MIN); 00093 00094 if((o->datac == MINE_TRIGGER) 00095 && reason != MINE_STEP && reason != MINE_LAND) 00096 return; 00097 if(o->datac != MINE_TRIGGER) { 00098 if(o->datac != MINE_COMMAND) { 00099 switch (reason) { 00100 case MINE_STEP: 00101 MechLOSBroadcast(mech, 00102 tprintf 00103 ("moves to %d,%d, and triggers a mine!", x, 00104 y)); 00105 mech_printf(mech, MECHALL, 00106 "As you move to %d,%d, you trigger a mine!", x, 00107 y); 00108 break; 00109 case MINE_LAND: 00110 MechLOSBroadcast(mech, tprintf("triggers a mine!", x, y)); 00111 mech_notify(mech, MECHALL, "You trigger a mine!"); 00112 break; 00113 case MINE_DROP: 00114 case MINE_FALL: 00115 MechLOSBroadcast(mech, tprintf("triggers a mine!", x, y)); 00116 mech_notify(mech, MECHALL, "You trigger a mine!"); 00117 break; 00118 } 00119 } else 00120 HexLOSBroadcast(map, o->x, o->y, "A mine explodes in $H!"); 00121 } 00122 00123 switch (o->datac) { 00124 case MINE_STANDARD: 00125 update_mine(map, o); 00126 mine_damage_mechs(map, o->x, o->y, "A blast of shrapnel hits you!", 00127 "is hit by shrapnel!", NULL, NULL, o->datas, 0, 0); 00128 if(!cool) 00129 mapobj_del(map, o->x, o->y, TYPE_MINE); 00130 break; 00131 case MINE_INFERNO: 00132 update_mine(map, o); 00133 mine_damage_mechs(map, o->x, o->y, "Globs of flaming gel hit you!", 00134 "is hit by globs of flaming gel!", NULL, NULL, 00135 o->datas / 3, o->datas, 0); 00136 if(!cool) 00137 mapobj_del(map, o->x, o->y, TYPE_MINE); 00138 break; 00139 case MINE_COMMAND: 00140 unset_hex_mine(map, o->x, o->y); 00141 mine_damage_mechs(map, o->x, o->y, "A blast of shrapnel hits you!", 00142 "is hit by shrapnel!", 00143 "A little blast of shrapnel hits you!", 00144 "is hit by some of the shrapnel!", o->datas, 0, 1); 00145 mapobj_del(map, o->x, o->y, TYPE_MINE); 00146 break; 00147 case MINE_TRIGGER: 00148 SendTrigger(tprintf("#%d %s activated trigger at %d,%d.", 00149 mech->mynum, GetMechID(mech), o->x, o->y)); 00150 00151 // Trigger the unit's AMECHDEST attribute. 00152 if(mech->mynum > 0) 00153 did_it(mech->mynum, mech->mynum, 0, NULL, 0, NULL, A_AMINETRIGGER, (char **) NULL, 0); 00154 00155 return; 00156 case MINE_VIBRA: 00157 unset_hex_mine(map, o->x, o->y); 00158 if(o->x != x || o->y != y) 00159 HexLOSBroadcast(map, o->x, o->y, "A mine explodes in $H!"); 00160 mine_damage_mechs(map, o->x, o->y, "A blast of shrapnel hits you!", 00161 "is hit by shrapnel!", 00162 "A little blast of shrapnel hits you!", 00163 "is hit by some of the shrapnel!", o->datas, 0, 1); 00164 mapobj_del(map, o->x, o->y, TYPE_MINE); 00165 break; 00166 } 00167 recalculate_minefields(map); 00168 }
void map_add_mine | ( | dbref | player, | |
void * | data, | |||
char * | buffer | |||
) |
Definition at line 339 of file mine.c.
References add_mapobj(), args, compare_array(), DOCHECK, MAP::mapobj, mech_parseattributes(), mine_type_names, notify_printf(), READINT, recalculate_minefields(), TYPE_MINE, x, and y.
00340 { 00341 00342 char *args[6]; 00343 int argc; 00344 int x, y, str, type, extra = 0; 00345 MAP *map = (MAP *) data; 00346 mapobj foo; 00347 00348 if(!map) 00349 return; 00350 00351 #define READINT(from,to) \ 00352 DOCHECK(Readnum(to,from), "Invalid number!") 00353 00354 argc = mech_parseattributes(buffer, args, 6); 00355 DOCHECK(argc < 4 || argc > 5, "Invalid arguments!"); 00356 READINT(args[0], x); 00357 READINT(args[1], y); 00358 READINT(args[3], str); 00359 00360 if(argc == 5) 00361 READINT(args[4], extra); 00362 00363 DOCHECK((type = compare_array(mine_type_names, args[2])) < 0, 00364 "Invalid mine type!"); 00365 DOCHECK(!((x >= 0) && (x < map->map_width) && (y >= 0) && 00366 (y < map->map_height)), "X,Y out of range!"); 00367 00368 bzero(&foo, sizeof(foo)); 00369 foo.x = x; 00370 foo.y = y; 00371 foo.datai = extra; 00372 foo.datas = str; 00373 foo.datac = type + 1; 00374 foo.obj = player; 00375 add_mapobj(map, &map->mapobj[TYPE_MINE], &foo, 1); 00376 00377 notify_printf(player, 00378 "%s mine added to (%d,%d) (strength: %d / extra: %d)", 00379 mine_type_names[type], x, y, str, extra); 00380 recalculate_minefields(map); 00381 }
void possible_mine_poof | ( | MECH * | mech, | |
int | reason | |||
) |
Definition at line 246 of file mine.c.
References Elevation, getMap(), ICE, is_mine_hex(), MECH::mapindex, MechRTerrain, MechX, MechY, MechZ, possible_mine_explosion(), x, and y.
Referenced by aero_land(), LandMech(), mech_drop(), MechFalls(), and NewHexEntered().
00247 { 00248 MAP *map = getMap(mech->mapindex); 00249 int x = MechX(mech); 00250 int y = MechY(mech); 00251 00252 if(!is_mine_hex(map, x, y)) 00253 return; 00254 00255 if(MechZ(mech) > (MechRTerrain(mech) == ICE ? 0 : Elevation(map, x, y))) 00256 return; 00257 00258 possible_mine_explosion(mech, map, x, y, reason); 00259 }
void possibly_remove_mines | ( | MECH * | mech, | |
int | x, | |||
int | y | |||
) |
Definition at line 261 of file mine.c.
References FindObjectsData(), is_mine_hex(), MECH::mapindex, mapobj_del(), recalculate_minefields(), Roll(), and TYPE_MINE.
Referenced by possibly_clear().
00262 { 00263 MAP *map = FindObjectsData(mech->mapindex); 00264 00265 if(!map) 00266 return; 00267 if(!is_mine_hex(map, x, y)) 00268 return; 00269 00270 /* Do the cleaning stuff here */ 00271 00272 /* Ok, we're lazy and just decide that roll of <= 4 removes 00273 all traces of mines in the hex */ 00274 if(Roll() <= 4) { 00275 if(mapobj_del(map, x, y, TYPE_MINE)) { 00276 /* There _was_ something to clear.. no message, we're evil */ 00277 recalculate_minefields(map); 00278 } 00279 } 00280 }
void recalculate_minefields | ( | MAP * | map | ) |
Definition at line 329 of file mine.c.
References add_mine_on_map(), clear_hex_bits(), mapobj_struct::datac, mapobj_struct::datai, MAP::mapobj, mapobj_struct::next, TYPE_MINE, mapobj_struct::x, and mapobj_struct::y.
Referenced by explode_mines(), load_update3(), make_mine_explode(), map_add_mine(), and possibly_remove_mines().
00330 { 00331 mapobj *o; 00332 00333 clear_hex_bits(map, 1); 00334 for(o = map->mapobj[TYPE_MINE]; o; o = o->next) 00335 add_mine_on_map(map, o->x, o->y, o->datac, o->datai); 00336 }
Definition at line 403 of file mine.c.
References DOCHECK, getMap(), is_mine_hex(), MadePerceptionRoll(), MECH::mapindex, MAP::mapobj, mech_notify(), MECHALL, mapobj_struct::next, Number, TYPE_MINE, mapobj_struct::x, and mapobj_struct::y.
Referenced by mech_scan().
00404 { 00405 MAP *map = getMap(mech->mapindex); 00406 mapobj *o; 00407 00408 DOCHECK(!is_mine_hex(map, x, y), 00409 "You see nothing else of interest in the hex, either."); 00410 00411 for(o = map->mapobj[TYPE_MINE]; o; o = o->next) 00412 if(o->x == x && o->y == y) 00413 break; 00414 00415 DOCHECK(!o, "You see nothing else of interest in the hex, either."); 00416 DOCHECK(Number(2, 9) < ((int) range), 00417 "You see nothing else of interest in the hex, either."); 00418 DOCHECK(!MadePerceptionRoll(mech, 0), 00419 "You see nothing else of interest in the hex, either."); 00420 mech_notify(mech, MECHALL, 00421 "Small bomblets litter the hex, interesting... You vaguely " 00422 "recall them from some class or other."); 00423 }