summaryrefslogtreecommitdiff
path: root/src/modules.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules.cc')
-rw-r--r--src/modules.cc75
1 files changed, 34 insertions, 41 deletions
diff --git a/src/modules.cc b/src/modules.cc
index c5d065f4..de9ad1ad 100644
--- a/src/modules.cc
+++ b/src/modules.cc
@@ -7,7 +7,6 @@
*/
#include "modules.hpp"
-#include "modules.h"
#include "birth.hpp"
#include "cave.hpp"
@@ -25,6 +24,7 @@
#include "lua_bind.hpp"
#include "monster2.hpp"
#include "monster_race.hpp"
+#include "monster_race_flag.hpp"
#include "monster_type.hpp"
#include "object2.hpp"
#include "object_type.hpp"
@@ -195,8 +195,6 @@ static void activate_module(int module_idx)
game_module_idx = module_idx;
/* Do misc inits */
- max_plev = module_ptr->max_plev;
-
RANDART_WEAPON = module_ptr->randarts.weapon_chance;
RANDART_ARMOR = module_ptr->randarts.armor_chance;
RANDART_JEWEL = module_ptr->randarts.jewelry_chance;
@@ -204,9 +202,6 @@ static void activate_module(int module_idx)
VERSION_MAJOR = module_ptr->meta.version.major;
VERSION_MINOR = module_ptr->meta.version.minor;
VERSION_PATCH = module_ptr->meta.version.patch;
- version_major = VERSION_MAJOR;
- version_minor = VERSION_MINOR;
- version_patch = VERSION_PATCH;
/* Change window name if needed */
if (strcmp(game_module, "ToME"))
@@ -237,9 +232,9 @@ static void init_module(module_type *module_ptr)
}
}
-bool_ module_savefile_loadable(cptr savefile_mod)
+bool module_savefile_loadable(std::string const &tag)
{
- return (strcmp(savefile_mod, modules[game_module_idx].meta.save_file_tag) == 0);
+ return tag == modules[game_module_idx].meta.save_file_tag;
}
/* Did the player force a module on command line */
@@ -562,7 +557,7 @@ exit:
screen_load();
}
-static bool_ auto_stat_gain_hook(void *data, void *in, void *out)
+static bool auto_stat_gain_hook(void *data, void *in, void *out)
{
while (p_ptr->last_rewarded_level * 5 <= p_ptr->lev)
{
@@ -576,10 +571,10 @@ static bool_ auto_stat_gain_hook(void *data, void *in, void *out)
p_ptr->last_rewarded_level += 1;
}
- return FALSE;
+ return false;
}
-static bool_ drunk_takes_wine(void *data, void *in_, void *out)
+static bool drunk_takes_wine(void *, void *in_, void *)
{
hook_give_in *in = (hook_give_in *) in_;
monster_type *m_ptr = &m_list[in->m_idx];
@@ -609,7 +604,7 @@ static bool_ drunk_takes_wine(void *data, void *in_, void *out)
}
}
-static bool_ hobbit_food(void *data, void *in_, void *out)
+static bool hobbit_food(void *, void *in_, void *)
{
hook_give_in *in = (hook_give_in *) in_;
monster_type *m_ptr = &m_list[in->m_idx];
@@ -622,15 +617,15 @@ static bool_ hobbit_food(void *data, void *in_, void *out)
inc_stack_size_ex(in->item, -1, OPTIMIZE, NO_DESCRIBE);
- return TRUE;
+ return true;
}
else
{
- return FALSE;
+ return false;
}
}
-static bool_ smeagol_ring(void *data, void *in_, void *out)
+static bool smeagol_ring(void *data, void *in_, void *out)
{
hook_give_in *in = (hook_give_in *) in_;
monster_type *m_ptr = &m_list[in->m_idx];
@@ -643,15 +638,15 @@ static bool_ smeagol_ring(void *data, void *in_, void *out)
inc_stack_size_ex(in->item, -1, OPTIMIZE, NO_DESCRIBE);
- return TRUE;
+ return true;
}
else
{
- return FALSE;
+ return false;
}
}
-static bool_ longbottom_leaf(void *data, void *in_, void *out_)
+static bool longbottom_leaf(void *, void *in_, void *)
{
hook_eat_in *in = (hook_eat_in *) in_;
@@ -660,13 +655,13 @@ static bool_ longbottom_leaf(void *data, void *in_, void *out_)
{
msg_print("What a stress reliever!");
heal_insanity(1000);
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-static bool_ food_vessel(void *data, void *in_, void *out)
+static bool food_vessel(void *, void *in_, void *ut)
{
hook_eat_in *in = (hook_eat_in *) in_;
@@ -680,16 +675,16 @@ static bool_ food_vessel(void *data, void *in_, void *out)
forge.ident |= IDENT_MENTAL | IDENT_KNOWN;
inven_carry(&forge, FALSE);
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
/*
* Player must have appropriate keys to enter Erebor.
*/
-static bool_ erebor_stair(void *data, void *in_, void *out_)
+static bool erebor_stair(void *, void *in_, void *out_)
{
hook_stair_in *in = (hook_stair_in *) in_;
hook_stair_out *out = (hook_stair_out *) out_;
@@ -724,13 +719,13 @@ static bool_ erebor_stair(void *data, void *in_, void *out_)
}
}
- return FALSE;
+ return false;
}
/*
* Orthanc requires a key.
*/
-static bool_ orthanc_stair(void *data, void *in_, void *out_)
+static bool orthanc_stair(void *, void *in_, void *out_)
{
hook_stair_in *in = (hook_stair_in *) in_;
hook_stair_out *out = (hook_stair_out *) out_;
@@ -762,13 +757,13 @@ static bool_ orthanc_stair(void *data, void *in_, void *out_)
}
}
- return FALSE;
+ return false;
}
/*
* Movement from Theme
*/
-static bool_ theme_push_past(void *data, void *in_, void *out_)
+static bool theme_push_past(void *data, void *in_, void *out_)
{
hook_move_in *p = (hook_move_in *) in_;
cave_type *c_ptr = &cave[p->y][p->x];
@@ -781,7 +776,7 @@ static bool_ theme_push_past(void *data, void *in_, void *out_)
if (m_ptr->status >= MSTATUS_NEUTRAL)
{
if (cave_floor_bold(p->y, p->x) ||
- (mr_ptr->flags2 == RF2_PASS_WALL))
+ (mr_ptr->flags == RF_PASS_WALL))
{
char buf[128];
@@ -801,19 +796,19 @@ static bool_ theme_push_past(void *data, void *in_, void *out_)
msg_print(format("%s is in your way!", buf));
energy_use = 0;
- return TRUE;
+ return true;
}
}
}
- return FALSE;
+ return false;
}
/*
* Check if monster race is in list. The list is terminated
* with a -1.
*/
-static bool_ race_in_list(int r_idx, int race_idxs[])
+static bool race_in_list(int r_idx, int race_idxs[])
{
int i;
@@ -821,11 +816,11 @@ static bool_ race_in_list(int r_idx, int race_idxs[])
{
if (r_idx == race_idxs[i])
{
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
/*
@@ -1160,11 +1155,9 @@ s16b *theme_race_status(int r_idx)
return NULL;
}
-static bool_ theme_level_end_gen(void *data, void *in, void *out)
+static bool theme_level_end_gen(void *, void *, void *)
{
- int i = 0;
-
- for (i = 0; i < m_max; i++)
+ for (int i = 0; i < m_max; i++)
{
monster_type *m_ptr = &m_list[i];
int r_idx = m_ptr->r_idx;
@@ -1175,10 +1168,10 @@ static bool_ theme_level_end_gen(void *data, void *in, void *out)
}
}
- return FALSE;
+ return false;
}
-static bool_ theme_new_monster_end(void *data, void *in_, void *out)
+static bool theme_new_monster_end(void *, void *in_, void *)
{
hook_new_monster_end_in *in = (hook_new_monster_end_in *) in_;
s16b *status = theme_race_status(in->m_ptr->r_idx);
@@ -1188,7 +1181,7 @@ static bool_ theme_new_monster_end(void *data, void *in_, void *out)
in->m_ptr->status = *status;
}
- return FALSE;
+ return false;
}
void init_hooks_module()