Fixed some variable shadowing

This commit is contained in:
Anuken
2020-03-17 10:28:18 -04:00
parent 24f5921863
commit 2c7ff64511
3 changed files with 7 additions and 7 deletions

View File

@@ -260,8 +260,8 @@ public class Control implements ApplicationListener, Loadable{
state.rules.sector = sector; state.rules.sector = sector;
state.set(State.playing); state.set(State.playing);
}catch(SaveException e){ }catch(SaveException e){
sector.save = null;
Log.err(e); Log.err(e);
sector.save = null;
ui.showErrorMessage("$save.corrupted"); ui.showErrorMessage("$save.corrupted");
slot.delete(); slot.delete();
playSector(sector); playSector(sector);

View File

@@ -25,10 +25,10 @@ public class DoubleTurret extends ItemTurret{
public class DoubleTurretEntity extends ItemTurretEntity{ public class DoubleTurretEntity extends ItemTurretEntity{
@Override @Override
protected void shoot(BulletType ammo){ protected void shoot(BulletType ammo){
shots++; shotCount++;
heat = 1f; heat = 1f;
int i = Mathf.signs[shots % 2]; int i = Mathf.signs[shotCount % 2];
tr.trns(rotation - 90, shotWidth * i, size * tilesize / 2); tr.trns(rotation - 90, shotWidth * i, size * tilesize / 2);
bullet(ammo, rotation + Mathf.range(inaccuracy)); bullet(ammo, rotation + Mathf.range(inaccuracy));

View File

@@ -122,7 +122,7 @@ public abstract class Turret extends Block{
public float rotation = 90; public float rotation = 90;
public float recoil = 0f; public float recoil = 0f;
public float heat; public float heat;
public int shots; public int shotCount;
public Posc target; public Posc target;
@Override @Override
@@ -217,7 +217,7 @@ public abstract class Turret extends Block{
entry.amount -= ammoPerShot; entry.amount -= ammoPerShot;
if(entry.amount == 0) ammo.pop(); if(entry.amount == 0) ammo.pop();
totalAmmo -= ammoPerShot; totalAmmo -= ammoPerShot;
Time.run(reload / 2f, () -> ejectEffects()); Time.run(reloadTime / 2f, () -> ejectEffects());
return entry.type(); return entry.type();
} }
@@ -236,7 +236,7 @@ public abstract class Turret extends Block{
} }
protected void updateShooting(){ protected void updateShooting(){
if(reload >= reload){ if(reload >= reloadTime){
BulletType type = peekAmmo(); BulletType type = peekAmmo();
shoot(type); shoot(type);
@@ -254,7 +254,7 @@ public abstract class Turret extends Block{
tr.trns(rotation, size * tilesize / 2f, Mathf.range(xRand)); tr.trns(rotation, size * tilesize / 2f, Mathf.range(xRand));
for(int i = 0; i < shots; i++){ for(int i = 0; i < shots; i++){
bullet(type, rotation + Mathf.range(inaccuracy + type.inaccuracy) + (i - shots / 2) * spread); bullet(type, rotation + Mathf.range(inaccuracy + type.inaccuracy) + (i - shots / 2f) * spread);
} }
effects(); effects();