Skip to content

Commit 77cc3fb

Browse files
committed
If a land is only accessible from ones that aren't in-game, it's not in-game
Fixes #419.
1 parent fbeb2c5 commit 77cc3fb

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

landlock.cpp

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,41 @@ EX int variant_unlock_value() {
232232
return inv::on ? 75 : 30;
233233
}
234234

235+
EX bool landAccessibleFromIngame(eLand l) {
236+
if(!ls::any_order()) return true;
237+
238+
back:
239+
240+
switch(l) {
241+
#define LAND(a,b,c,d,e,f,g) case c:
242+
#define REQ(x) x return true;
243+
#define REQAS(x,y) l = x; goto back;
244+
#define GOLD(x) ;
245+
#define ITEMS(kind, number) ;
246+
#define NEVER ;
247+
#define ALWAYS ;
248+
#define KILLS(x) ;
249+
#define KILL(x, where) ;
250+
#define AKILL(x, where) ;
251+
#define ORD(a, b) a b
252+
#define NUMBER(val, required, description) ;
253+
#define COND(x,y) ;
254+
#define ITEMS_TOTAL(list, z) ;
255+
#define ACCONLY(x) if(!isLandIngame(x)) return false;
256+
#define ACCONLY2(x,y) if(!isLandIngame(x) && !isLandIngame(y)) return false;
257+
#define ACCONLY3(x,y,z) if(!isLandIngame(x) && !isLandIngame(y) && !isLandIngame(z)) return false;
258+
#define ACCONLY4(a,b,c,d) if(!isLandIngame(a) && !isLandIngame(b) && !isLandIngame(c) && !isLandIngame(d)) return false;
259+
#define ACCONLY5(a,b,c,d,e) if(!isLandIngame(a) && !isLandIngame(b) && !isLandIngame(c) && !isLandIngame(d) && !isLandIngame(e)) return false;
260+
#define ACCONLYF(x) if(!isLandIngame(x)) return false;
261+
#define IFINGAME(land, ok, fallback) if(isLandIngame(land)) { ok } else { fallback }
262+
#define INMODE(x) ;
263+
#include "content.cpp"
264+
265+
case landtypes: return false;
266+
}
267+
return false;
268+
}
269+
235270
EX bool landUnlocked(eLand l) {
236271
if(randomPatternsMode) {
237272
return landUnlockedRPM(l);
@@ -802,7 +837,8 @@ EX bool isLandIngame(eLand l) {
802837
if(dual::state == 2 && !dual::check_side(l)) return false;
803838
if((eubinary || sol) && isCyclic(l) && l != specialland) return false;
804839
if(l == laCamelot && hyperbolic && WDIM == 3) return false;
805-
return land_validity(l).flags & lv::appears_in_full;
840+
if(!(land_validity(l).flags & lv::appears_in_full)) return false;
841+
return landAccessibleFromIngame(l);
806842
}
807843

808844
EX bool landUnlockedIngame(eLand l) {

0 commit comments

Comments
 (0)