Description: More fixes for D language changes
  With this patch the code is accepted by gdc-8 8-20180414-1 without
  triggering deprecated feature warnings.
  - Convert I/O to use std.stdio module
  - Some other modules got renamed
  - Avoid C-style array type notation
  - Replace deprecated "<>=" operator using isNaN().
  - Rename Actor's "init()" method to "init_()" so that it no longer shadows
    D's standard "init" property and we can use the standard library sort
    function. 
Author: Peter De Wachter <pdewacht@gmail.com>
Forwarded: no

--- a/src/abagames/ttn/boot.d
+++ b/src/abagames/ttn/boot.d
@@ -7,9 +7,9 @@
 
 private import std.string;
 private import std.conv;
-private import std.stream;
+private import std.stdio;
 private import std.math;
-private import std.c.stdlib;
+private import core.stdc.stdlib;
 private import abagames.util.logger;
 private import abagames.util.tokenizer;
 private import abagames.util.sdl.mainloop;
@@ -52,7 +52,7 @@
     _minit();
     try {
       _moduleCtor();
-      char exe[4096];
+      char[4096] exe;
       GetModuleFileNameA(null, exe, 4096);
       string[1] prog;
       prog[0] = to!string(exe);
--- a/src/abagames/ttn/bullet.d
+++ b/src/abagames/ttn/bullet.d
@@ -128,7 +128,7 @@
       ppos.y = pos.y;
       tailPos.x = pos.x;
       tailPos.y = pos.y;
-      assert(deg <>= 0);
+      assert(!isNaN(deg));
     }
   }
 
--- a/src/abagames/ttn/enemy.d
+++ b/src/abagames/ttn/enemy.d
@@ -191,8 +191,8 @@
 public class Enemy: Token!(EnemyState, EnemySpec) {
  private:
 
-  public override void init(Object[] args) {
-    super.init(args);
+  public override void init_(Object[] args) {
+    super.init_(args);
     state.enemy = this;
   }
 
@@ -327,19 +327,19 @@
       assert(baseSpeed >= 0);
       assert(baseAngVel >= 0);
       assert(angVel >= 0);
-      assert(centerPos.x <>= 0);
-      assert(centerPos.y <>= 0);
-      assert(centerVel.x <>= 0);
-      assert(centerVel.y <>= 0);
-      assert(shield <>= 0);
+      assert(!isNaN(centerPos.x));
+      assert(!isNaN(centerPos.y));
+      assert(!isNaN(centerVel.x));
+      assert(!isNaN(centerVel.y));
+      assert(!isNaN(shield));
       assert(captureState >= 0);
-      assert(size.x <>= 0);
-      assert(size.y <>= 0);
-      assert(targetSize.x <>= 0);
-      assert(targetSize.y <>= 0);
-      assert(sizeVel.x <>= 0);
-      assert(sizeVel.y <>= 0);
-      assert(anger <>= 0);
+      assert(!isNaN(size.x));
+      assert(!isNaN(size.y));
+      assert(!isNaN(targetSize.x));
+      assert(!isNaN(targetSize.y));
+      assert(!isNaN(sizeVel.x));
+      assert(!isNaN(sizeVel.y));
+      assert(!isNaN(anger));
     }
   }
 
@@ -543,7 +543,7 @@
           deg -= av;
         else
           deg = td;
