summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2011-08-17 17:26:32 +0200
committerAdam Borowski <kilobyte@angband.pl>2011-08-17 19:44:57 +0200
commit934cc1d96b9af44bdc3c37c930b79abc519b97bf (patch)
treed677ff9d7a85f5bc0a3d1eb3352a4458be43ecab
parent865ad7c97e5620b1af0b0fbde37646a81b57b295 (diff)
downloadcrawl-ref-934cc1d96b9af44bdc3c37c930b79abc519b97bf.tar.gz
crawl-ref-934cc1d96b9af44bdc3c37c930b79abc519b97bf.zip
Make a bunch of functions static or non-existant.
-rw-r--r--crawl-ref/source/abl-show.cc28
-rw-r--r--crawl-ref/source/actor.cc5
-rw-r--r--crawl-ref/source/actor.h3
-rw-r--r--crawl-ref/source/cio.cc8
-rw-r--r--crawl-ref/source/cio.h1
-rw-r--r--crawl-ref/source/cloud.cc275
-rw-r--r--crawl-ref/source/cloud.h3
-rw-r--r--crawl-ref/source/colour.cc12
-rw-r--r--crawl-ref/source/colour.h1
-rw-r--r--crawl-ref/source/command.cc16
-rw-r--r--crawl-ref/source/coord.cc14
-rw-r--r--crawl-ref/source/coord.h2
-rw-r--r--crawl-ref/source/describe.cc37
-rw-r--r--crawl-ref/source/dgn-overview.cc63
-rw-r--r--crawl-ref/source/dgn-overview.h8
-rw-r--r--crawl-ref/source/exclude.cc10
-rw-r--r--crawl-ref/source/exclude.h1
-rw-r--r--crawl-ref/source/files.cc22
-rw-r--r--crawl-ref/source/files.h2
19 files changed, 181 insertions, 330 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc
index 982b47b631..1939565995 100644
--- a/crawl-ref/source/abl-show.cc
+++ b/crawl-ref/source/abl-show.cc
@@ -566,7 +566,7 @@ static std::string _zd_mons_description_for_ability (const ability_def &abil)
}
}
-int count_relevant_monsters(const ability_def& abil)
+static int _count_relevant_monsters(const ability_def& abil)
{
monster_type mtyp = _monster_for_ability(abil);
if (mtyp == MONS_PROGRAM_BUG)
@@ -574,7 +574,7 @@ int count_relevant_monsters(const ability_def& abil)
return count_monsters(mtyp, true); // Friendly ones only
}
-trap_type trap_for_ability(const ability_def& abil)
+static trap_type _trap_for_ability(const ability_def& abil)
{
switch (abil.ability)
{
@@ -595,7 +595,7 @@ trap_type trap_for_ability(const ability_def& abil)
// Scale the zp cost by the number of friendly monsters
// of that type. Each successive critter costs 20% more
// than the last one, after the first two.
-int zp_cost(const ability_def& abil)
+static int _zp_cost(const ability_def& abil)
{
int cost = abil.zp_cost;
int scale10 = 0; // number of times to scale up by 10%
@@ -614,7 +614,7 @@ int zp_cost(const ability_def& abil)
case ABIL_MAKE_OKLOB_CIRCLE:
case ABIL_MAKE_BURNING_BUSH:
case ABIL_MAKE_LIGHTNING_SPIRE:
- num = count_relevant_monsters(abil);
+ num = _count_relevant_monsters(abil);
// special case for oklob circles
if (abil.ability == ABIL_MAKE_OKLOB_CIRCLE)
num /= 3;
@@ -633,14 +633,14 @@ int zp_cost(const ability_def& abil)
// Monster type 2: less generous
case ABIL_MAKE_ICE_STATUE:
case ABIL_MAKE_OCS:
- num = count_relevant_monsters(abil);
+ num = _count_relevant_monsters(abil);
num -= 2; // first two are base cost
scale20 = std::max(num, 0); // after first two, 20% increment
// Monster type 3: least generous
case ABIL_MAKE_SILVER_STATUE:
case ABIL_MAKE_CURSE_SKULL:
- scale20 = count_relevant_monsters(abil); // scale immediately
+ scale20 = _count_relevant_monsters(abil); // scale immediately
// Simple Traps
case ABIL_MAKE_DART_TRAP:
@@ -654,7 +654,7 @@ int zp_cost(const ability_def& abil)
case ABIL_MAKE_NEEDLE_TRAP:
case ABIL_MAKE_NET_TRAP:
case ABIL_MAKE_ALARM_TRAP:
- num = count_traps(trap_for_ability(abil));
+ num = count_traps(_trap_for_ability(abil));
scale10 = std::max(num-5, 0); // First 5 at base cost
break;
@@ -704,7 +704,7 @@ const std::string make_cost_description(ability_type ability)
if (!ret.str().empty())
ret << ", ";
- ret << zp_cost(abil);
+ ret << _zp_cost(abil);
ret << " ZP";
}
@@ -820,7 +820,7 @@ static std::string _get_piety_amount_str(int value)
"small");
}
-const std::string make_detailed_cost_description(ability_type ability)
+static const std::string _detailed_cost_description(ability_type ability)
{
const ability_def& abil = _get_ability_def(ability);
std::ostringstream ret;
@@ -1315,10 +1315,8 @@ static void _print_talent_description(const talent& tal)
cprintf("No description found.");
else
{
- std::ostringstream data;
- data << name << "\n\n" << lookup << "\n";
- data << make_detailed_cost_description(tal.which);
- print_description(data.str());
+ print_description(name + "\n\n" + lookup + "\n"
+ + _detailed_cost_description(tal.which));
}
getchm();
clrscr();
@@ -1665,7 +1663,7 @@ static bool _activate_talent(const talent& tal)
return (false);
}
- int zpcost = zp_cost(abil);
+ int zpcost = _zp_cost(abil);
if (zpcost)
{
if (!enough_zp(zpcost, false))
@@ -1794,7 +1792,7 @@ static bool _do_ability(const ability_def& abil)
case ABIL_MAKE_NET_TRAP:
case ABIL_MAKE_ALARM_TRAP:
case ABIL_MAKE_BLADE_TRAP:
- if (!create_trap(trap_for_ability(abil)))
+ if (!create_trap(_trap_for_ability(abil)))
return false;
break;
// End ZotDef traps
diff --git a/crawl-ref/source/actor.cc b/crawl-ref/source/actor.cc
index 0954f6b173..631f669002 100644
--- a/crawl-ref/source/actor.cc
+++ b/crawl-ref/source/actor.cc
@@ -229,11 +229,6 @@ int actor::body_weight(bool base) const
}
}
-kill_category actor_kill_alignment(const actor *act)
-{
- return (act? act->kill_alignment() : KC_OTHER);
-}
-
bool actor_slime_wall_immune(const actor *act)
{
return (act->atype() == ACT_PLAYER?
diff --git a/crawl-ref/source/actor.h b/crawl-ref/source/actor.h
index 7a0cfbede7..e82b639cda 100644
--- a/crawl-ref/source/actor.h
+++ b/crawl-ref/source/actor.h
@@ -326,9 +326,6 @@ protected:
los_glob los_no_trans;
};
-// Identical to actor->kill_alignment(), but returns KC_OTHER if the actor
-// is NULL.
-kill_category actor_kill_alignment(const actor *actor);
bool actor_slime_wall_immune(const actor *actor);
#endif
diff --git a/crawl-ref/source/cio.cc b/crawl-ref/source/cio.cc
index 954fc6e021..be249d9928 100644
--- a/crawl-ref/source/cio.cc
+++ b/crawl-ref/source/cio.cc
@@ -135,7 +135,7 @@ void nowrap_eol_cprintf(const char *s, ...)
}
// cprintf that knows how to wrap down lines
-void wrapcprintf(int wrapcol, const char *s, ...)
+static void wrapcprintf(int wrapcol, const char *s, ...)
{
va_list args;
va_start(args, s);
@@ -600,12 +600,6 @@ int line_reader::process_key(int ch)
static std::queue<c_mouse_event> mouse_events;
-coord_def get_mouse_pos()
-{
- // lib$(OS) has to maintain mousep. This function is just the messenger.
- return (crawl_view.mousep);
-}
-
c_mouse_event get_mouse_event()
{
if (mouse_events.empty())
diff --git a/crawl-ref/source/cio.h b/crawl-ref/source/cio.h
index 445a7d8d44..4d90190cdc 100644
--- a/crawl-ref/source/cio.h
+++ b/crawl-ref/source/cio.h
@@ -127,7 +127,6 @@ struct c_mouse_event
}
};
-coord_def get_mouse_pos();
c_mouse_event get_mouse_event();
void new_mouse_event(const c_mouse_event &ce);
void c_input_reset(bool enable_mouse, bool flush = false);
diff --git a/crawl-ref/source/cloud.cc b/crawl-ref/source/cloud.cc
index c19049b5ea..ad1553f220 100644
--- a/crawl-ref/source/cloud.cc
+++ b/crawl-ref/source/cloud.cc
@@ -61,6 +61,85 @@ static int _actual_spread_rate(cloud_type type, int spread_rate)
}
}
+cloud_type beam2cloud(beam_type flavour)
+{
+ switch (flavour)
+ {
+ default:
+ case BEAM_NONE:
+ return CLOUD_NONE;
+ case BEAM_FIRE:
+ case BEAM_POTION_FIRE:
+ return CLOUD_FIRE;
+ case BEAM_POTION_STINKING_CLOUD:
+ return CLOUD_STINK;
+ case BEAM_COLD:
+ case BEAM_POTION_COLD:
+ return CLOUD_COLD;
+ case BEAM_POISON:
+ case BEAM_POTION_POISON:
+ return CLOUD_POISON;
+ case BEAM_POTION_BLACK_SMOKE:
+ return CLOUD_BLACK_SMOKE;
+ case BEAM_POTION_GREY_SMOKE:
+ return CLOUD_GREY_SMOKE;
+ case BEAM_POTION_BLUE_SMOKE:
+ return CLOUD_BLUE_SMOKE;
+ case BEAM_POTION_PURPLE_SMOKE:
+ return CLOUD_PURPLE_SMOKE;
+ case BEAM_STEAM:
+ case BEAM_POTION_STEAM:
+ return CLOUD_STEAM;
+ case BEAM_MIASMA:
+ case BEAM_POTION_MIASMA:
+ return CLOUD_MIASMA;
+ case BEAM_CHAOS:
+ return CLOUD_CHAOS;
+ case BEAM_POTION_RAIN:
+ return CLOUD_RAIN;
+ case BEAM_POTION_MUTAGENIC:
+ return CLOUD_MUTAGENIC;
+ case BEAM_GLOOM:
+ return CLOUD_GLOOM;
+ case BEAM_RANDOM:
+ return CLOUD_RANDOM;
+ case BEAM_INK:
+ return CLOUD_INK;
+ case BEAM_HOLY_FLAME:
+ return CLOUD_HOLY_FLAMES;
+ case BEAM_PETRIFYING_CLOUD:
+ return CLOUD_PETRIFY;
+ }
+}
+
+static beam_type _cloud2beam(cloud_type flavour)
+{
+ switch (flavour)
+ {
+ default:
+ case CLOUD_NONE: return BEAM_NONE;
+ case CLOUD_FIRE: return BEAM_FIRE;
+ case CLOUD_FOREST_FIRE: return BEAM_FIRE;
+ case CLOUD_STINK: return BEAM_POTION_STINKING_CLOUD;
+ case CLOUD_COLD: return BEAM_COLD;
+ case CLOUD_POISON: return BEAM_POISON;
+ case CLOUD_BLACK_SMOKE: return BEAM_POTION_BLACK_SMOKE;
+ case CLOUD_GREY_SMOKE: return BEAM_POTION_GREY_SMOKE;
+ case CLOUD_BLUE_SMOKE: return BEAM_POTION_BLUE_SMOKE;
+ case CLOUD_PURPLE_SMOKE: return BEAM_POTION_PURPLE_SMOKE;
+ case CLOUD_STEAM: return BEAM_STEAM;
+ case CLOUD_MIASMA: return BEAM_MIASMA;
+ case CLOUD_CHAOS: return BEAM_CHAOS;
+ case CLOUD_RAIN: return BEAM_POTION_RAIN;
+ case CLOUD_MUTAGENIC: return BEAM_POTION_MUTAGENIC;
+ case CLOUD_GLOOM: return BEAM_GLOOM;
+ case CLOUD_INK: return BEAM_INK;
+ case CLOUD_HOLY_FLAMES: return BEAM_HOLY_FLAME;
+ case CLOUD_PETRIFY: return BEAM_PETRIFYING_CLOUD;
+ case CLOUD_RANDOM: return BEAM_RANDOM;
+ }
+}
+
#ifdef ASSERTS
static bool _killer_whose_match(kill_category whose, killer_type killer)
{
@@ -228,28 +307,25 @@ static void _spread_fire(const cloud_struct &cloud)
}
}
-static void _cloud_fire_interacts_with_terrain(const cloud_struct &cloud)
+static void _cloud_interacts_with_terrain(const cloud_struct &cloud)
{
- for (adjacent_iterator ai(cloud.pos); ai; ++ai)
+ if (cloud.type == CLOUD_FIRE || cloud.type == CLOUD_FOREST_FIRE)
{
- const coord_def p(*ai);
- if (in_bounds(p)
- && feat_is_watery(grd(p))
- && env.cgrid(p) == EMPTY_CLOUD
- && one_chance_in(5))
+ for (adjacent_iterator ai(cloud.pos); ai; ++ai)
{
- _place_new_cloud(CLOUD_STEAM, p, cloud.decay / 2 + 1,
- cloud.whose, cloud.killer, cloud.source);
+ const coord_def p(*ai);
+ if (in_bounds(p)
+ && feat_is_watery(grd(p))
+ && env.cgrid(p) == EMPTY_CLOUD
+ && one_chance_in(5))
+ {
+ _place_new_cloud(CLOUD_STEAM, p, cloud.decay / 2 + 1,
+ cloud.whose, cloud.killer, cloud.source);
+ }
}
}
}
-void cloud_interacts_with_terrain(const cloud_struct &cloud)
-{
- if (cloud.type == CLOUD_FIRE || cloud.type == CLOUD_FOREST_FIRE)
- _cloud_fire_interacts_with_terrain(cloud);
-}
-
static void _dissipate_cloud(int cloudidx, int dissipate)
{
cloud_struct &cloud = env.cloud[cloudidx];
@@ -307,8 +383,8 @@ void manage_clouds()
dissipate /= 20;
}
- cloud_interacts_with_terrain(cloud);
- expose_items_to_element(cloud2beam(cloud.type), cloud.pos, 2);
+ _cloud_interacts_with_terrain(cloud);
+ expose_items_to_element(_cloud2beam(cloud.type), cloud.pos, 2);
_dissipate_cloud(i, dissipate);
}
@@ -456,12 +532,7 @@ void check_place_cloud(cloud_type cl_type, const coord_def& p, int lifetime,
place_cloud(cl_type, p, lifetime, agent, spread_rate, colour, name, tile);
}
-int steam_cloud_damage(const cloud_struct &cloud)
-{
- return steam_cloud_damage(cloud.decay);
-}
-
-int steam_cloud_damage(int decay)
+static int _steam_cloud_damage(int decay)
{
decay = std::min(decay, 60);
decay = std::max(decay, 10);
@@ -615,85 +686,6 @@ cloud_type random_smoke_type()
return CLOUD_DEBUGGING;
}
-cloud_type beam2cloud(beam_type flavour)
-{
- switch (flavour)
- {
- default:
- case BEAM_NONE:
- return CLOUD_NONE;
- case BEAM_FIRE:
- case BEAM_POTION_FIRE:
- return CLOUD_FIRE;
- case BEAM_POTION_STINKING_CLOUD:
- return CLOUD_STINK;
- case BEAM_COLD:
- case BEAM_POTION_COLD:
- return CLOUD_COLD;
- case BEAM_POISON:
- case BEAM_POTION_POISON:
- return CLOUD_POISON;
- case BEAM_POTION_BLACK_SMOKE:
- return CLOUD_BLACK_SMOKE;
- case BEAM_POTION_GREY_SMOKE:
- return CLOUD_GREY_SMOKE;
- case BEAM_POTION_BLUE_SMOKE:
- return CLOUD_BLUE_SMOKE;
- case BEAM_POTION_PURPLE_SMOKE:
- return CLOUD_PURPLE_SMOKE;
- case BEAM_STEAM:
- case BEAM_POTION_STEAM:
- return CLOUD_STEAM;
- case BEAM_MIASMA:
- case BEAM_POTION_MIASMA:
- return CLOUD_MIASMA;
- case BEAM_CHAOS:
- return CLOUD_CHAOS;
- case BEAM_POTION_RAIN:
- return CLOUD_RAIN;
- case BEAM_POTION_MUTAGENIC:
- return CLOUD_MUTAGENIC;
- case BEAM_GLOOM:
- return CLOUD_GLOOM;
- case BEAM_RANDOM:
- return CLOUD_RANDOM;
- case BEAM_INK:
- return CLOUD_INK;
- case BEAM_HOLY_FLAME:
- return CLOUD_HOLY_FLAMES;
- case BEAM_PETRIFYING_CLOUD:
- return CLOUD_PETRIFY;
- }
-}
-
-beam_type cloud2beam(cloud_type flavour)
-{
- switch (flavour)
- {
- default:
- case CLOUD_NONE: return BEAM_NONE;
- case CLOUD_FIRE: return BEAM_FIRE;
- case CLOUD_FOREST_FIRE: return BEAM_FIRE;
- case CLOUD_STINK: return BEAM_POTION_STINKING_CLOUD;
- case CLOUD_COLD: return BEAM_COLD;
- case CLOUD_POISON: return BEAM_POISON;
- case CLOUD_BLACK_SMOKE: return BEAM_POTION_BLACK_SMOKE;
- case CLOUD_GREY_SMOKE: return BEAM_POTION_GREY_SMOKE;
- case CLOUD_BLUE_SMOKE: return BEAM_POTION_BLUE_SMOKE;
- case CLOUD_PURPLE_SMOKE: return BEAM_POTION_PURPLE_SMOKE;
- case CLOUD_STEAM: return BEAM_STEAM;
- case CLOUD_MIASMA: return BEAM_MIASMA;
- case CLOUD_CHAOS: return BEAM_CHAOS;
- case CLOUD_RAIN: return BEAM_POTION_RAIN;
- case CLOUD_MUTAGENIC: return BEAM_POTION_MUTAGENIC;
- case CLOUD_GLOOM: return BEAM_GLOOM;
- case CLOUD_INK: return BEAM_INK;
- case CLOUD_HOLY_FLAMES: return BEAM_HOLY_FLAME;
- case CLOUD_PETRIFY: return BEAM_PETRIFYING_CLOUD;
- case CLOUD_RANDOM: return BEAM_RANDOM;
- }
-}
-
// Returns by how much damage gets divided due to elemental resistances.
// Damage is reduced to, level 1 -> 1/2, level 2 -> 1/3, level 3 -> 1/5, or
// for "boolean" attacks (which use bonus_res = 1, sticky flame/electricity)
@@ -715,7 +707,7 @@ int max_cloud_damage(cloud_type cl_type, int power)
// Returns true if the cloud type has negative side effects beyond
// plain damage and inventory destruction effects.
-bool cloud_has_negative_side_effects(cloud_type cloud)
+static bool _cloud_has_negative_side_effects(cloud_type cloud)
{
switch (cloud)
{
@@ -747,7 +739,7 @@ static int _cloud_base_damage(const actor *act,
switch (cloud.type)
{
case CLOUD_RAIN:
- // Only applies to fiery actors: see actor_cloud_resist.
+ // Only applies to fiery actors: see _actor_cloud_resist.
return _cloud_damage_calc(9, 1, 0, maximum_damage);
case CLOUD_FIRE:
case CLOUD_FOREST_FIRE:
@@ -770,7 +762,7 @@ static int _cloud_base_damage(const actor *act,
case CLOUD_MIASMA:
return _cloud_damage_calc(12, 3, 0, maximum_damage);
case CLOUD_STEAM:
- return _cloud_damage_calc(steam_cloud_damage(cloud), 2, 0,
+ return _cloud_damage_calc(_steam_cloud_damage(cloud.decay), 2, 0,
maximum_damage);
default:
return 0;
@@ -821,7 +813,7 @@ static bool _actor_cloud_immune(const actor *act, const cloud_struct &cloud)
// Returns a numeric resistance value for the actor's resistance to
// the cloud's effects. If the actor is immune to the cloud's damage,
// returns MAG_IMMUNE.
-int actor_cloud_resist(const actor *act, const cloud_struct &cloud)
+static int _actor_cloud_resist(const actor *act, const cloud_struct &cloud)
{
if (_actor_cloud_immune(act, cloud))
return MAG_IMMUNE;
@@ -1061,7 +1053,7 @@ static int _actor_cloud_damage(actor *act,
const cloud_struct &cloud,
bool maximum_damage)
{
- const int resist = actor_cloud_resist(act, cloud);
+ const int resist = _actor_cloud_resist(act, cloud);
const int cloud_base_damage = _actor_cloud_base_damage(act, cloud,
resist,
maximum_damage);
@@ -1075,7 +1067,7 @@ static int _actor_cloud_damage(actor *act,
case CLOUD_COLD:
case CLOUD_STEAM:
final_damage =
- _cloud_damage_output(act, cloud2beam(cloud.type), resist,
+ _cloud_damage_output(act, _cloud2beam(cloud.type), resist,
cloud_base_damage,
maximum_damage);
break;
@@ -1106,14 +1098,14 @@ int actor_apply_cloud(actor *act)
if (_actor_cloud_immune(act, cloud))
return 0;
- const int resist = actor_cloud_resist(act, cloud);
+ const int resist = _actor_cloud_resist(act, cloud);
const int cloud_max_base_damage =
_actor_cloud_base_damage(act, cloud, resist, true);
const int final_damage = _actor_cloud_damage(act, cloud, false);
- const beam_type cloud_flavour = cloud2beam(cloud.type);
+ const beam_type cloud_flavour = _cloud2beam(cloud.type);
if (player || final_damage > 0
- || cloud_has_negative_side_effects(cloud.type))
+ || _cloud_has_negative_side_effects(cloud.type))
{
cloud.announce_actor_engulfed(act);
}
@@ -1154,7 +1146,7 @@ static bool _cloud_is_harmful(actor *act, cloud_struct &cloud,
int maximum_negligible_damage)
{
return (!_actor_cloud_immune(act, cloud)
- && (cloud_has_negative_side_effects(cloud.type)
+ && (_cloud_has_negative_side_effects(cloud.type)
|| (_actor_cloud_damage(act, cloud, true) >
maximum_negligible_damage)));
}
@@ -1179,7 +1171,9 @@ bool is_damaging_cloud(cloud_type type, bool accept_temp_resistances)
}
}
-bool cloud_is_smoke(cloud_type type)
+// Is the cloud purely cosmetic with no gameplay effect? If so, <foo>
+// is engulfed in <cloud> messages will be suppressed.
+static bool _cloud_is_cosmetic(cloud_type type)
{
switch (type)
{
@@ -1187,19 +1181,13 @@ bool cloud_is_smoke(cloud_type type)
case CLOUD_GREY_SMOKE:
case CLOUD_BLUE_SMOKE:
case CLOUD_PURPLE_SMOKE:
+ case CLOUD_MIST:
return true;
default:
return false;
}
}
-// Is the cloud purely cosmetic with no gameplay effect? If so, <foo>
-// is engulfed in <cloud> messages will be suppressed.
-bool cloud_is_cosmetic(cloud_type type)
-{
- return (type == CLOUD_MIST || cloud_is_smoke(type));
-}
-
bool is_harmless_cloud(cloud_type type)
{
switch (type)
@@ -1212,7 +1200,7 @@ bool is_harmless_cloud(cloud_type type)
case CLOUD_DEBUGGING:
return (true);
default:
- return (cloud_is_cosmetic(type));
+ return (_cloud_is_cosmetic(type));
}
}
@@ -1354,7 +1342,7 @@ std::string cloud_struct::cloud_name(const std::string &defname,
void cloud_struct::announce_actor_engulfed(const actor *act,
bool beneficial) const
{
- if (cloud_is_cosmetic(type))
+ if (_cloud_is_cosmetic(type))
return;
if (you.can_see(act))
@@ -1575,11 +1563,8 @@ int num_fogs_for_place(int level_number, const level_id &place)
return branch.num_fogs_function(level_number);
}
case LEVEL_ABYSS:
- return fogs_abyss_number(level_number);
case LEVEL_PANDEMONIUM:
- return fogs_pan_number(level_number);
case LEVEL_LABYRINTH:
- return fogs_lab_number(level_number);
default:
return 0;
}
@@ -1605,48 +1590,10 @@ fog_machine_data random_fog_for_place(int level_number, const level_id &place)
return data;
}
case LEVEL_ABYSS:
- return fogs_abyss_type(level_number);
case LEVEL_PANDEMONIUM:
- return fogs_pan_type(level_number);
case LEVEL_LABYRINTH:
- return fogs_lab_type(level_number);
+ return data;
default:
die("fog type not assigned");
}
}
-
-int fogs_pan_number(int level_number)
-{
- return 0;
-}
-
-fog_machine_data fogs_pan_type(int level_number)
-{
- fog_machine_data data = {NUM_FOG_MACHINE_TYPES, CLOUD_NONE, -1, -1};
-
- return data;
-}
-
-int fogs_abyss_number(int level_number)
-{
- return 0;
-}
-
-fog_machine_data fogs_abyss_type(int level_number)
-{
- fog_machine_data data = {NUM_FOG_MACHINE_TYPES, CLOUD_NONE, -1, -1};
-
- return data;
-}
-
-int fogs_lab_number(int level_number)
-{
- return 0;
-}
-
-fog_machine_data fogs_lab_type(int level_number)
-{
- fog_machine_data data = {NUM_FOG_MACHINE_TYPES, CLOUD_NONE, -1, -1};
-
- return data;
-}
diff --git a/crawl-ref/source/cloud.h b/crawl-ref/source/cloud.h
index 1740cc1858..ee8142e524 100644
--- a/crawl-ref/source/cloud.h
+++ b/crawl-ref/source/cloud.h
@@ -47,11 +47,8 @@ void place_cloud(cloud_type cl_type, const coord_def& ctarget,
void manage_clouds(void);
bool is_opaque_cloud(int cloud_idx);
-int steam_cloud_damage(const cloud_struct &cloud);
-int steam_cloud_damage(int decay);
cloud_type beam2cloud(beam_type flavour);
-beam_type cloud2beam(cloud_type flavour);
int resist_fraction(int resist, int bonus_res = 0);
int max_cloud_damage(cloud_type cl_type, int power = -1);
diff --git a/crawl-ref/source/colour.cc b/crawl-ref/source/colour.cc
index 88f464d6ad..02ba7cced2 100644
--- a/crawl-ref/source/colour.cc
+++ b/crawl-ref/source/colour.cc
@@ -104,10 +104,12 @@ uint8_t make_high_colour(uint8_t colour)
}
// returns if a colour is one of the special element colours (ie not regular)
-bool is_element_colour(int col)
+static bool _is_element_colour(int col)
{
// stripping any COLFLAGS (just in case)
- return ((col & 0x007f) >= ETC_FIRE);
+ col = col & 0x007f;
+ ASSERT(col < NUM_COLOURS);
+ return (col >= ETC_FIRE);
}
static int _randomized_element_colour(int rand, const coord_def&,
@@ -564,7 +566,7 @@ void clear_colours_on_exit()
int element_colour(int element, bool no_random, const coord_def& loc)
{
// pass regular colours through for safety.
- if (!is_element_colour(element))
+ if (!_is_element_colour(element))
return (element);
// Strip COLFLAGs just in case.
@@ -573,7 +575,7 @@ int element_colour(int element, bool no_random, const coord_def& loc)
ASSERT(element_colours[element]);
int ret = element_colours[element]->get(loc, no_random);
- ASSERT(!is_element_colour(ret));
+ ASSERT(!_is_element_colour(ret));
return ((ret == BLACK) ? GREEN : ret);
}
@@ -783,7 +785,7 @@ unsigned real_colour(unsigned raw_colour, const coord_def& loc)
const int colflags = raw_colour & 0xFF00;
// Evaluate any elemental colours to guarantee vanilla colour is returned
- if (is_element_colour(raw_colour))
+ if (_is_element_colour(raw_colour))
raw_colour = colflags | element_colour(raw_colour, false, loc);
#if defined(TARGET_OS_WINDOWS) || defined(USE_TILE)
diff --git a/crawl-ref/source/colour.h b/crawl-ref/source/colour.h
index 7f4641ee55..08497fdeae 100644
--- a/crawl-ref/source/colour.h
+++ b/crawl-ref/source/colour.h
@@ -102,7 +102,6 @@ bool is_low_colour(uint8_t colour);
bool is_high_colour(uint8_t colour);
uint8_t make_low_colour(uint8_t colour);
uint8_t make_high_colour(uint8_t colour);
-bool is_element_colour(int col);
int element_colour(int element, bool no_random = false,
const coord_def& loc = coord_def());
bool get_tornado_phase(const coord_def& loc);
diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc
index cb9305c2e6..eea7e0ef64 100644
--- a/crawl-ref/source/command.cc
+++ b/crawl-ref/source/command.cc
@@ -2096,7 +2096,7 @@ static int _show_keyhelp_menu(const std::vector<formatted_string> &lines,
return cmd_help.getkey();
}
-void show_specific_help(const std::string &help)
+static void _show_specific_help(const std::string &help)
{
std::vector<std::string> lines = split_string("\n", help, false, true);
std::vector<formatted_string> formatted_lines;
@@ -2111,12 +2111,12 @@ void show_specific_help(const std::string &help)
void show_levelmap_help()
{
- show_specific_help(getHelpString("level-map"));
+ _show_specific_help(getHelpString("level-map"));
}
void show_pickup_menu_help()
{
- show_specific_help(getHelpString("pick-up"));
+ _show_specific_help(getHelpString("pick-up"));
}
void show_targeting_help()
@@ -2131,27 +2131,27 @@ void show_targeting_help()
}
void show_interlevel_travel_branch_help()
{
- show_specific_help(getHelpString("interlevel-travel.branch.prompt"));
+ _show_specific_help(getHelpString("interlevel-travel.branch.prompt"));
}
void show_interlevel_travel_depth_help()
{
- show_specific_help(getHelpString("interlevel-travel.depth.prompt"));
+ _show_specific_help(getHelpString("interlevel-travel.depth.prompt"));
}
void show_stash_search_help()
{
- show_specific_help(getHelpString("stash-search.prompt"));
+ _show_specific_help(getHelpString("stash-search.prompt"));
}
void show_butchering_help()
{
- show_specific_help(getHelpString("butchering"));
+ _show_specific_help(getHelpString("butchering"));
}
void show_skill_menu_help()
{
- show_specific_help(getHelpString("skill-menu"));
+ _show_specific_help(getHelpString("skill-menu"));
}
static void _add_command(column_composer &cols, const int column,
diff --git a/crawl-ref/source/coord.cc b/crawl-ref/source/coord.cc
index 0507ab6732..f9537a6213 100644
--- a/crawl-ref/source/coord.cc
+++ b/crawl-ref/source/coord.cc
@@ -41,17 +41,7 @@ bool in_bounds_y(int y)
// Returns true if inside the area the player can move and dig (ie exclusive).
bool in_bounds(int x, int y)
{
- return (in_bounds_x(x) && in_bounds_y(y));
-}
-
-bool map_bounds_x(int x)
-{
- return (x >= X_BOUND_1 && x <= X_BOUND_2);
-}
-
-bool map_bounds_y(int y)
-{
- return (y >= Y_BOUND_1 && y <= Y_BOUND_2);
+ return (x > X_BOUND_1 && x < X_BOUND_2 && y > Y_BOUND_1 && y < Y_BOUND_2);
}
// Returns true if inside the area the player can map (ie inclusive).
@@ -59,7 +49,7 @@ bool map_bounds_y(int y)
// ring of rock to frame the level.
bool map_bounds(int x, int y)
{
- return (map_bounds_x(x) && map_bounds_y(y));
+ return (x >= X_BOUND_1 && x <= X_BOUND_2 && y >= Y_BOUND_1 && y <= Y_BOUND_2);
}
bool map_bounds_with_margin(coord_def p, int margin)
diff --git a/crawl-ref/source/coord.h b/crawl-ref/source/coord.h
index be4a8ed7ff..f8171bd9e8 100644
--- a/crawl-ref/source/coord.h
+++ b/crawl-ref/source/coord.h
@@ -4,8 +4,6 @@
bool in_bounds_x(int x);
bool in_bounds_y(int y);
bool in_bounds(int x, int y);
-bool map_bounds_x(int x);
-bool map_bounds_y(int y);
bool map_bounds(int x, int y);
coord_def random_in_bounds();
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index 1211ac8fcf..7fa188fd50 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -161,7 +161,7 @@ void print_quote (const describe_info &inf)
process_quote<default_desc_proc>(proc, inf);
}
-const char* jewellery_base_ability_string(int subtype)
+static const char* _jewellery_base_ability_string(int subtype)
{
switch (subtype)
{
@@ -255,8 +255,8 @@ static std::vector<std::string> _randart_propnames(const item_def& item,
if (item.base_type == OBJ_JEWELLERY
&& item_ident(item, ISFLAG_KNOW_PROPERTIES))
{
- const std::string type = jewellery_base_ability_string(item.sub_type);
- if (!type.empty())
+ const char* type = _jewellery_base_ability_string(item.sub_type);
+ if (type)
propnames.push_back(type);
}
else if (item_ident(item, ISFLAG_KNOW_TYPE)
@@ -3837,18 +3837,6 @@ static bool _print_god_abil_desc(int god, int numpower)
return (true);
}
-static const std::string _describe_favour_generic(god_type which_god)
-{
- const std::string godname = god_name(which_god);
- return (you.piety > 130) ? "A prized avatar of " + godname + ".":
- (you.piety > 100) ? "A shining star in the eyes of " + godname + "." :
- (you.piety > 70) ? "A rising star in the eyes of " + godname + "." :
- (you.piety > 40) ? godname + " is most pleased with you." :
- (you.piety > 20) ? godname + " has noted your presence." :
- (you.piety > 5) ? godname + " is noncommittal."
- : "You are beneath notice.";
-}
-
//---------------------------------------------------------------
//
// describe_god
@@ -3857,7 +3845,7 @@ static const std::string _describe_favour_generic(god_type which_god)
//
//---------------------------------------------------------------
-std::string describe_favour(god_type which_god)
+static std::string _describe_favour(god_type which_god)
{
if (player_under_penance())
{
@@ -3868,8 +3856,17 @@ std::string describe_favour(god_type which_god)
: "You should show more discipline.";
}
- return (which_god == GOD_XOM) ? describe_xom_favour(true)
- : _describe_favour_generic(which_god);
+ if (which_god == GOD_XOM)
+ return describe_xom_favour(true);
+
+ const std::string godname = god_name(which_god);
+ return (you.piety > 130) ? "A prized avatar of " + godname + ".":
+ (you.piety > 100) ? "A shining star in the eyes of " + godname + "." :
+ (you.piety > 70) ? "A rising star in the eyes of " + godname + "." :
+ (you.piety > 40) ? godname + " is most pleased with you." :
+ (you.piety > 20) ? godname + " has noted your presence." :
+ (you.piety > 5) ? godname + " is noncommittal."
+ : "You are beneath notice.";
}
static std::string _religion_help(god_type god)
@@ -4099,7 +4096,7 @@ std::string god_title(god_type which_god, species_type which_species)
return (title);
}
-std::string _describe_ash_skill_boost()
+static std::string _describe_ash_skill_boost()
{
if (!you.bondage_level)
{
@@ -4415,7 +4412,7 @@ void describe_god(god_type which_god, bool give_title)
}
else
{
- cprintf(describe_favour(which_god).c_str());
+ cprintf(_describe_favour(which_god).c_str());
if (which_god == GOD_ASHENZARI)
cprintf("\n%s", ash_describe_bondage(ETF_ALL, true).c_str());
diff --git a/crawl-ref/source/dgn-overview.cc b/crawl-ref/source/dgn-overview.cc
index 169e986be2..ebeff52658 100644
--- a/crawl-ref/source/dgn-overview.cc
+++ b/crawl-ref/source/dgn-overview.cc
@@ -66,6 +66,7 @@ static std::string _get_portals();
static std::string _get_notes();
static std::string _print_altars_for_gods(const std::vector<god_type>& gods,
bool print_unseen, bool display);
+static const std::string _get_coloured_level_annotation(int col, level_id li);
void overview_clear()
{
@@ -717,9 +718,9 @@ static std::string _get_notes()
disp += depth_str;
disp += " ";
if (level_annotation_has("!", li))
- disp += get_coloured_level_annotation(LIGHTRED, li);
+ disp += _get_coloured_level_annotation(LIGHTRED, li);
else
- disp += get_coloured_level_annotation(LIGHTMAGENTA, li);
+ disp += _get_coloured_level_annotation(LIGHTMAGENTA, li);
disp += "\n";
}
}
@@ -831,15 +832,7 @@ static void _seen_altar(god_type god, const coord_def& pos)
altars_present[where] = god;
}
-void unnotice_altar()
-{
- const level_pos curpos(level_id::current(), you.pos());
- // Hmm, what happens when erasing a nonexistent key directly?
- if (altars_present.find(curpos) != altars_present.end())
- altars_present.erase(curpos);
-}
-
-portal_type feature_to_portal(dungeon_feature_type feat)
+static portal_type _feature_to_portal(dungeon_feature_type feat)
{
switch (feat)
{
@@ -915,7 +908,7 @@ static void _seen_other_thing(dungeon_feature_type which_thing,
}
default:
- const portal_type portal = feature_to_portal(which_thing);
+ const portal_type portal = _feature_to_portal(which_thing);
if (portal != PORTAL_NONE)
portals_present[where] = portal;
break;
@@ -927,17 +920,9 @@ static void _seen_other_thing(dungeon_feature_type which_thing,
void set_level_annotation(std::string str, level_id li)
{
if (str.empty())
- {
- clear_level_annotation(li);
- return;
- }
-
- level_annotations[li] = str;
-}
-
-void clear_level_annotation(level_id li)
-{
- level_annotations.erase(li);
+ level_annotations.erase(li);
+ else
+ level_annotations[li] = str;
}
void set_level_exclusion_annotation(std::string str, level_id li)
@@ -981,18 +966,9 @@ std::string get_level_annotation(level_id li, bool skip_excl)
return (i->second + ", " + j->second);
}
-std::string get_coloured_level_annotation(int col, level_id li, bool skip_excl)
+static const std::string _get_coloured_level_annotation(int col, level_id li)
{
annotation_map_type::const_iterator i = level_annotations.find(li);
-
- if (skip_excl)
- {
- if (i == level_annotations.end())
- return "";
-
- return (colour_string(i->second, col));
- }
-
annotation_map_type::const_iterator j = level_exclusions.find(li);
if (i == level_annotations.end() && j == level_exclusions.end())
@@ -1054,20 +1030,13 @@ void annotate_level()
if (msgwin_get_line_autohist(prompt, buf, sizeof(buf)))
return;
- if (buf[0] == 0)
+ if (*buf)
+ level_annotations[li] = buf;
+ else if (get_level_annotation(li, true).empty())
+ canned_msg(MSG_OK);
+ else if (yesno("Really clear the annotation?", true, 'n'))
{
- if (!get_level_annotation(li, true).empty())
- {
- if (!yesno("Really clear the annotation?", true, 'n'))
- return;
- mpr("Cleared.");
- }
- else
- {
- canned_msg(MSG_OK);
- return;
- }
+ mpr("Cleared.");
+ level_annotations.erase(li);
}
-
- set_level_annotation(buf, li);
}
diff --git a/crawl-ref/source/dgn-overview.h b/crawl-ref/source/dgn-overview.h
index 2ccaf1b185..f5d6d8fa2a 100644
--- a/crawl-ref/source/dgn-overview.h
+++ b/crawl-ref/source/dgn-overview.h
@@ -21,10 +21,6 @@ bool unnotice_feature(const level_pos &pos);
std::string overview_description_string(bool display);
///////////////////////////////////////////////////////////
-void set_level_annotation(std::string str,
- level_id li = level_id::current());
-void clear_level_annotation(level_id li = level_id::current());
-
void set_level_exclusion_annotation(std::string str,
level_id li = level_id::current());
void clear_level_exclusion_annotation(level_id li = level_id::current());
@@ -32,10 +28,6 @@ void clear_level_exclusion_annotation(level_id li = level_id::current());
std::string get_level_annotation(level_id li = level_id::current(),
bool skip_excl = false);
-std::string get_coloured_level_annotation(int col,
- level_id li = level_id::current(),
- bool skip_excl = false);
-
bool level_annotation_has(std::string str,
level_id li = level_id::current());
diff --git a/crawl-ref/source/exclude.cc b/crawl-ref/source/exclude.cc
index 2957adf3af..ab387e99de 100644
--- a/crawl-ref/source/exclude.cc
+++ b/crawl-ref/source/exclude.cc
@@ -41,7 +41,7 @@ static bool _mon_needs_auto_exclude(const monster* mon, bool sleepy = false)
}
// Check whether a given monster is listed in the auto_exclude option.
-bool need_auto_exclude(const monster* mon, bool sleepy)
+static bool _need_auto_exclude(const monster* mon, bool sleepy = false)
{
// This only works if the name is lowercased.
std::string name = mon->name(DESC_BASENAME,
@@ -64,7 +64,9 @@ bool need_auto_exclude(const monster* mon, bool sleepy)
// Nightstalker reduces LOS, so reducing the maximum exclusion radius
// only makes sense. This is only possible because it's a permanent
// mutation; the lantern of Shadows should not have this effect.
-int _get_full_exclusion_radius()
+// TODO: update the radiuses on wield/unwield, we already need to do that
+// when gaining/losing nightstalker.
+static int _get_full_exclusion_radius()
{
return (LOS_RADIUS - player_mutation_level(MUT_NIGHTSTALKER));
}
@@ -76,7 +78,7 @@ void set_auto_exclude(const monster* mon)
if (!player_in_mappable_area())
return;
- if (need_auto_exclude(mon) && !is_exclude_root(mon->pos()))
+ if (_need_auto_exclude(mon) && !is_exclude_root(mon->pos()))
{
int rad = _get_full_exclusion_radius();
if (mon->type == MONS_HYPERACTIVE_BALLISTOMYCETE)
@@ -100,7 +102,7 @@ void set_auto_exclude(const monster* mon)
// player in sight. If sleepy is true, stationary monsters are ignored.
void remove_auto_exclude(const monster* mon, bool sleepy)
{
- if (need_auto_exclude(mon, sleepy))
+ if (_need_auto_exclude(mon, sleepy))
{
del_exclude(mon->pos());
#ifdef USE_TILE
diff --git a/crawl-ref/source/exclude.h b/crawl-ref/source/exclude.h
index 217fbfd79c..3e31eb0b3a 100644
--- a/crawl-ref/source/exclude.h
+++ b/crawl-ref/source/exclude.h
@@ -3,7 +3,6 @@
#include "los_def.h"
-bool need_auto_exclude(const monster* mon, bool sleepy = false);
void set_auto_exclude(const monster* mon);
void remove_auto_exclude(const monster* mon, bool sleepy = false);
diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc
index 8f8fdb4d6f..90388b59dd 100644
--- a/crawl-ref/source/files.cc
+++ b/crawl-ref/source/files.cc
@@ -287,15 +287,6 @@ std::string change_file_extension(const std::string &filename,
+ ext);
}
-// Sets the access and modification times of the given file to the current
-// time. This is not yet implemented for every supported platform.
-void file_touch(const std::string &file)
-{
-#ifdef HAVE_UTIMES
- utimes(file.c_str(), NULL);
-#endif
-}
-
time_t file_modtime(const std::string &file)
{
struct stat filestat;
@@ -374,19 +365,6 @@ void assert_read_safe_path(const std::string &path) throw (std::string)
// Path is okay.
}
-bool is_read_safe_path(const std::string &path)
-{
- try
- {
- assert_read_safe_path(path);
- }
- catch (const std::string &)
- {
- return (false);
- }
- return (true);
-}
-
std::string canonicalise_file_separator(const std::string &path)
{
const std::string sep(1, FILE_SEPARATOR);
diff --git a/crawl-ref/source/files.h b/crawl-ref/source/files.h
index 4c2447deff..06f7b089a4 100644
--- a/crawl-ref/source/files.h
+++ b/crawl-ref/source/files.h
@@ -32,7 +32,6 @@ extern level_id_set Generated_Levels;
bool file_exists(const std::string &name);
bool dir_exists(const std::string &dir);
bool is_absolute_path(const std::string &path);
-bool is_read_safe_path(const std::string &path);
void assert_read_safe_path(const std::string &path) throw (std::string);
unsigned long file_size(FILE *handle);
@@ -80,7 +79,6 @@ std::string get_prefs_filename();
std::string change_file_extension(const std::string &file,
const std::string &ext);
-void file_touch(const std::string &file);
time_t file_modtime(const std::string &file);
bool is_newer(const std::string &a, const std::string &b);
std::vector<std::string> get_title_files();