1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-06-19 23:04:08 +00:00

added some missing CAP_ guards

This commit is contained in:
Zeno Rogue 2018-12-15 15:17:06 +01:00
parent cd001102f8
commit 4e4fce922e
9 changed files with 37 additions and 8 deletions

View File

@ -205,6 +205,7 @@ namespace binary {
return gm * where; return gm * where;
} }
#if CAP_COMMANDLINE
auto bt_config = addHook(hooks_args, 0, [] () { auto bt_config = addHook(hooks_args, 0, [] () {
using namespace arg; using namespace arg;
if(argis("-btwidth")) { if(argis("-btwidth")) {
@ -213,6 +214,7 @@ auto bt_config = addHook(hooks_args, 0, [] () {
} }
return 1; return 1;
}); });
#endif
} }
} }

View File

@ -1056,7 +1056,7 @@ namespace conformal {
#endif #endif
} }
#if CAP_COMMANDLINE
int readArgs() { int readArgs() {
using namespace arg; using namespace arg;
@ -1126,7 +1126,10 @@ namespace conformal {
else return 1; else return 1;
return 0; return 0;
} }
auto hookArg = addHook(hooks_args, 100, readArgs);
#endif
auto hooks = addHook(clearmemory, 0, [] () { auto hooks = addHook(clearmemory, 0, [] () {
conformal::renderAutoband(); conformal::renderAutoband();
conformal::on = false; conformal::on = false;
@ -1134,7 +1137,7 @@ namespace conformal {
conformal::findhistory.clear(); conformal::findhistory.clear();
conformal::movehistory.clear(); conformal::movehistory.clear();
conformal::includeHistory = false; conformal::includeHistory = false;
}) + addHook(hooks_args, 100, readArgs); });
} }

View File

