V0.2.1a: HOTFIX commit, corrected sewer boss map generation issue (note to self - a character should never under any circumstances be able to walk into the outer ring of the map)

This commit is contained in:
Evan Debenham 2014-10-13 23:07:57 -04:00
parent 054b8135db
commit be836db8a1

View File

@ -64,13 +64,13 @@ public class SewerBossLevel extends RegularLevel {
int retry = 0; int retry = 0;
//start with finding an entrance room (will also contain exit) //start with finding an entrance room (will also contain exit)
//the room must be at least 4x4 and be at the top of the map(so that nothing can connect with the top) //the room must be at least 4x4 and be nearer the top of the map(so that it is less likely something connects to the top)
do { do {
if (retry++ > 20) { if (retry++ > 20) {
return false; return false;
} }
roomEntrance = Random.element( rooms ); roomEntrance = Random.element( rooms );
} while (roomEntrance.width() < 4 || roomEntrance.height() < 4 || roomEntrance.top != 0); } while (roomEntrance.width() < 4 || roomEntrance.height() < 4 || roomEntrance.top == 0 || roomEntrance.top >= 12);
roomEntrance.type = Type.ENTRANCE; roomEntrance.type = Type.ENTRANCE;
roomExit = roomEntrance; roomExit = roomEntrance;
@ -152,6 +152,12 @@ public class SewerBossLevel extends RegularLevel {
} }
} }
//make sure nothing is connecting at the top of the entrance, this would be bad.
for (Room r : roomEntrance.neigbours){
if (r.bottom == roomEntrance.top && r.type != Type.NULL)
return false;
}
paint(); paint();
//TODO: not handling this through a painter is kinda iffy, separate into a painter if you use it again. //TODO: not handling this through a painter is kinda iffy, separate into a painter if you use it again.