added some missing guards for CAP_RACING and CAP_COMMANDLINE
This commit is contained in:
parent
de5e0505a3
commit
ff16f35e0b
|
@ -1737,8 +1737,10 @@ EX void choose() {
|
||||||
dialog::openFileDialog(tes, XLAT("open a tiling"), ".tes",
|
dialog::openFileDialog(tes, XLAT("open a tiling"), ".tes",
|
||||||
[] () {
|
[] () {
|
||||||
run(tes);
|
run(tes);
|
||||||
|
#if CAP_COMMANDLINE
|
||||||
if(!current.options.empty())
|
if(!current.options.empty())
|
||||||
dialog::push_confirm_dialog([] { arg::run_arguments(current.options); start_game(); }, "load the settings defined in this file?");
|
dialog::push_confirm_dialog([] { arg::run_arguments(current.options); start_game(); }, "load the settings defined in this file?");
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -691,7 +691,9 @@ EX namespace mapstream {
|
||||||
void save_only_map(hstream& f) {
|
void save_only_map(hstream& f) {
|
||||||
f.write(patterns::whichPattern);
|
f.write(patterns::whichPattern);
|
||||||
save_geometry(f);
|
save_geometry(f);
|
||||||
|
#if CAP_RACING
|
||||||
if(racing::on) racing::restore_goals();
|
if(racing::on) racing::restore_goals();
|
||||||
|
#endif
|
||||||
|
|
||||||
// game settings
|
// game settings
|
||||||
f.write(safety);
|
f.write(safety);
|
||||||
|
@ -821,12 +823,17 @@ EX namespace mapstream {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(f.vernum >= 0xA912) {
|
if(f.vernum >= 0xA912) {
|
||||||
|
#if CAP_RACING
|
||||||
f.write(racing::on);
|
f.write(racing::on);
|
||||||
if(racing::on) {
|
if(racing::on) {
|
||||||
f.write<int>(isize(racing::track));
|
f.write<int>(isize(racing::track));
|
||||||
for(auto& t: racing::track) f.write<int>(cellids[t]);
|
for(auto& t: racing::track) f.write<int>(cellids[t]);
|
||||||
racing::save_ghosts(f);
|
racing::save_ghosts(f);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
bool on = false;
|
||||||
|
f.write(on);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
callhooks(hooks_savemap, f);
|
callhooks(hooks_savemap, f);
|
||||||
|
@ -1074,6 +1081,7 @@ EX namespace mapstream {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(f.vernum >= 0xA912) {
|
if(f.vernum >= 0xA912) {
|
||||||
|
#if CAP_RACING
|
||||||
f.read(racing::on);
|
f.read(racing::on);
|
||||||
if(racing::on) {
|
if(racing::on) {
|
||||||
if(!shmup::on) {
|
if(!shmup::on) {
|
||||||
|
@ -1085,6 +1093,10 @@ EX namespace mapstream {
|
||||||
racing::load_ghosts(f);
|
racing::load_ghosts(f);
|
||||||
racing::configure_track(false);
|
racing::configure_track(false);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
bool on;
|
||||||
|
f.read(on);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if(f.vernum >= 0xA848) {
|
if(f.vernum >= 0xA848) {
|
||||||
|
|
|
@ -753,6 +753,7 @@ EX void initConfig() {
|
||||||
}
|
}
|
||||||
|
|
||||||
EX void get_actions() {
|
EX void get_actions() {
|
||||||
|
#if !ISMOBILE
|
||||||
const Uint8 *keystate = SDL12_GetKeyState(NULL);
|
const Uint8 *keystate = SDL12_GetKeyState(NULL);
|
||||||
|
|
||||||
for(int i=0; i<NUMACT; i++)
|
for(int i=0; i<NUMACT; i++)
|
||||||
|
@ -787,6 +788,7 @@ EX void get_actions() {
|
||||||
axespressed[scfg.axeaction[j][b] % SHMUPAXES] += value;
|
axespressed[scfg.axeaction[j][b] % SHMUPAXES] += value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1079,6 +1079,7 @@ EX void saveStats(bool emergency IS(false)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CAP_RACING
|
||||||
if(racing::on) {
|
if(racing::on) {
|
||||||
if(racing::official_race && !cheater) {
|
if(racing::official_race && !cheater) {
|
||||||
fprintf(f, "RACING %s %d %d date: %s\n", VER,
|
fprintf(f, "RACING %s %d %d date: %s\n", VER,
|
||||||
|
@ -1088,6 +1089,7 @@ EX void saveStats(bool emergency IS(false)) {
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
fprintf(f, "HyperRogue: game statistics (version " VER ")\n");
|
fprintf(f, "HyperRogue: game statistics (version " VER ")\n");
|
||||||
if(cheater)
|
if(cheater)
|
||||||
|
@ -1255,6 +1257,7 @@ EX void loadsave() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CAP_RACING
|
||||||
if(buf[0] == 'R' && buf[1] == 'A' && buf[2] == 'C') {
|
if(buf[0] == 'R' && buf[1] == 'A' && buf[2] == 'C') {
|
||||||
char buf1[80], ver[10];
|
char buf1[80], ver[10];
|
||||||
int land, score;
|
int land, score;
|
||||||
|
@ -1262,6 +1265,7 @@ EX void loadsave() {
|
||||||
racing::best_scores[eLand(land)] = score;
|
racing::best_scores[eLand(land)] = score;
|
||||||
println(hlog, "loaded the score for ", dnameof(eLand(land)), " of ", score);
|
println(hlog, "loaded the score for ", dnameof(eLand(land)), " of ", score);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
@ -1618,11 +1622,13 @@ EX void start_game() {
|
||||||
// popAllScreens + popAllGames + stop_game + switch_game_mode + start_game
|
// popAllScreens + popAllGames + stop_game + switch_game_mode + start_game
|
||||||
EX void restart_game(char switchWhat IS(rg::nothing)) {
|
EX void restart_game(char switchWhat IS(rg::nothing)) {
|
||||||
popScreenAll();
|
popScreenAll();
|
||||||
|
#if CAP_RACING
|
||||||
if(switchWhat == rg::nothing && racing::on) {
|
if(switchWhat == rg::nothing && racing::on) {
|
||||||
racing::restore_goals();
|
racing::restore_goals();
|
||||||
racing::reset_race();
|
racing::reset_race();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
stop_game();
|
stop_game();
|
||||||
switch_game_mode(switchWhat);
|
switch_game_mode(switchWhat);
|
||||||
start_game();
|
start_game();
|
||||||
|
|
Loading…
Reference in New Issue