diff --git a/basegraph.cpp b/basegraph.cpp index d891317b..63fc57ca 100644 --- a/basegraph.cpp +++ b/basegraph.cpp @@ -219,7 +219,7 @@ void setcameraangle(bool b) { } #if CAP_GL #if CAP_VR -EX hookset *hooks_vr_eye_view, *hooks_vr_eye_projection; +EX hookset hooks_vr_eye_view, hooks_vr_eye_projection; #endif EX void eyewidth_translate(int ed) { diff --git a/bigstuff.cpp b/bigstuff.cpp index 7a8c4581..24a60544 100644 --- a/bigstuff.cpp +++ b/bigstuff.cpp @@ -1332,7 +1332,7 @@ EX bool quickfind(eLand l) { #define I2000 (INVLUCK?600:2000) #define I10000 (INVLUCK?3000:10000) -EX hookset *hooks_wallchance; +EX hookset hooks_wallchance; EX int wallchance(cell *c, bool deepOcean) { int i = callhandlers(-1, hooks_wallchance, c, deepOcean); diff --git a/cell.cpp b/cell.cpp index 6ef2e56d..4c2bb099 100644 --- a/cell.cpp +++ b/cell.cpp @@ -279,7 +279,7 @@ EX void eumerge(cell* c1, int s1, cell *c2, int s2, bool mirror) { // map, cell*> euclidean; -EX hookset *hooks_newmap; +EX hookset hooks_newmap; /** create a map in the current geometry */ EX void initcells() { diff --git a/commandline.cpp b/commandline.cpp index 31d19865..427b0e6f 100644 --- a/commandline.cpp +++ b/commandline.cpp @@ -347,7 +347,7 @@ int arg::readCommon() { EX purehookset hooks_config; -EX hookset *hooks_args; +EX hookset hooks_args; namespace arg { diff --git a/complex2.cpp b/complex2.cpp index 3899d747..90e3bea7 100644 --- a/complex2.cpp +++ b/complex2.cpp @@ -554,7 +554,7 @@ EX bool mightBeMine(cell *c) { return c->wall == waMineUnknown || c->wall == waMineMine; } -EX hookset *hooks_mark; +EX hookset hooks_mark; EX void performMarkCommand(cell *c) { if(!c) return; diff --git a/drawing.cpp b/drawing.cpp index 56a212be..f10209fa 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -2028,7 +2028,7 @@ EX void draw_main() { } #if CAP_VR -EX hookset *hooks_vr_draw_all; +EX hookset hooks_vr_draw_all; #endif EX void drawqueue() { diff --git a/graph.cpp b/graph.cpp index 14d34544..f61b9877 100644 --- a/graph.cpp +++ b/graph.cpp @@ -40,8 +40,8 @@ EX bool hide_player() { #define ADC(V,c) for(const transmatrix& V: current_display->all_drawn_copies[c]) -EX hookset *hooks_handleKey; -EX hookset *hooks_drawcell; +EX hookset hooks_handleKey; +EX hookset hooks_drawcell; EX purehookset hooks_frame, hooks_markers; EX ld animation_factor = 1; diff --git a/help.cpp b/help.cpp index 78da74e3..fb7273a3 100644 --- a/help.cpp +++ b/help.cpp @@ -772,7 +772,7 @@ EX void appendHelp(string s) { unsigned char lastval; int windtotal; -EX hookset *hooks_mouseover; +EX hookset hooks_mouseover; EX void describeMouseover() { DEBBI(DF_GRAPH, ("describeMouseover")); @@ -1017,7 +1017,7 @@ EX void showHelp() { }; } -EX hookset *hooks_default_help; +EX hookset hooks_default_help; EX void gotoHelp(const string& h) { help = h; diff --git a/heptagon.cpp b/heptagon.cpp index bff3e629..ae6ae7c7 100644 --- a/heptagon.cpp +++ b/heptagon.cpp @@ -217,7 +217,7 @@ void addSpin(heptagon *h, int d, heptagon *from, int rot, int spin) { extern int hrand(int); -EX hookset *hooks_createStep; +EX hookset hooks_createStep; // create h->move(d) if not created yet heptagon *createStep(heptagon *h, int d) { diff --git a/hud.cpp b/hud.cpp index 77314a09..3f973788 100644 --- a/hud.cpp +++ b/hud.cpp @@ -328,7 +328,7 @@ void displayglyph2(int cx, int cy, int buttonsize, int i) { EX bool nohud, nomenukey; -EX hookset *hooks_prestats; +EX hookset hooks_prestats; #if CAP_SHAPES void drawMobileArrow(int i) { diff --git a/hyper-main.cpp b/hyper-main.cpp index 566b2431..5c18629a 100644 --- a/hyper-main.cpp +++ b/hyper-main.cpp @@ -29,7 +29,7 @@ void moreStack() { #endif namespace hr { -EX hookset *hooks_main; +EX hookset hooks_main; EX int hyper_main(int argc, char **argv) { using namespace hr; diff --git a/hyper.h b/hyper.h index b68879fe..036e8780 100644 --- a/hyper.h +++ b/hyper.h @@ -407,8 +407,9 @@ struct movedir { // shmup -template class hookset : public map> {}; -typedef hookset *purehookset; +template class hookset_impl : public map> {}; +template using hookset = hookset_impl *; +using purehookset = hookset_impl *; static const int NOHINT = -1; @@ -633,8 +634,8 @@ color_t darkena(color_t c, int lev, int a); static const int DISTANCE_UNKNOWN = 127; -template int addHook(hookset*& m, int prio, const U& hook) { - if(!m) m = new hookset (); +template int addHook(hookset& m, int prio, const U& hook) { + if(!m) m = new hookset_impl (); while(m->count(prio)) { prio++; } @@ -642,11 +643,11 @@ template int addHook(hookset*& m, int prio, const U& hook) return 0; } -template void callhooks(hookset *h, U&&... args) { +template void callhooks(hookset h, U&&... args) { if(h) for(auto& p: *h) p.second(std::forward(args)...); } -template V callhandlers(V zero, hookset *h, U&&... args) { +template V callhandlers(V zero, hookset h, U&&... args) { if(h) for(auto& p: *h) { auto z = p.second(std::forward(args)...); if(z != zero) return z; diff --git a/hypgraph.cpp b/hypgraph.cpp index f060efea..0a5e9c25 100644 --- a/hypgraph.cpp +++ b/hypgraph.cpp @@ -2082,8 +2082,8 @@ EX transmatrix& get_view_orientation() { return prod ? NLP : View; } -EX hookset *hooks_rotate_view; -EX hookset *hooks_shift_view; +EX hookset hooks_rotate_view; +EX hookset hooks_shift_view; /** rotate the view using the given rotation matrix */ EX void rotate_view(transmatrix T) { diff --git a/landlock.cpp b/landlock.cpp index 1cef529e..c7040ece 100644 --- a/landlock.cpp +++ b/landlock.cpp @@ -276,7 +276,7 @@ EX bool createOnSea(eLand old) { (old == laOcean && (chaosmode ? hrand(2) : !generatingEquidistant)); } -EX hookset *hooks_nextland; +EX hookset hooks_nextland; EX eLand getNewLand(eLand old) { diff --git a/menus.cpp b/menus.cpp index 16157bc3..5a67cf5e 100644 --- a/menus.cpp +++ b/menus.cpp @@ -951,7 +951,7 @@ typedef pair named_functionality; inline named_functionality named_dialog(string x, reaction_t dialog) { return named_functionality(x, [dialog] () { pushScreen(dialog); }); } #endif -EX hookset *hooks_o_key; +EX hookset hooks_o_key; EX named_functionality get_o_key() { diff --git a/multigame.cpp b/multigame.cpp index 7c6c0bac..5b54c823 100644 --- a/multigame.cpp +++ b/multigame.cpp @@ -82,7 +82,7 @@ void gamedata::restoregame() { gamedata_all(*this); } -EX hookset *hooks_gamedata; +EX hookset hooks_gamedata; EX namespace gamestack { diff --git a/pattern2.cpp b/pattern2.cpp index 6b070d03..5f459e96 100644 --- a/pattern2.cpp +++ b/pattern2.cpp @@ -1666,7 +1666,7 @@ EX namespace patterns { } } - EX hookset *hooks_generate_canvas; + EX hookset hooks_generate_canvas; EX int generateCanvas(cell *c) { diff --git a/raycaster.cpp b/raycaster.cpp index 4a700473..c9205a0f 100644 --- a/raycaster.cpp +++ b/raycaster.cpp @@ -169,8 +169,8 @@ string build_getter(string type, string name, int index) { #define GET(array, index) array "[" index "]" #endif -EX hookset *hooks_rayshader; -EX hookset)> *hooks_rayset; +EX hookset hooks_rayshader; +EX hookset)> hooks_rayset; void enable_raycaster() { if(geometry != last_geometry) reset_raycaster(); diff --git a/rogueviz/rogueviz.h b/rogueviz/rogueviz.h index d8310f92..3cdb2ae7 100644 --- a/rogueviz/rogueviz.h +++ b/rogueviz/rogueviz.h @@ -107,11 +107,11 @@ namespace rogueviz { extern colorpair dftcolor; - inline hookset *hooks_drawvertex; - inline hookset *hooks_alt_edges; + inline hookset hooks_drawvertex; + inline hookset hooks_alt_edges; inline purehookset hooks_rvmenu; - inline hookset *hooks_rvmenu_replace; - inline hookset *hooks_readcolor; + inline hookset hooks_rvmenu_replace; + inline hookset hooks_readcolor; inline purehookset hooks_close; void readcolor(const string& cfname); @@ -121,7 +121,7 @@ namespace rogueviz { namespace rvtour { using namespace hr::tour; - inline hookset&)> *hooks_build_rvtour; + inline hookset&)> hooks_build_rvtour; slide *gen_rvtour(); template function roguevizslide(char c, const T& t) { diff --git a/shmup.cpp b/shmup.cpp index 653335be..512b01a5 100644 --- a/shmup.cpp +++ b/shmup.cpp @@ -236,7 +236,7 @@ bool isBullet(monster *m) { bool isPlayer(monster *m) { return m->type == moPlayer; } bool isMonster(monster *m) { return m->type != moPlayer && m->type != moBullet; } -EX hookset *hooks_kill; +EX hookset hooks_kill; void killMonster(monster* m, eMonster who_kills, flagtype flags = 0) { int tk = tkills(); @@ -2456,7 +2456,7 @@ EX void fixStorage() { for(monster *m: restore) m->store(); } -EX hookset *hooks_turn; +EX hookset hooks_turn; EX void turn(int delta) { @@ -2771,7 +2771,7 @@ EX bool boatAt(cell *c) { return false; } -EX hookset *hooks_draw; +EX hookset hooks_draw; EX void clearMonsters() { for(mit it = monstersAt.begin(); it != monstersAt.end(); it++) @@ -2833,7 +2833,7 @@ EX void virtualRebase(shmup::monster *m) { virtualRebase(m->base, m->at); } -EX hookset *hooks_describe; +EX hookset hooks_describe; EX void addShmupHelp(string& out) { if(shmup::mousetarget && sqdist(mouseh, tC0(shmup::mousetarget->pat)) < .1) { diff --git a/sound.cpp b/sound.cpp index acd6d134..d35a0cd5 100644 --- a/sound.cpp +++ b/sound.cpp @@ -83,7 +83,7 @@ int musfadeval = 2000; eLand cid = laNone; -hookset *hooks_music; +hookset hooks_music; bool music_out_of_focus = false; @@ -129,7 +129,7 @@ EX void handlemusic() { } } -hookset *hooks_resetmusic; +hookset hooks_resetmusic; EX void resetmusic() { if(audio && musicvolume) { @@ -218,7 +218,7 @@ string wheresounds = SOUNDDESTDIR; string wheresounds = HYPERPATH "sounds/"; #endif -hookset *hooks_sound; +hookset hooks_sound; EX void playSound(cell *c, const string& fname, int vol) { LATE( hr::playSound(c, fname, vol); ) diff --git a/system.cpp b/system.cpp index 88ca5721..10954e42 100644 --- a/system.cpp +++ b/system.cpp @@ -76,7 +76,7 @@ bool do_use_special_land() { } /** \brief Hooks for welcomeMessage. Return true to capture. */ -EX hookset *hooks_welcome_message; +EX hookset hooks_welcome_message; /** \brief Print the welcome message during the start of game. Depends on the current mode and other settings. */ EX void welcomeMessage() { @@ -144,7 +144,7 @@ EX void welcomeMessage() { } /** \brief These hooks are called at the start of initgame. */ -EX hookset *hooks_initgame; +EX hookset hooks_initgame; /** \brief initialize the game */ EX void initgame() { diff --git a/tour.cpp b/tour.cpp index f493bab8..cb21b2d7 100644 --- a/tour.cpp +++ b/tour.cpp @@ -115,7 +115,7 @@ EX function showland; EX string slidecommand; /** \brief hooks to execute after calling presentation */ -EX hookset *hooks_slide; +EX hookset hooks_slide; /** \brief call action(mode) for the current slide. Also sets up some default stuff */ EX void presentation(presmode mode) { @@ -377,7 +377,7 @@ EX namespace ss { string slidechars = "abcdefghijklmnopqrsvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ23456789!@#$%^&*("; - EX hookset *hooks_extra_slideshows; + EX hookset hooks_extra_slideshows; EX void slideshow_menu() { dialog::init(XLAT("slideshows"), forecolor, 150, 100);