-        assert(deg <>= 0);
+        assert(!isNaN(deg));
         for (int i = 0; i < turretNum; i++) {
           TurretState ts = turretStates[i];
           float tx = pos.x;
@@ -989,9 +989,9 @@
   int cnt;
 
   invariant() {
-    assert(pos.x <>= 0);
-    assert(pos.y <>= 0);
-    assert(deg <>= 0);
+    assert(!isNaN(pos.x));
+    assert(!isNaN(pos.y));
+    assert(!isNaN(deg));
   }
 
   public this() {
@@ -1444,8 +1444,8 @@
 
   invariant() {
     if (isInitialized) {
-      assert(fireCnt <>= 0);
-      assert(burstCnt <>= 0);
+      assert(!isNaN(fireCnt));
+      assert(!isNaN(burstCnt));
     }
   }
 
@@ -1496,9 +1496,9 @@
     assert(burstInterval >= 0);
     assert(nway >= 1);
     assert(nwayAngle >= 0);
-    assert(nwayBaseDeg <>= 0);
-    assert(nwaySpeedAccel <>= 0);
-    assert(fireIntervalRatio <>= 0);
+    assert(!isNaN(nwayBaseDeg));
+    assert(!isNaN(nwaySpeedAccel));
+    assert(!isNaN(fireIntervalRatio));
     assert(minimumFireDist >= 0);
   }
 
--- a/src/abagames/ttn/particle.d
+++ b/src/abagames/ttn/particle.d
@@ -35,8 +35,8 @@
   private QuadParticleSpec quadParticleSpec;
   private BonusParticleSpec bonusParticleSpec;
 
-  public override void init(Object[] args) {
-    super.init(args);
+  public override void init_(Object[] args) {
+    super.init_(args);
     triangleParticleSpec = cast(TriangleParticleSpec) args[0];
     lineParticleSpec = cast(LineParticleSpec) args[1];
     quadParticleSpec = cast(QuadParticleSpec) args[2];
@@ -110,23 +110,23 @@
 
   invariant() {
     if (isInitialized) {
-      assert(pos.x <>= 0);
-      assert(pos.y <>= 0);
-      assert(vel.x <>= 0);
-      assert(vel.y <>= 0);
-      assert(tailPos.x <>= 0);
-      assert(tailPos.y <>= 0);
+      assert(!isNaN(pos.x));
+      assert(!isNaN(pos.y));
+      assert(!isNaN(vel.x));
+      assert(!isNaN(vel.y));
+      assert(!isNaN(tailPos.x));
+      assert(!isNaN(tailPos.y));
       assert(size > 0 && size < 20);
       assert(r >= 0 && r <= 1);
       assert(g >= 0 && g <= 1);
       assert(b >= 0 && b <= 1);
       assert(a >= 0 && a <= 1);
-      assert(d1 <>= 0);
-      assert(d2 <>= 0);
-      assert(vd1 <>= 0);
-      assert(vd2 <>= 0);
-      assert(num <>= 0);
-      assert(trgNum <>= 0);
+      assert(!isNaN(d1));
+      assert(!isNaN(d2));
+      assert(!isNaN(vd1));
+      assert(!isNaN(vd2));
+      assert(!isNaN(num));
+      assert(!isNaN(trgNum));
       assert(trgSize > 0);
     }
   }
--- a/src/abagames/ttn/player.d
+++ b/src/abagames/ttn/player.d
@@ -180,10 +180,10 @@
 
   invariant() {
     if (isInitialized) {
-      assert(vel.x <>= 0);
-      assert(vel.y <>= 0);
+      assert(!isNaN(vel.x));
+      assert(!isNaN(vel.y));
       assert(capturedEnemyWidth >= 0);
-      assert(captureBeamEnergy <>= 0);
+      assert(!isNaN(captureBeamEnergy));
     }
   }
 
@@ -444,7 +444,7 @@
       pos.y += (vy * speed);
       if (!(input.button & PadState.Button.B))
         deg += (-TILT_DEG * (vx * speed) - deg) * 0.1f;
-      assert(deg <>= 0);
+      assert(!isNaN(deg));
       pos += vel;
       vel *= 0.9f;
       if (gameState.mode == GameState.Mode.MODERN) {
@@ -864,7 +864,7 @@
   bool isExtending;
 
   invariant() {
-    assert(length <>= 0);
+    assert(!isNaN(length));
   }
 
   public this(Field field, PlayerState playerState, GameState gameState) {
--- a/src/abagames/ttn/preference.d
+++ b/src/abagames/ttn/preference.d
@@ -5,9 +5,9 @@
  */
 module abagames.ttn.preference;
 
-private import std.stream;
+private import std.stdio;
 private import std.file;
-private import std.c.stdlib;
+private import core.stdc.stdlib;
 private import std.string;
 private import std.conv;
 private import abagames.util.preference;
@@ -41,15 +41,15 @@
 
   public void load() {
     try {
-      scope File fd = new File(pref_dir() ~ "/" ~ PREF_FILE_NAME, FileMode.In);
+      File fd = File(pref_dir() ~ "/" ~ PREF_FILE_NAME);
       int ver;
-      fd.read(ver);
+      fd.rawRead((&ver)[0..1]);
       if (ver != VERSION_NUM)
         throw new Error("Wrong version num");
-      fd.read(_lastMode);
+      fd.rawRead((&_lastMode)[0..1]);
       for(int j = 0; j < MODE_NUM; j++)
         for(int i = 0; i < RANKING_NUM; i++)
-          fd.read(_highScore[j][i]);
+          fd.rawRead((&_highScore[j][i])[0..1]);
     } catch (Throwable e) {
       init();
     }
@@ -63,13 +63,12 @@
   }
 
   public void save() {
-    scope File fd = new File(pref_dir() ~ "/" ~ PREF_FILE_NAME, FileMode.OutNew);
-    fd.write(VERSION_NUM);
-    fd.write(_lastMode);
+    File fd = File(pref_dir() ~ "/" ~ PREF_FILE_NAME, "w");
+    fd.rawWrite((&VERSION_NUM)[0..1]);
+    fd.rawWrite((&_lastMode)[0..1]);
     for(int j = 0; j < MODE_NUM; j++)
       for(int i = 0; i < RANKING_NUM; i++)
-        fd.write(_highScore[j][i]);
-    fd.close();
+        fd.rawWrite((&_highScore[j][i])[0..1]);
   }
 
   public void setMode(int mode) {
--- a/src/abagames/ttn/replay.d
+++ b/src/abagames/ttn/replay.d
@@ -5,7 +5,7 @@
  */
 module abagames.ttn.replay;
 
-private import std.stream;
+private import std.stdio;
 private import abagames.util.sdl.pad;
 private import abagames.util.sdl.recordableinput;
 private import abagames.ttn.preference;
@@ -24,27 +24,28 @@
  private:
 
   public void save(string fileName) {
-    scope File fd = new File(Preference.pref_dir() ~ "/" ~ fileName, FileMode.OutNew);
-    fd.write(VERSION_NUM);
-    fd.write(seed);
-    fd.write(score);
-    fd.write(mode);
-    fd.write(cast(byte) stageRandomized);
+    File fd = File(Preference.pref_dir() ~ "/" ~ fileName, "w");
+    fd.rawWrite((&VERSION_NUM)[0..1]);
+    fd.rawWrite((&seed)[0..1]);
+    fd.rawWrite((&score)[0..1]);
+    fd.rawWrite((&mode)[0..1]);
+    byte sr = stageRandomized;
+    fd.rawWrite((&sr)[0..1]);
     inputRecord.save(fd);
     fd.close();
   }
 
   public void load(string fileName) {
-    scope File fd = new File(Preference.pref_dir() ~ "/" ~ fileName, FileMode.In);
+    File fd = File(Preference.pref_dir() ~ "/" ~ fileName);
     int ver;
-    fd.read(ver);
+    fd.rawRead((&ver)[0..1]);
     if (ver != VERSION_NUM)
       throw new Error("Wrong version num");
-    fd.read(seed);
-    fd.read(score);
-    fd.read(mode);
+    fd.rawRead((&seed)[0..1]);
+    fd.rawRead((&score)[0..1]);
+    fd.rawRead((&mode)[0..1]);
     byte sr;
-    fd.read(sr);
+    fd.rawRead((&sr)[0..1]);
     stageRandomized = cast(bool) sr;
     inputRecord = new InputRecord!(PadState);
     inputRecord.load(fd);
--- a/src/abagames/ttn/screen.d
+++ b/src/abagames/ttn/screen.d
@@ -10,6 +10,7 @@
 private import openglu;
 private import abagames.util.sdl.screen3d;
 private import abagames.ttn.field;
+private import std.string;
 
 /**
  * OpenGL screen.
--- a/src/abagames/ttn/token.d
+++ b/src/abagames/ttn/token.d
@@ -18,11 +18,12 @@
  *  specs (maneuver, method of attack, etc.).
  */
 public class Token(ST, SP): Actor {
- protected:
+ public:
   ST state;
   SP spec;
+ protected:
 
-  public override void init(Object[] args) {
+  public override void init_(Object[] args) {
     state = new ST;
   }
 
@@ -68,18 +69,19 @@
  * Holding a state of a token.
  */
 public class TokenState {
- protected:
-  bool isInitialized = false;
+ public:
   Vector pos;
   float deg;
   float speed;
+ protected:
+  bool isInitialized = false;
 
   invariant() {
     if (isInitialized) {
-      assert(pos.x <>= 0);
-      assert(pos.y <>= 0);
-      assert(deg <>= 0);
-      assert(speed <>= 0);
+      assert(!isNaN(pos.x));
+      assert(!isNaN(pos.y));
+      assert(!isNaN(deg));
+      assert(!isNaN(speed));
     }
   }
 
@@ -104,8 +106,9 @@
  * Base class of a token's specification.
  */
 public class TokenSpec(T) {
- protected:
+ public:
   Field field;
+ protected:
   Shape shape;
 
   public void set(T state) {}
--- a/src/abagames/util/rand.d
+++ b/src/abagames/util/rand.d
@@ -5,7 +5,6 @@
  */
 module abagames.util.rand;
 
-private import std.stream;
 private import std.datetime;
 
 /**
@@ -123,7 +122,7 @@
 uint MIXBITS(uint u, uint v) { return (u & UMASK) | (v & LMASK); }
 uint TWIST(uint u,uint v) { return (MIXBITS(u,v) >> 1) ^ (v&1 ? MATRIX_A : 0); }
 
-uint state[N]; /* the array for the state vector  */
+uint[N] state; /* the array for the state vector  */
 int left = 1;
 int initf = 0;
 uint *next;
@@ -148,7 +147,7 @@
 /* key_length is its length */
 //uint init_key[];
 //uint key_length;
-void init_by_array(uint init_key[], uint key_length)
+void init_by_array(uint[] init_key, uint key_length)
 {
     int i, j, k;
     init_genrand(cast(uint)19650218UL);
--- a/src/abagames/util/sdl/pad.d
+++ b/src/abagames/util/sdl/pad.d
@@ -6,7 +6,7 @@
 module abagames.util.sdl.pad;
 
 private import std.string;
-private import std.stream;
+private import std.stdio;
 private import SDL;
 private import abagames.util.sdl.input;
 private import abagames.util.sdl.recordableinput;
@@ -142,14 +142,14 @@
 
   public void read(File fd) {
     int s;
-    fd.read(s);
+    fd.rawRead((&s)[0..1]);
     dir = s & (Dir.UP | Dir.DOWN | Dir.LEFT | Dir.RIGHT);
     button = s & Button.ANY;
   }
 
   public void write(File fd) {
     int s = dir | button;
-    fd.write(s);
+    fd.rawWrite((&s)[0..1]);
   }
 
   public bool equals(PadState s) {
--- a/src/abagames/util/sdl/recordableinput.d
+++ b/src/abagames/util/sdl/recordableinput.d
@@ -5,7 +5,7 @@
  */
 module abagames.util.sdl.recordableinput;
 
-private import std.stream;
+private import std.stdio;
 private import abagames.util.iterator;
 
 /**
@@ -98,9 +98,10 @@
   }
 
   public void save(File fd) {
-    fd.write(record.length);
+    int l = cast(int)record.length;
+    fd.rawWrite((&l)[0..1]);
     foreach (Record r; record) {
-      fd.write(r.series);
+      fd.rawWrite((&r.series)[0..1]);
       r.data.write(fd);
     }
   }
@@ -109,9 +110,9 @@
     clear();
     int l, s;
     T d;
-    fd.read(l);
+    fd.rawRead((&l)[0..1]);
     for (int i = 0; i < l; i++) {
-      fd.read(s);
+      fd.rawRead((&s)[0..1]);
       d = T.newInstance();
       d.read(fd);
       Record r;
--- a/src/abagames/util/tokenizer.d
+++ b/src/abagames/util/tokenizer.d
@@ -5,7 +5,7 @@
  */
 module abagames.util.tokenizer;
 
-private import std.stream;
+private import std.stdio;
 private import std.string;
 private import std.conv;
 
@@ -17,9 +17,9 @@
 
   public static string[] readFile(string fileName, string separator) {
     string[] result;
-    scope File fd = new File(fileName, FileMode.In);
+    File fd = File(fileName);
     for (;;) {
-      string line = to!string(fd.readLine());
+      string line = fd.readln();
       if (!line)
         break;
       string[] spl = std.string.split(line, separator);
--- a/src/abagames/ttn/pillar.d
+++ b/src/abagames/ttn/pillar.d
@@ -6,6 +6,7 @@
 module abagames.ttn.pillar;
 
 private import std.math;
+private import std.algorithm.sorting;
 private import abagames.util.actor;
 private import abagames.ttn.field;
 private import abagames.ttn.token;
@@ -25,8 +26,8 @@
   }
 
   public void drawCenter() {
-    Pillar[] sas = actors.sort;
-    foreach (Pillar a; sas)
+    actors.sort;
+    foreach (Pillar a; actors)
       if (a.exists && !a.state.isOutside)
         a.draw();
   }
--- a/src/abagames/util/actor.d
+++ b/src/abagames/util/actor.d
@@ -23,7 +23,7 @@
     return _exists = v;
   }
 
-  public abstract void init(Object[] args);
+  public abstract void init_(Object[] args);
   public abstract void move();
   public abstract void draw();
 }
@@ -57,7 +57,7 @@
     foreach (ref T a; actors) {
       a = new T;
       a.exists = false;
-      a.init(args);
+      a.init_(args);
     }
     actorIdx = 0;
     hasNoActor = false;
