Consistently name every hookset with prefix `hooks_`. NFC.
I'm sure this causes massive merge-conflicts in the non-public code, but I think it'd be a good idea, if only to avoid confusion between e.g. `clearMemory` and the-variable-formerly-known-as `clearmemory`.
This commit is contained in:
parent
84881f0e04
commit
934e3d9a42
|
@ -251,7 +251,7 @@ EX void drawArrowTraps() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto ccm_blizzard = addHook(clearmemory, 0, [] () {
|
auto ccm_blizzard = addHook(hooks_clearmemory, 0, [] () {
|
||||||
arrowtraps.clear();
|
arrowtraps.clear();
|
||||||
blizzardcells.clear();
|
blizzardcells.clear();
|
||||||
bcells.clear();
|
bcells.clear();
|
||||||
|
|
2
cell.cpp
2
cell.cpp
|
@ -1175,7 +1175,7 @@ EX void clearCellMemory() {
|
||||||
gp::gp_adj.clear();
|
gp::gp_adj.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto cellhooks = addHook(clearmemory, 500, clearCellMemory);
|
auto cellhooks = addHook(hooks_clearmemory, 500, clearCellMemory);
|
||||||
|
|
||||||
EX bool isNeighbor(cell *c1, cell *c2) {
|
EX bool isNeighbor(cell *c1, cell *c2) {
|
||||||
for(int i=0; i<c1->type; i++) if(c1->move(i) == c2) return true;
|
for(int i=0; i<c1->type; i++) if(c1->move(i) == c2) return true;
|
||||||
|
|
|
@ -3418,7 +3418,7 @@ EX namespace ca {
|
||||||
}
|
}
|
||||||
EX }
|
EX }
|
||||||
|
|
||||||
auto ccm = addHook(clearmemory, 0, [] () {
|
auto ccm = addHook(hooks_clearmemory, 0, [] () {
|
||||||
heat::offscreen_heat.clear();
|
heat::offscreen_heat.clear();
|
||||||
heat::offscreen_fire.clear();
|
heat::offscreen_fire.clear();
|
||||||
princess::clear();
|
princess::clear();
|
||||||
|
|
|
@ -198,7 +198,7 @@ EX namespace brownian {
|
||||||
vector<cell*> to_remove;
|
vector<cell*> to_remove;
|
||||||
for(auto p: futures) if(is_cell_removed(p.first)) to_remove.push_back(p.first);
|
for(auto p: futures) if(is_cell_removed(p.first)) to_remove.push_back(p.first);
|
||||||
for(auto r: to_remove) futures.erase(r);
|
for(auto r: to_remove) futures.erase(r);
|
||||||
}) + addHook(clearmemory, 0, [] () { futures.clear(); })
|
}) + addHook(hooks_clearmemory, 0, [] () { futures.clear(); })
|
||||||
+ addHook(hooks_gamedata, 0, [] (gamedata* gd) { gd->store(futures); });
|
+ addHook(hooks_gamedata, 0, [] (gamedata* gd) { gd->store(futures); });
|
||||||
|
|
||||||
EX }
|
EX }
|
||||||
|
|
|
@ -1846,7 +1846,7 @@ ld xintval(const hyperpoint& h) {
|
||||||
|
|
||||||
EX ld backbrightness = .25;
|
EX ld backbrightness = .25;
|
||||||
|
|
||||||
purehookset hook_drawqueue;
|
purehookset hooks_drawqueue;
|
||||||
|
|
||||||
constexpr int PMAX = int(PPR::MAX);
|
constexpr int PMAX = int(PPR::MAX);
|
||||||
int qp[PMAX], qp0[PMAX];
|
int qp[PMAX], qp0[PMAX];
|
||||||
|
@ -2032,7 +2032,7 @@ EX hookset<bool()> *hooks_vr_draw_all;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
EX void drawqueue() {
|
EX void drawqueue() {
|
||||||
callhooks(hook_drawqueue);
|
callhooks(hooks_drawqueue);
|
||||||
current_display->next_shader_flags = 0;
|
current_display->next_shader_flags = 0;
|
||||||
reset_projection();
|
reset_projection();
|
||||||
// reset_projection() is not sufficient here, because we need to know shaderside_projection
|
// reset_projection() is not sufficient here, because we need to know shaderside_projection
|
||||||
|
|
|
@ -1295,8 +1295,8 @@ discovery::~discovery() { schedule_destruction(); if(discoverer) discoverer->joi
|
||||||
|
|
||||||
int hk =
|
int hk =
|
||||||
#if CAP_THREAD
|
#if CAP_THREAD
|
||||||
+ addHook(on_geometry_change, 100, [] { for(auto& d:discoveries) if(!d.second.is_suspended) d.second.suspend(); })
|
+ addHook(hooks_on_geometry_change, 100, [] { for(auto& d:discoveries) if(!d.second.is_suspended) d.second.suspend(); })
|
||||||
+ addHook(final_cleanup, 100, [] {
|
+ addHook(hooks_final_cleanup, 100, [] {
|
||||||
for(auto& d:discoveries) { d.second.schedule_destruction(); if(d.second.is_suspended) d.second.activate(); }
|
for(auto& d:discoveries) { d.second.schedule_destruction(); if(d.second.is_suspended) d.second.activate(); }
|
||||||
discoveries.clear();
|
discoveries.clear();
|
||||||
})
|
})
|
||||||
|
@ -1314,7 +1314,7 @@ int hk =
|
||||||
#endif
|
#endif
|
||||||
+ 0;
|
+ 0;
|
||||||
|
|
||||||
EX purehookset on_geometry_change;
|
EX purehookset hooks_on_geometry_change;
|
||||||
|
|
||||||
EX int field_celldistance(cell *c1, cell *c2) {
|
EX int field_celldistance(cell *c1, cell *c2) {
|
||||||
if(geometry != gFieldQuotient) return DISTANCE_UNKNOWN;
|
if(geometry != gFieldQuotient) return DISTANCE_UNKNOWN;
|
||||||
|
|
|
@ -5150,7 +5150,7 @@ EX void clearAnimations() {
|
||||||
fallanims.clear();
|
fallanims.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto graphcm = addHook(clearmemory, 0, [] () {
|
auto graphcm = addHook(hooks_clearmemory, 0, [] () {
|
||||||
DEBBI(DF_MEMORY, ("clear graph memory"));
|
DEBBI(DF_MEMORY, ("clear graph memory"));
|
||||||
mouseover = centerover = lmouseover = NULL;
|
mouseover = centerover = lmouseover = NULL;
|
||||||
gmatrix.clear(); gmatrix0.clear(); current_display->all_drawn_copies.clear();
|
gmatrix.clear(); gmatrix0.clear(); current_display->all_drawn_copies.clear();
|
||||||
|
|
|
@ -689,7 +689,7 @@ EX namespace history {
|
||||||
auto hookArg = addHook(hooks_args, 100, readArgs);
|
auto hookArg = addHook(hooks_args, 100, readArgs);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
auto hooks = addHook(clearmemory, 0, [] () {
|
auto hooks = addHook(hooks_clearmemory, 0, [] () {
|
||||||
history::renderAutoband();
|
history::renderAutoband();
|
||||||
history::on = false;
|
history::on = false;
|
||||||
history::killhistory.clear();
|
history::killhistory.clear();
|
||||||
|
|
|
@ -2128,7 +2128,7 @@ namespace mapeditor {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
auto hooks = addHook(clearmemory, 0, [] () {
|
auto hooks = addHook(hooks_clearmemory, 0, [] () {
|
||||||
if(mapeditor::painttype == 4)
|
if(mapeditor::painttype == 4)
|
||||||
mapeditor::painttype = 0, mapeditor::paintwhat = 0,
|
mapeditor::painttype = 0, mapeditor::paintwhat = 0,
|
||||||
mapeditor::paintwhat_str = "clear monster";
|
mapeditor::paintwhat_str = "clear monster";
|
||||||
|
|
|
@ -3013,7 +3013,7 @@ int read_pattern_args() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto ah_pattern = addHook(hooks_args, 0, read_pattern_args) + addHook(clearmemory, 100, [] { patterns::computed_nearer_map.clear(); patterns::computed_furthest_map.clear(); });
|
auto ah_pattern = addHook(hooks_args, 0, read_pattern_args) + addHook(hooks_clearmemory, 100, [] { patterns::computed_nearer_map.clear(); patterns::computed_furthest_map.clear(); });
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -835,7 +835,7 @@ heptspin sview;
|
||||||
#if CAP_COMMANDLINE
|
#if CAP_COMMANDLINE
|
||||||
auto hook =
|
auto hook =
|
||||||
addHook(hooks_args, 100, readArgs)
|
addHook(hooks_args, 100, readArgs)
|
||||||
+ addHook(clearmemory, 0, []() {
|
+ addHook(hooks_clearmemory, 0, []() {
|
||||||
track_ready = false;
|
track_ready = false;
|
||||||
track.clear();
|
track.clear();
|
||||||
rti.clear();
|
rti.clear();
|
||||||
|
|
|
@ -346,7 +346,7 @@ bool handleKey(int sym, int uni) {
|
||||||
auto xhook = addHook(hooks_args, 100, readArgs)
|
auto xhook = addHook(hooks_args, 100, readArgs)
|
||||||
+ addHook(hooks_handleKey, 0, handleKey)
|
+ addHook(hooks_handleKey, 0, handleKey)
|
||||||
+ addHook(hooks_prestats, 0, frame)
|
+ addHook(hooks_prestats, 0, frame)
|
||||||
+ addHook(clearmemory, 40, [] () { snubon = false; } )
|
+ addHook(hooks_clearmemory, 40, [] () { snubon = false; } )
|
||||||
+ addHook(rvtour::hooks_build_rvtour, 142, [] (vector<tour::slide>& v) {
|
+ addHook(rvtour::hooks_build_rvtour, 142, [] (vector<tour::slide>& v) {
|
||||||
using namespace tour;
|
using namespace tour;
|
||||||
v.push_back(
|
v.push_back(
|
||||||
|
|
|
@ -1232,7 +1232,7 @@ auto hooks =
|
||||||
#if CAP_COMMANDLINE
|
#if CAP_COMMANDLINE
|
||||||
addHook(hooks_args, 100, readArgs) +
|
addHook(hooks_args, 100, readArgs) +
|
||||||
#endif
|
#endif
|
||||||
addHook(clearmemory, 0, close) +
|
addHook(hooks_clearmemory, 0, close) +
|
||||||
addHook(hooks_prestats, 100, rogueviz_hud) +
|
addHook(hooks_prestats, 100, rogueviz_hud) +
|
||||||
addHook(shmup::hooks_draw, 100, drawVertex) +
|
addHook(shmup::hooks_draw, 100, drawVertex) +
|
||||||
addHook(shmup::hooks_describe, 100, describe_monster) +
|
addHook(shmup::hooks_describe, 100, describe_monster) +
|
||||||
|
@ -1240,7 +1240,7 @@ auto hooks =
|
||||||
addHook(hooks_o_key, 100, o_key) +
|
addHook(hooks_o_key, 100, o_key) +
|
||||||
|
|
||||||
#if CAP_RVSLIDES
|
#if CAP_RVSLIDES
|
||||||
addHook(tour::ss::extra_slideshows, 100, [] (bool view) {
|
addHook(tour::ss::hooks_extra_slideshows, 100, [] (bool view) {
|
||||||
if(!view) return 1;
|
if(!view) return 1;
|
||||||
dialog::addBoolItem(XLAT("RogueViz Tour"), tour::ss::wts == &rvtour::rvslides[0], 'r');
|
dialog::addBoolItem(XLAT("RogueViz Tour"), tour::ss::wts == &rvtour::rvslides[0], 'r');
|
||||||
dialog::add_action([] { tour::ss::wts = rvtour::gen_rvtour(); popScreen(); });
|
dialog::add_action([] { tour::ss::wts = rvtour::gen_rvtour(); popScreen(); });
|
||||||
|
|
|
@ -199,7 +199,7 @@ named_functionality o_key() {
|
||||||
|
|
||||||
auto hchook = addHook(hooks_drawcell, 100, draw_snow)
|
auto hchook = addHook(hooks_drawcell, 100, draw_snow)
|
||||||
|
|
||||||
+ addHook(clearmemory, 40, [] () {
|
+ addHook(hooks_clearmemory, 40, [] () {
|
||||||
matrices_at.clear();
|
matrices_at.clear();
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -2844,7 +2844,7 @@ EX void addShmupHelp(string& out) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto hooks = addHook(clearmemory, 0, shmup::clearMemory) +
|
auto hooks = addHook(hooks_clearmemory, 0, shmup::clearMemory) +
|
||||||
addHook(hooks_gamedata, 0, shmup::gamedata) +
|
addHook(hooks_gamedata, 0, shmup::gamedata) +
|
||||||
addHook(hooks_removecells, 0, [] () {
|
addHook(hooks_removecells, 0, [] () {
|
||||||
for(mit it = monstersAt.begin(); it != monstersAt.end();) {
|
for(mit it = monstersAt.begin(); it != monstersAt.end();) {
|
||||||
|
|
14
system.cpp
14
system.cpp
|
@ -1246,11 +1246,11 @@ eModel default_model() {
|
||||||
return mdDisk;
|
return mdDisk;
|
||||||
}
|
}
|
||||||
|
|
||||||
EX purehookset on_geometry_change;
|
EX purehookset hooks_on_geometry_change;
|
||||||
|
|
||||||
EX void set_geometry(eGeometry target) {
|
EX void set_geometry(eGeometry target) {
|
||||||
bool was_default = pmodel == default_model();
|
bool was_default = pmodel == default_model();
|
||||||
callhooks(on_geometry_change);
|
callhooks(hooks_on_geometry_change);
|
||||||
if(geometry != target) {
|
if(geometry != target) {
|
||||||
int old_DIM = GDIM;
|
int old_DIM = GDIM;
|
||||||
stop_game();
|
stop_game();
|
||||||
|
@ -1497,10 +1497,10 @@ EX void stop_game_and_switch_mode(char switchWhat IS(rg::nothing)) {
|
||||||
switch_game_mode(switchWhat);
|
switch_game_mode(switchWhat);
|
||||||
}
|
}
|
||||||
|
|
||||||
EX purehookset clearmemory;
|
EX purehookset hooks_clearmemory;
|
||||||
|
|
||||||
EX void clearMemory() {
|
EX void clearMemory() {
|
||||||
callhooks(clearmemory);
|
callhooks(hooks_clearmemory);
|
||||||
}
|
}
|
||||||
|
|
||||||
EX bool fixseed = false;
|
EX bool fixseed = false;
|
||||||
|
@ -1544,7 +1544,7 @@ EX void initAll() {
|
||||||
polygonal::solve();
|
polygonal::solve();
|
||||||
}
|
}
|
||||||
|
|
||||||
EX purehookset final_cleanup;
|
EX purehookset hooks_final_cleanup;
|
||||||
|
|
||||||
EX void finishAll() {
|
EX void finishAll() {
|
||||||
achievement_final(!items[itOrbSafety]);
|
achievement_final(!items[itOrbSafety]);
|
||||||
|
@ -1558,11 +1558,11 @@ EX void finishAll() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
achievement_close();
|
achievement_close();
|
||||||
callhooks(final_cleanup);
|
callhooks(hooks_final_cleanup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
auto cgm = addHook(clearmemory, 40, [] () {
|
auto cgm = addHook(hooks_clearmemory, 40, [] () {
|
||||||
pathq.clear();
|
pathq.clear();
|
||||||
dcal.clear();
|
dcal.clear();
|
||||||
clearshadow();
|
clearshadow();
|
||||||
|
|
|
@ -1725,7 +1725,7 @@ int textureArgs() {
|
||||||
|
|
||||||
auto texture_hook =
|
auto texture_hook =
|
||||||
addHook(hooks_args, 100, textureArgs)
|
addHook(hooks_args, 100, textureArgs)
|
||||||
+ addHook(clearmemory, 100, [] () { config.data.pixels_to_draw.clear(); });
|
+ addHook(hooks_clearmemory, 100, [] () { config.data.pixels_to_draw.clear(); });
|
||||||
|
|
||||||
int lastupdate;
|
int lastupdate;
|
||||||
|
|
||||||
|
|
6
tour.cpp
6
tour.cpp
|
@ -377,13 +377,13 @@ EX namespace ss {
|
||||||
|
|
||||||
string slidechars = "abcdefghijklmnopqrsvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ23456789!@#$%^&*(";
|
string slidechars = "abcdefghijklmnopqrsvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ23456789!@#$%^&*(";
|
||||||
|
|
||||||
EX hookset<int(bool)> *extra_slideshows;
|
EX hookset<int(bool)> *hooks_extra_slideshows;
|
||||||
|
|
||||||
EX void slideshow_menu() {
|
EX void slideshow_menu() {
|
||||||
dialog::init(XLAT("slideshows"), forecolor, 150, 100);
|
dialog::init(XLAT("slideshows"), forecolor, 150, 100);
|
||||||
dialog::addBoolItem(XLAT("Guided Tour"), wts == default_slides, 't');
|
dialog::addBoolItem(XLAT("Guided Tour"), wts == default_slides, 't');
|
||||||
dialog::add_action([] { wts = default_slides; popScreen(); });
|
dialog::add_action([] { wts = default_slides; popScreen(); });
|
||||||
callhooks(extra_slideshows, true);
|
callhooks(hooks_extra_slideshows, true);
|
||||||
dialog::addBack();
|
dialog::addBack();
|
||||||
dialog::display();
|
dialog::display();
|
||||||
}
|
}
|
||||||
|
@ -438,7 +438,7 @@ EX namespace ss {
|
||||||
}
|
}
|
||||||
dialog::addBreak(50);
|
dialog::addBreak(50);
|
||||||
bool b = false;
|
bool b = false;
|
||||||
if(callhandlers(0, extra_slideshows, b)) {
|
if(callhandlers(0, hooks_extra_slideshows, b)) {
|
||||||
dialog::addItem(XLAT("change slideshow"), '1');
|
dialog::addItem(XLAT("change slideshow"), '1');
|
||||||
dialog::add_action_push(slideshow_menu);
|
dialog::add_action_push(slideshow_menu);
|
||||||
}
|
}
|
||||||
|
|
|
@ -288,7 +288,7 @@ auto wfc_hook =
|
||||||
});
|
});
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
auto cgm = addHook(clearmemory, 40, [] () { centers.clear(); }) + addHook(hooks_removecells, 0, [] () { eliminate_if(centers, is_cell_removed); });
|
auto cgm = addHook(hooks_clearmemory, 40, [] () { centers.clear(); }) + addHook(hooks_removecells, 0, [] () { eliminate_if(centers, is_cell_removed); });
|
||||||
|
|
||||||
EX }
|
EX }
|
||||||
|
|
||||||
|
|
|
@ -799,7 +799,7 @@ EX namespace yendor {
|
||||||
achievement_victory(false);
|
achievement_victory(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto hooks = addHook(clearmemory, 0, [] () {
|
auto hooks = addHook(hooks_clearmemory, 0, [] () {
|
||||||
yendor::yii = NOYENDOR; yendor::yi.clear();
|
yendor::yii = NOYENDOR; yendor::yi.clear();
|
||||||
}) + addHook(hooks_removecells, 0, [] () {
|
}) + addHook(hooks_removecells, 0, [] () {
|
||||||
eliminate_if(yendor::yi, [] (yendorinfo& i) {
|
eliminate_if(yendor::yi, [] (yendorinfo& i) {
|
||||||
|
|
Loading…
Reference in New Issue