1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-27 06:27:17 +00:00

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:
Arthur O'Dwyer 2020-04-11 14:40:12 -04:00
parent 84881f0e04
commit 934e3d9a42
20 changed files with 32 additions and 32 deletions

View File

@ -251,7 +251,7 @@ EX void drawArrowTraps() {
}
}
auto ccm_blizzard = addHook(clearmemory, 0, [] () {
auto ccm_blizzard = addHook(hooks_clearmemory, 0, [] () {
arrowtraps.clear();
blizzardcells.clear();
bcells.clear();

View File

@ -1175,7 +1175,7 @@ EX void clearCellMemory() {
gp::gp_adj.clear();
}
auto cellhooks = addHook(clearmemory, 500, clearCellMemory);
auto cellhooks = addHook(hooks_clearmemory, 500, clearCellMemory);
EX bool isNeighbor(cell *c1, cell *c2) {
for(int i=0; i<c1->type; i++) if(c1->move(i) == c2) return true;

View File

@ -3418,7 +3418,7 @@ EX namespace ca {
}
EX }
auto ccm = addHook(clearmemory, 0, [] () {
auto ccm = addHook(hooks_clearmemory, 0, [] () {
heat::offscreen_heat.clear();
heat::offscreen_fire.clear();
princess::clear();

View File

@ -198,7 +198,7 @@ EX namespace brownian {
vector<cell*> to_remove;
for(auto p: futures) if(is_cell_removed(p.first)) to_remove.push_back(p.first);
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); });
EX }

View File

@ -1846,7 +1846,7 @@ ld xintval(const hyperpoint& h) {
EX ld backbrightness = .25;
purehookset hook_drawqueue;
purehookset hooks_drawqueue;
constexpr int PMAX = int(PPR::MAX);
int qp[PMAX], qp0[PMAX];
@ -2032,7 +2032,7 @@ EX hookset<bool()> *hooks_vr_draw_all;
#endif
EX void drawqueue() {
callhooks(hook_drawqueue);
callhooks(hooks_drawqueue);
current_display->next_shader_flags = 0;
reset_projection();
// reset_projection() is not sufficient here, because we need to know shaderside_projection

View File

@ -1295,8 +1295,8 @@ discovery::~discovery() { schedule_destruction(); if(discoverer) discoverer->joi
int hk =
#if CAP_THREAD
+ addHook(on_geometry_change, 100, [] { for(auto& d:discoveries) if(!d.second.is_suspended) d.second.suspend(); })
+ addHook(final_cleanup, 100, [] {
+ addHook(hooks_on_geometry_change, 100, [] { for(auto& d:discoveries) if(!d.second.is_suspended) d.second.suspend(); })
+ addHook(hooks_final_cleanup, 100, [] {
for(auto& d:discoveries) { d.second.schedule_destruction(); if(d.second.is_suspended) d.second.activate(); }
discoveries.clear();
})
@ -1314,7 +1314,7 @@ int hk =
#endif
+ 0;
EX purehookset on_geometry_change;
EX purehookset hooks_on_geometry_change;
EX int field_celldistance(cell *c1, cell *c2) {
if(geometry != gFieldQuotient) return DISTANCE_UNKNOWN;

View File

@ -5150,7 +5150,7 @@ EX void clearAnimations() {
fallanims.clear();
}
auto graphcm = addHook(clearmemory, 0, [] () {
auto graphcm = addHook(hooks_clearmemory, 0, [] () {
DEBBI(DF_MEMORY, ("clear graph memory"));
mouseover = centerover = lmouseover = NULL;
gmatrix.clear(); gmatrix0.clear(); current_display->all_drawn_copies.clear();

View File

@ -689,7 +689,7 @@ EX namespace history {
auto hookArg = addHook(hooks_args, 100, readArgs);
#endif
auto hooks = addHook(clearmemory, 0, [] () {
auto hooks = addHook(hooks_clearmemory, 0, [] () {
history::renderAutoband();
history::on = false;
history::killhistory.clear();

View File

@ -2128,7 +2128,7 @@ namespace mapeditor {
}
#endif
auto hooks = addHook(clearmemory, 0, [] () {
auto hooks = addHook(hooks_clearmemory, 0, [] () {
if(mapeditor::painttype == 4)
mapeditor::painttype = 0, mapeditor::paintwhat = 0,
mapeditor::paintwhat_str = "clear monster";

View File

@ -3013,7 +3013,7 @@ int read_pattern_args() {
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
}

View File

@ -835,7 +835,7 @@ heptspin sview;
#if CAP_COMMANDLINE
auto hook =
addHook(hooks_args, 100, readArgs)
+ addHook(clearmemory, 0, []() {
+ addHook(hooks_clearmemory, 0, []() {
track_ready = false;
track.clear();
rti.clear();

View File

@ -346,7 +346,7 @@ bool handleKey(int sym, int uni) {
auto xhook = addHook(hooks_args, 100, readArgs)
+ addHook(hooks_handleKey, 0, handleKey)
+ 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) {
using namespace tour;
v.push_back(

View File

@ -1232,7 +1232,7 @@ auto hooks =
#if CAP_COMMANDLINE
addHook(hooks_args, 100, readArgs) +
#endif
addHook(clearmemory, 0, close) +
addHook(hooks_clearmemory, 0, close) +
addHook(hooks_prestats, 100, rogueviz_hud) +
addHook(shmup::hooks_draw, 100, drawVertex) +
addHook(shmup::hooks_describe, 100, describe_monster) +
@ -1240,7 +1240,7 @@ auto hooks =
addHook(hooks_o_key, 100, o_key) +
#if CAP_RVSLIDES
addHook(tour::ss::extra_slideshows, 100, [] (bool view) {
addHook(tour::ss::hooks_extra_slideshows, 100, [] (bool view) {
if(!view) return 1;
dialog::addBoolItem(XLAT("RogueViz Tour"), tour::ss::wts == &rvtour::rvslides[0], 'r');
dialog::add_action([] { tour::ss::wts = rvtour::gen_rvtour(); popScreen(); });

View File

@ -199,7 +199,7 @@ named_functionality o_key() {
auto hchook = addHook(hooks_drawcell, 100, draw_snow)
+ addHook(clearmemory, 40, [] () {
+ addHook(hooks_clearmemory, 40, [] () {
matrices_at.clear();
})

View File

@ -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_removecells, 0, [] () {
for(mit it = monstersAt.begin(); it != monstersAt.end();) {

View File

@ -1246,11 +1246,11 @@ eModel default_model() {
return mdDisk;
}
EX purehookset on_geometry_change;
EX purehookset hooks_on_geometry_change;
EX void set_geometry(eGeometry target) {
bool was_default = pmodel == default_model();
callhooks(on_geometry_change);
callhooks(hooks_on_geometry_change);
if(geometry != target) {
int old_DIM = GDIM;
stop_game();
@ -1497,10 +1497,10 @@ EX void stop_game_and_switch_mode(char switchWhat IS(rg::nothing)) {
switch_game_mode(switchWhat);
}
EX purehookset clearmemory;
EX purehookset hooks_clearmemory;
EX void clearMemory() {
callhooks(clearmemory);
callhooks(hooks_clearmemory);
}
EX bool fixseed = false;
@ -1544,7 +1544,7 @@ EX void initAll() {
polygonal::solve();
}
EX purehookset final_cleanup;
EX purehookset hooks_final_cleanup;
EX void finishAll() {
achievement_final(!items[itOrbSafety]);
@ -1558,11 +1558,11 @@ EX void finishAll() {
#endif
achievement_close();
callhooks(final_cleanup);
callhooks(hooks_final_cleanup);
}
auto cgm = addHook(clearmemory, 40, [] () {
auto cgm = addHook(hooks_clearmemory, 40, [] () {
pathq.clear();
dcal.clear();
clearshadow();

View File

@ -1725,7 +1725,7 @@ int textureArgs() {
auto texture_hook =
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;

View File

@ -377,13 +377,13 @@ EX namespace ss {
string slidechars = "abcdefghijklmnopqrsvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ23456789!@#$%^&*(";
EX hookset<int(bool)> *extra_slideshows;
EX hookset<int(bool)> *hooks_extra_slideshows;
EX void slideshow_menu() {
dialog::init(XLAT("slideshows"), forecolor, 150, 100);
dialog::addBoolItem(XLAT("Guided Tour"), wts == default_slides, 't');
dialog::add_action([] { wts = default_slides; popScreen(); });
callhooks(extra_slideshows, true);
callhooks(hooks_extra_slideshows, true);
dialog::addBack();
dialog::display();
}
@ -438,7 +438,7 @@ EX namespace ss {
}
dialog::addBreak(50);
bool b = false;
if(callhandlers(0, extra_slideshows, b)) {
if(callhandlers(0, hooks_extra_slideshows, b)) {
dialog::addItem(XLAT("change slideshow"), '1');
dialog::add_action_push(slideshow_menu);
}

View File

@ -288,7 +288,7 @@ auto wfc_hook =
});
#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 }

View File

@ -799,7 +799,7 @@ EX namespace yendor {
achievement_victory(false);
}
auto hooks = addHook(clearmemory, 0, [] () {
auto hooks = addHook(hooks_clearmemory, 0, [] () {
yendor::yii = NOYENDOR; yendor::yi.clear();
}) + addHook(hooks_removecells, 0, [] () {
eliminate_if(yendor::yi, [] (yendorinfo& i) {