fixed land_structure for princess/racing/heptagonal achievements

This commit is contained in:
Zeno Rogue 2022-02-02 03:01:31 +01:00
parent fae4ceb672
commit fd634e6de8
4 changed files with 23 additions and 12 deletions

View File

@ -109,7 +109,7 @@ EX bool wrongMode(char flags) {
if(casual) return true;
if(flags == rg::global) return false;
if(flags != rg::special_geometry) {
if(flags != rg::special_geometry && flags != rg::special_geometry_nicewalls) {
if(!BITRUNCATED) return true;
if(geometry != gNormal) return true;
}
@ -128,12 +128,13 @@ EX bool wrongMode(char flags) {
#if CAP_TOUR
if(tour::on) return true;
#endif
if(flags == rg::special_geometry && !ls::single())
return true;
if(flags != rg::special_geometry && ineligible_starting_land)
return true;
if(flags == rg::chaos && !ls::std_chaos()) return true;
if(flags != rg::chaos && flags != rg::special_geometry && !ls::nice_walls()) return true;
eLandStructure dls = lsNiceWalls;
if(flags == rg::special_geometry || flags == rg::racing || flags == rg::princess)
dls = lsSingle;
if(flags == rg::chaos)
dls = lsChaos;
if(land_structure != dls) return true;
if((numplayers() > 1) != (flags == rg::multi)) return true;
return false;
}

View File

@ -643,7 +643,7 @@ struct info {
}
if(newdist == OUT_OF_PRISON && princess::challenge) {
addMessage(XLAT("Congratulations! Your score is %1.", its(i->value)));
achievement_gain_once("PRINCESS2");
achievement_gain_once("PRINCESS2", rg::princess);
if(!cheater) achievement_score(36, i->value);
LATE( showMissionScreen(); )
}

View File

@ -204,7 +204,15 @@ int modecodetable[42][6] = {
EX modecode_t legacy_modecode() {
if(int(geometry) > 3 || int(variation) > 1) return UNKNOWN;
if(!ls::nice_walls() && !ls::std_chaos() && !yendor::on && !tactic::on) return UNKNOWN;
bool is_default_land_structure =
(princess::challenge || tactic::on) ? ls::single() :
racing::on ? (land_structure == lsSingle) :
yendor::on ? (land_structure == yendor::get_land_structure()) :
ls::nice_walls();
if(!is_default_land_structure && !ls::std_chaos()) return UNKNOWN;
// compute the old code
int xcode = 0;
@ -219,7 +227,7 @@ EX modecode_t legacy_modecode() {
if(elliptic) xcode += 6;
}
if(ls::any_chaos()) xcode += 21;
if(ls::any_chaos() && !yendor::on) xcode += 21;
int np = numplayers()-1; if(np<0 || np>5) np=5;

View File

@ -31,8 +31,10 @@ namespace rg {
static const char global = 'x';
/** \brief wrongmode only -- change vid.scfg.players then restart_game(rg::nothing) instead */
static const char multi = 'm';
/** \brief wrongmode only -- mark achievements for special geometries/variations */
/** \brief wrongmode only -- mark achievements for special geometries/variations, this automatically marks the expected land_structure as lsSingle */
static const char special_geometry = 'g';
/** \brief wrongmode only -- mark achievements for special geometries/variations */
static const char special_geometry_nicewalls = 'G';
}
#endif
@ -1495,7 +1497,7 @@ EX void switch_game_mode(char switchWhat) {
peace::on = false;
tour::on = false;
inv::on = false;
land_structure = lsSingle;
land_structure = racing::on ? lsSingle : lsNiceWalls;
princess::challenge = false;
dual::disable();
break;