#include <config.h>#include <math.h>#include "prototypes.h"Include dependency graph for chance.c:

Go to the source code of this file.
Functions | |
| int | chance (double d) |
| int | roll (int n) |
| int | roundavg (double val) |
Definition at line 40 of file chance.c.
References random.
Referenced by ac_dog(), ac_planedamage(), age_levels(), anti(), ask_move_in_off(), assa(), att_fight(), check_lmines(), count_sect_units(), do_evade(), fire_torp(), guerrilla(), infect_people(), intelligence_report(), launch_sat(), lnd_check_mines(), lnd_mar_one_sector(), lnd_sweep(), look_land(), move(), move_ground(), msl_hit(), multifire(), nreport(), perform_mission(), pinflak_planedamage(), plane_sweep(), player_main(), populace(), prunits(), quiet_bigdef(), rea(), retreat_land1(), retreat_ship1(), roundavg(), sabo(), satdisp_units(), satmap(), shoo(), shp_check_one_mines(), shp_sweep(), spy(), takeover(), torp(), and unitsatxy().
00041 { 00042 return d > (random() % 32768) / 32768.0; 00043 }
Definition at line 46 of file chance.c.
References random.
Referenced by ac_dog(), ac_flak_dam(), air_damage(), asw_shipsatxy(), check_lmines(), detonate(), guerrilla(), intelligence_report(), land_bomb(), lnd_support(), lnd_take_casualty(), mission_pln_sel(), msl_hit(), plane_bomb(), plane_sona(), pln_damage(), ship_bomb(), and shp_missile_defense().
00047 { 00048 return 1 + random() % n; 00049 }
Definition at line 56 of file chance.c.
References chance().
Referenced by ac_doflak(), ac_landflak(), ac_shipflak(), accrued_btus(), age_levels(), babies(), build_land(), build_plane(), build_ship(), check_market(), check_trade(), decay_fallout(), do_conv(), enli(), feed_people(), get_materials(), grow_people(), item_damage(), landrepair(), meltitems(), plane_sona(), planerepair(), populace(), produce(), roundrange(), s_commod(), shiprepair(), shoo(), spread_fallout(), status(), upd_buildeff(), and upd_ship().
00057 { 00058 double flr = floor(val); 00059 return (int)(flr + chance(val - flr)); 00060 }
Here is the call graph for this function:

1.5.2