Renamed internal 'noWaves' mode / Fixed text encoding issues
This commit is contained in:
@@ -11,7 +11,7 @@ public enum GameMode{
|
||||
freebuild{{
|
||||
disableWaveTimer = true;
|
||||
}},
|
||||
noWaves{{
|
||||
attack{{
|
||||
disableWaves = true;
|
||||
hidden = true;
|
||||
enemyCheat = true;
|
||||
|
||||
@@ -38,7 +38,7 @@ public class BattleMission extends MissionWithStartingCore{
|
||||
|
||||
@Override
|
||||
public GameMode getMode(){
|
||||
return GameMode.noWaves;
|
||||
return GameMode.attack;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,10 +2,8 @@ package io.anuke.mindustry.maps.missions;
|
||||
|
||||
import com.badlogic.gdx.math.GridPoint2;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.content.blocks.StorageBlocks;
|
||||
import io.anuke.mindustry.game.GameMode;
|
||||
import io.anuke.mindustry.game.SpawnGroup;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.game.UnlockableContent;
|
||||
import io.anuke.mindustry.maps.Sector;
|
||||
import io.anuke.mindustry.maps.generation.Generation;
|
||||
@@ -34,7 +32,7 @@ public abstract class Mission{
|
||||
}
|
||||
|
||||
public GameMode getMode(){
|
||||
return GameMode.noWaves;
|
||||
return GameMode.attack;
|
||||
}
|
||||
|
||||
/**Sets the message displayed on mission begin. Returns this mission for chaining.*/
|
||||
|
||||
@@ -74,7 +74,7 @@ public class WaveMission extends MissionWithStartingCore{
|
||||
@Override
|
||||
public void update(){
|
||||
if(state.wave > target){
|
||||
state.mode = GameMode.noWaves;
|
||||
state.mode = GameMode.attack;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package io.anuke.mindustry.net;
|
||||
|
||||
import io.anuke.mindustry.game.GameMode;
|
||||
|
||||
public class Host{
|
||||
public final String name;
|
||||
public final String address;
|
||||
@@ -8,8 +10,9 @@ public class Host{
|
||||
public final int players;
|
||||
public final int version;
|
||||
public final String versionType;
|
||||
public final GameMode mode;
|
||||
|
||||
public Host(String name, String address, String mapname, int wave, int players, int version, String versionType){
|
||||
public Host(String name, String address, String mapname, int wave, int players, int version, String versionType, GameMode mode){
|
||||
this.name = name;
|
||||
this.address = address;
|
||||
this.players = players;
|
||||
@@ -17,5 +20,6 @@ public class Host{
|
||||
this.wave = wave;
|
||||
this.version = version;
|
||||
this.versionType = versionType;
|
||||
this.mode = mode;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import io.anuke.ucore.util.Bits;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
@@ -305,17 +306,18 @@ public class NetworkIO{
|
||||
|
||||
ByteBuffer buffer = ByteBuffer.allocate(128);
|
||||
|
||||
buffer.put((byte) host.getBytes().length);
|
||||
buffer.put(host.getBytes());
|
||||
buffer.put((byte) host.getBytes(StandardCharsets.UTF_8).length);
|
||||
buffer.put(host.getBytes(StandardCharsets.UTF_8));
|
||||
|
||||
buffer.put((byte) map.getBytes().length);
|
||||
buffer.put(map.getBytes());
|
||||
buffer.put((byte) map.getBytes(StandardCharsets.UTF_8).length);
|
||||
buffer.put(map.getBytes(StandardCharsets.UTF_8));
|
||||
|
||||
buffer.putInt(playerGroup.size());
|
||||
buffer.putInt(state.wave);
|
||||
buffer.putInt(Version.build);
|
||||
buffer.put((byte)Version.type.getBytes().length);
|
||||
buffer.put(Version.type.getBytes());
|
||||
buffer.put((byte)Version.type.getBytes(StandardCharsets.UTF_8).length);
|
||||
buffer.put(Version.type.getBytes(StandardCharsets.UTF_8));
|
||||
buffer.put((byte)state.mode.ordinal());
|
||||
return buffer;
|
||||
}
|
||||
|
||||
@@ -328,8 +330,8 @@ public class NetworkIO{
|
||||
byte[] mb = new byte[mlength];
|
||||
buffer.get(mb);
|
||||
|
||||
String host = new String(hb);
|
||||
String map = new String(mb);
|
||||
String host = new String(hb, StandardCharsets.UTF_8);
|
||||
String map = new String(mb, StandardCharsets.UTF_8);
|
||||
|
||||
int players = buffer.getInt();
|
||||
int wave = buffer.getInt();
|
||||
@@ -337,8 +339,9 @@ public class NetworkIO{
|
||||
byte tlength = buffer.get();
|
||||
byte[] tb = new byte[tlength];
|
||||
buffer.get(tb);
|
||||
String vertype = new String(tb);
|
||||
String vertype = new String(tb, StandardCharsets.UTF_8);
|
||||
GameMode mode = GameMode.values()[buffer.get()];
|
||||
|
||||
return new Host(host, hostAddress, map, wave, players, version, vertype);
|
||||
return new Host(host, hostAddress, map, wave, players, version, vertype, mode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,7 +252,6 @@ public class PowerNode extends PowerBlock{
|
||||
Draw.color(Palette.powerLight, Palette.power, Mathf.absin(Timers.time(), 8f, 1f));
|
||||
Lines.stroke(2f);
|
||||
Lines.line(x1, y1, x2, y2);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user