Fixed NPE when the default player.txt does not exist. Fixed bug when requesting PowerUp component of invalid length. Change default lives to 1.
This commit is contained in:
@@ -1137,46 +1137,52 @@ public class PCGLevel extends Level {
|
||||
LevelComponent.TYPE lctype = lcomp.getType();
|
||||
System.out.println("Building for: " + lcomp);
|
||||
while (length < Math.min(width - 64, lcomp.getEnd())) {
|
||||
int lcLength;
|
||||
switch (lctype) {
|
||||
case FLAT_LO:
|
||||
case FLAT_HI:
|
||||
length += buildStraight(length, lcomp.getEnd(), true);
|
||||
lcLength = buildStraight(length, lcomp.getEnd(), true);
|
||||
break;
|
||||
case PIPE_JUMP:
|
||||
length += buildPipeJump(length, width - 64 - length);
|
||||
lcLength = buildPipeJump(length, width - 64 - length);
|
||||
break;
|
||||
case PLATFORM_JUMP:
|
||||
length += buildPlatformJump(length, width - 64 - length);
|
||||
lcLength = buildPlatformJump(length, width - 64 - length);
|
||||
break;
|
||||
case MAZE:
|
||||
length += buildMaze(length, width - 64 - length);
|
||||
lcLength = buildMaze(length, width - 64 - length);
|
||||
break;
|
||||
case BLOCKS:
|
||||
length += buildMaze(length, width - 64 - length);
|
||||
lcLength = buildMaze(length, width - 64 - length);
|
||||
break;
|
||||
case BOWLING_ALLEY :
|
||||
length += buildBowlingAlley(length, width - 64 - length);
|
||||
lcLength = buildBowlingAlley(length, width - 64 - length);
|
||||
break;
|
||||
case CANNON_LINE :
|
||||
length += buildCannonLine(length, width - 64 - length);
|
||||
lcLength = buildCannonLine(length, width - 64 - length);
|
||||
break;
|
||||
case COIN_DIVE :
|
||||
length += buildCoinDive(length, width - 64 - length);
|
||||
lcLength = buildCoinDive(length, width - 64 - length);
|
||||
break;
|
||||
case LEMMING_TRAP :
|
||||
length += buildLemmingTrap(length, width - 64 - length);
|
||||
lcLength = buildLemmingTrap(length, width - 64 - length);
|
||||
break;
|
||||
case POWER_UP :
|
||||
length += buildFreebie(length, width - 64 - length);
|
||||
lcLength = buildFreebie(length, width - 64 - length);
|
||||
break;
|
||||
case SINGLE_PIT :
|
||||
length += buildSinglePit(length, width - 64 - length);
|
||||
lcLength = buildSinglePit(length, width - 64 - length);
|
||||
break;
|
||||
default:
|
||||
lcLength = 0;
|
||||
System.out
|
||||
.println("Cannot build level segment for unrecognized LevelComponent type: "
|
||||
+ type);
|
||||
}
|
||||
if (lcLength == 0) {
|
||||
lcLength = buildStraight(length, lcomp.getEnd(), true);
|
||||
}
|
||||
length += lcLength;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1247,8 +1253,7 @@ public class PCGLevel extends Level {
|
||||
playerMetrics, dataRecorder);
|
||||
System.out.println("PlayerProfile: " + profile);
|
||||
|
||||
LevelArchetype archetype = ArchetypeMatcher.getMatchingArchetype(
|
||||
playerMetrics, dataRecorder);
|
||||
LevelArchetype archetype = ArchetypeMatcher.getMatchingArchetype(profile);
|
||||
System.out.println("LevelArchetype: " + archetype);
|
||||
|
||||
System.out.println("Creating level grammar");
|
||||
|
||||
Reference in New Issue
Block a user