@ -225,12 +225,14 @@ bool doexiton(int sym, int uni) {
if(sym == SDLK_ESCAPE) return true; if(sym == SDLK_ESCAPE) return true;
if(sym == SDLK_F10) return true; if(sym == SDLK_F10) return true;
if(sym == PSEUDOKEY_RELEASE) return false; if(sym == PSEUDOKEY_RELEASE) return false;
#ifndef FAKE_SDL
if(sym == SDLK_LSHIFT) return false; if(sym == SDLK_LSHIFT) return false;
if(sym == SDLK_RSHIFT) return false; if(sym == SDLK_RSHIFT) return false;
if(sym == SDLK_LCTRL) return false; if(sym == SDLK_LCTRL) return false;
if(sym == SDLK_RCTRL) return false; if(sym == SDLK_RCTRL) return false;
if(sym == SDLK_LALT) return false; if(sym == SDLK_LALT) return false;
if(sym == SDLK_RALT) return false; if(sym == SDLK_RALT) return false;
#endif
if(uni != 0) return true; if(uni != 0) return true;
return false; return false;
} }
@ -837,11 +839,16 @@ void displayabutton(int px, int py, string s, int col) {
#endif #endif
bool interpret_as_direction(int sym, int uni) { bool interpret_as_direction(int sym, int uni) {
#ifdef FAKE_SDL
return false;
#else
return (sym >= SDLK_KP0 && sym <= SDLK_KP9 && !numlock_on); return (sym >= SDLK_KP0 && sym <= SDLK_KP9 && !numlock_on);
#endif
} }
int get_direction_key(int sym, int uni) { int get_direction_key(int sym, int uni) {
if(interpret_as_direction(sym, uni)) { if(interpret_as_direction(sym, uni)) {
#ifndef FAKE_SDL
if(sym == SDLK_KP1) return SDLK_END; if(sym == SDLK_KP1) return SDLK_END;
if(sym == SDLK_KP2) return SDLK_DOWN; if(sym == SDLK_KP2) return SDLK_DOWN;
if(sym == SDLK_KP3) return SDLK_PAGEDOWN; if(sym == SDLK_KP3) return SDLK_PAGEDOWN;
@ -850,6 +857,7 @@ int get_direction_key(int sym, int uni) {
if(sym == SDLK_KP7) return SDLK_HOME; if(sym == SDLK_KP7) return SDLK_HOME;
if(sym == SDLK_KP8) return SDLK_UP; if(sym == SDLK_KP8) return SDLK_UP;
if(sym == SDLK_KP8) return SDLK_PAGEUP; if(sym == SDLK_KP8) return SDLK_PAGEUP;
#endif
return 0; return 0;
} }
return sym; return sym;

View File

@ -1036,6 +1036,7 @@ void unit_test_tables() {
test_crt(); test_crt();
} }
#if CAP_COMMANDLINE
int readArgs() { int readArgs() {
using namespace arg; using namespace arg;
@ -1065,6 +1066,7 @@ int readArgs() {
else return 1; else return 1;
return 0; return 0;
} }
#endif
hrmap *new_map() { hrmap *new_map() {
return new hrmap_crystal; return new hrmap_crystal;
@ -1125,7 +1127,10 @@ void show() {
dialog::display(); dialog::display();
} }
auto crystalhook = addHook(hooks_args, 100, readArgs) auto crystalhook =
#if CAP_COMMANDLINE
addHook(hooks_args, 100, readArgs)
#endif
+ addHook(hooks_drawcell, 100, crystal_cell) + addHook(hooks_drawcell, 100, crystal_cell)
+ addHook(hooks_tests, 200, unit_test_tables); + addHook(hooks_tests, 200, unit_test_tables);

View File

@ -752,6 +752,7 @@ void compute_coefficients() {
} }
} }
#if CAP_COMMANDLINE
int expansion_readArgs() { int expansion_readArgs() {
using namespace arg; using namespace arg;
@ -838,6 +839,7 @@ int expansion_readArgs() {
auto ea_hook = addHook(hooks_args, 100, expansion_readArgs); auto ea_hook = addHook(hooks_args, 100, expansion_readArgs);
#endif #endif
#endif
expansion_analyzer expansion; expansion_analyzer expansion;

View File

@ -1270,7 +1270,9 @@ void draw_boundary(int w) {
ld fakeinf = sphere ? M_PI-1e-5 : hyperbolic ? 10 : exp(10); ld fakeinf = sphere ? M_PI-1e-5 : hyperbolic ? 10 : exp(10);
#if CAP_SVG
dynamicval<ld> dw(vid.linewidth, vid.linewidth * (svg::in ? svg::divby : 1)); dynamicval<ld> dw(vid.linewidth, vid.linewidth * (svg::in ? svg::divby : 1));
#endif
if(elliptic && !among(pmodel, mdBand, mdBandEquidistant, mdBandEquiarea, mdSinusoidal)) if(elliptic && !among(pmodel, mdBand, mdBandEquidistant, mdBandEquiarea, mdSinusoidal))
circle_around_center(M_PI/2, periodcolor, 0, PPR::CIRCLE); circle_around_center(M_PI/2, periodcolor, 0, PPR::CIRCLE);

View File

@ -915,6 +915,7 @@ void show() {
dialog::display(); dialog::display();
} }
#if CAP_COMMANDLINE
int readArgs() { int readArgs() {
using namespace arg; using namespace arg;
@ -979,10 +980,13 @@ int readArgs() {
else return 1; else return 1;
return 0; return 0;
} }
#endif
auto animhook = addHook(hooks_args, 100, readArgs) auto animhook = addHook(hooks_frame, 100, display_animation)
+ addHook(hooks_frame, 100, display_animation) #if CAP_COMMANDLINE
+ 0; + addHook(hooks_args, 100, readArgs)
#endif
;
bool any_animation() { bool any_animation() {
if(conformal::on) return true; if(conformal::on) return true;

View File

@ -242,7 +242,8 @@ struct key_configurer {
popScreen(); popScreen();
} }
}; };
#if CAP_SDLJOY
joyhandler = [this] (SDL_Event& ev) { joyhandler = [this] (SDL_Event& ev) {
if(ev.type == SDL_JOYBUTTONDOWN && setwhat) { if(ev.type == SDL_JOYBUTTONDOWN && setwhat) {
int joyid = ev.jbutton.which; int joyid = ev.jbutton.which;
@ -270,6 +271,7 @@ struct key_configurer {
} }
return false; return false;
}; };
#endif
} }
}; };

View File

@ -323,6 +323,7 @@
#define SDLK_DELETE (123052) #define SDLK_DELETE (123052)
#define SDLK_KP_ENTER (123054) #define SDLK_KP_ENTER (123054)
#define SDLK_BACKSPACE (123055) #define SDLK_BACKSPACE (123055)
#define FAKE_SDL
typedef int SDL_Event; typedef int SDL_Event;
typedef unsigned int Uint32; typedef unsigned int Uint32;
#endif #endif