Fixes error when creating a new character

This commit is contained in:
Collin Smith
2019-11-26 21:43:49 -08:00
parent 1deed6c690
commit 96823c46b3
3 changed files with 14 additions and 2 deletions

View File

@ -479,6 +479,17 @@ public class Engine extends PooledEngine {
CofComponent cofComponent = createComponent(CofComponent.class);
cofComponent.mode = Player.MODE_TN;
if (charData.getD2S().file == null) {
// FIXME: extra checks to prevent crashes due to no save file existing -- see TransformUpdateSystem NPE fix
cofComponent.wclass = CofComponent.WEAPON_HTH;
cofComponent.setComponent(COF.Component.HD, CofComponent.COMPONENT_LIT);
cofComponent.setComponent(COF.Component.TR, CofComponent.COMPONENT_LIT);
cofComponent.setComponent(COF.Component.LG, CofComponent.COMPONENT_LIT);
cofComponent.setComponent(COF.Component.RA, CofComponent.COMPONENT_LIT);
cofComponent.setComponent(COF.Component.LA, CofComponent.COMPONENT_LIT);
cofComponent.setComponent(COF.Component.S1, CofComponent.COMPONENT_LIT);
cofComponent.setComponent(COF.Component.S2, CofComponent.COMPONENT_LIT);
}
AnimationComponent animationComponent = createComponent(AnimationComponent.class);

View File

@ -36,7 +36,9 @@ public class TransformUpdateSystem extends IteratingSystem {
for (int l = 0, numLayers = cof.getNumLayers(); l < numLayers; l++) {
int component = cofComponent.cof.getLayer(l).component;
if (!Dirty.isDirty(flags, component)) continue;
animation.getLayer(component).setTransform(transform[component]);
// FIXME: NPE check here shouldn't be needed -- see note in Engine#createPlayer
Animation.Layer layer = animation.getLayer(component);
if (layer != null) layer.setTransform(transform[component]);
}
entity.remove(TransformUpdate.class);

View File

@ -330,7 +330,6 @@ public class CreateCharacterScreen extends ScreenAdapter {
Riiablo.client.addScreenBoundsListener(screenBoundsListener = new Client.ScreenBoundsListener() {
@Override
public void updateScreenBounds(float x, float y, float width, float height) {
System.out.println("y = " + y);
charOptions.setPosition(stage.getWidth() / 2, y + 20, Align.bottom | Align.center);
}
});