Fixed crashes with team IDs above 127

This commit is contained in:
Anuken
2020-07-03 12:36:12 -04:00
parent 3772b04c6b
commit 843a8c3e56
18 changed files with 48 additions and 68 deletions
+1 -1
View File
@@ -52,7 +52,7 @@ public class DrawOperation{
}else if(type == OpType.rotation.ordinal()){
return tile.rotation();
}else if(type == OpType.team.ordinal()){
return tile.getTeamID();
return (byte)tile.getTeamID();
}else if(type == OpType.overlay.ordinal()){
return tile.overlayID();
}
+2 -2
View File
@@ -55,7 +55,7 @@ public class EditorTile extends Tile{
op(OpType.block, block.id);
if(rotation != 0) op(OpType.rotation, (byte)rotation);
if(team() != Team.derelict) op(OpType.team, team().id);
if(team() != Team.derelict) op(OpType.team, (byte)team().id);
super.setBlock(type, team, rotation);
}
@@ -67,7 +67,7 @@ public class EditorTile extends Tile{
}
if(getTeamID() == team.id) return;
op(OpType.team, getTeamID());
op(OpType.team, (byte)getTeamID());
super.setTeam(team);
}
+1 -1
View File
@@ -139,7 +139,7 @@ public enum EditorTool{
if(tile.synthetic()){
Team dest = tile.team();
if(dest == editor.drawTeam) return;
fill(editor, x, y, false, t -> t.getTeamID() == (int)dest.id && t.synthetic(), t -> t.setTeam(editor.drawTeam));
fill(editor, x, y, false, t -> t.getTeamID() == dest.id && t.synthetic(), t -> t.setTeam(editor.drawTeam));
}
}
}
@@ -409,7 +409,7 @@ public class MapGenerateDialog extends BaseDialog{
this.floor = floor.id;
this.block = wall.id;
this.ore = ore.id;
this.team = team.id;
this.team = (byte)team.id;
this.rotation = (byte)rotation;
}