File: dlang_v2.patch

package info (click to toggle)
parsec47 0.2.dfsg1-9
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, sid, trixie
  • size: 6,352 kB
  • sloc: xml: 2,178; ansic: 47; makefile: 28
file content (1238 lines) | stat: -rw-r--r-- 38,127 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
Description: port to D language version 2
  With this patch the code is accepted by gdc-4.6 0.29.1-4.6.4-3 without
  triggering deprecated feature warnings/errors.
Author: Peter De Wachter <pdewacht@gmail.com>

--- a/src/abagames/p47/BarrageManager.d
+++ b/src/abagames/p47/BarrageManager.d
@@ -7,8 +7,9 @@
 
 private:
 import std.string;
+import std.conv;
 import std.path;
-import dirent;
+import std.file;
 import bulletml;
 import abagames.p47.MorphBullet;
 import abagames.util.Logger;
@@ -24,12 +25,12 @@
     LARGE, LARGEMOVE,
     MORPH_LOCK, SMALL_LOCK, MIDDLESUB_LOCK,
   }
-  const int BARRAGE_TYPE = 13;
-  const int BARRAGE_MAX = 64;
+  static const int BARRAGE_TYPE = 13;
+  static const int BARRAGE_MAX = 64;
   BulletMLParserTinyXML* parser[BARRAGE_TYPE][BARRAGE_MAX];
   int parserNum[BARRAGE_TYPE];
  private:
-  const char[][BARRAGE_TYPE] dirName = 
+  static const string[BARRAGE_TYPE] dirName = 
     ["/usr/share/games/parsec47/morph",
      "/usr/share/games/parsec47/small",
      "/usr/share/games/parsec47/smallmove",
@@ -47,22 +48,17 @@
 
   public void loadBulletMLs() {
     for (int i = 0; i< BARRAGE_TYPE; i++) {
-      DIR* d = opendir(dirName[i]);
-      int j;
-      for (j = 0;;) {
-	char* fn = readdir_filename(d);
-	if (!fn) 
-	  break;
-	char[] fileName = std.string.toString(fn);
-	if (getExt(fileName) != "xml")
+      int j = 0;
+      auto files = dirEntries(dirName[i], SpanMode.shallow);
+      foreach (string fileName; files) {
+	if (extension(fileName) != ".xml")
 	  continue;
-	Logger.info("Load BulletML: " ~ dirName[i] ~ "/" ~ fileName);
+	Logger.info("Load BulletML: " ~ fileName);
 	parser[i][j] = 
-	  BulletMLParserTinyXML_new(std.string.toStringz(dirName[i] ~ "/" ~ fileName));
+	  BulletMLParserTinyXML_new(std.string.toStringz(fileName));
 	BulletMLParserTinyXML_parse(parser[i][j]);
 	j++;
       }
-      closedir(d);
       parserNum[i] = j;
     }
   }
--- a/src/abagames/p47/BulletActor.d
+++ b/src/abagames/p47/BulletActor.d
@@ -254,7 +254,7 @@
     if (!isVisible)
       return;
     float d;
-    switch (bullet.shape) {
+    switch (bullet.shape) { default: break;
     case 0:
     case 2:
     case 5:
@@ -311,7 +311,7 @@
       for (int j = 0; j < BULLET_SHAPE_NUM + 1; j++) {
 	glNewList(displayListIdx + idx, GL_COMPILE);
 	Screen3D.setColor(r, g, b, 1);
-	switch (j) {
+	switch (j) { default: break;
 	case 0:
 	  glBegin(GL_TRIANGLE_FAN);
 	  glVertex3f(-SHAPE_POINT_SIZE, -SHAPE_POINT_SIZE,  0);
--- a/src/abagames/p47/BulletActorPool.d
+++ b/src/abagames/p47/BulletActorPool.d
@@ -24,7 +24,7 @@
   int cnt;
 
   public this(int n, ActorInitializer ini) {
-    auto BulletActor bulletActorClass = new BulletActor;
+    scope BulletActor bulletActorClass = new BulletActor;
     super(n, bulletActorClass, ini);
     Bullet.setBulletsManager(this);
     BulletActor.init();
@@ -109,7 +109,7 @@
     return ba;
   }
 
-  public void move() {
+  public override void move() {
     super.move();
     cnt++;
   }
--- a/src/abagames/p47/EnemyType.d
+++ b/src/abagames/p47/EnemyType.d
@@ -217,7 +217,7 @@
   }
 
   private void createEnemyColor() {
-    switch (ect) {
+    switch (ect) { default: break;
     case 0:
       er = 1;
       eg = rand.nextFloat(0.7) + 0.3;
@@ -267,7 +267,7 @@
     bodyShapePos[3].x = -x2;
     bodyShapePos[3].y = -y2;
     retroSize = enemySize[size][4];
-    switch (size) {
+    switch (size) { default: break;
     case SMALL:
     case MIDDLE:
     case MIDDLEBOSS:
@@ -309,7 +309,7 @@
 	  md = rand.nextFloat(std.math.PI / 2) + std.math.PI / 4 * 3;
 	mpx = px / 2 + sin(md) * (enemySize[size][8] / 2 + rand.nextFloat(enemySize[size][8]/2));
 	mpy = py / 2 + cos(md) * (enemySize[size][8] / 2 + rand.nextFloat(enemySize[size][8]/2));
-	switch (size) {
+	switch (size) { default: break;
 	case SMALL:
 	case MIDDLE:
 	case LARGE:
@@ -335,7 +335,7 @@
 	    collisionSize.y = cpy;
 	}
       }
-      switch (wrl) {
+      switch (wrl) { default: break;
       case 1:
 	bt.wingShapePos[0].x = px / 4 * wrl;
 	bt.wingShapePos[0].y = py / 4;
@@ -441,7 +441,7 @@
     setBarrageType(br, BarrageManager.MIDDLE, mode);
     float cr, sr;
     if (mode == ROLL) {
-      switch (rand.nextInt(6)) {
+      switch (rand.nextInt(6)) { default: break;
       case 0:
       case 1:
 	cr = rank / 3 * 2;
@@ -459,7 +459,7 @@
 	break;
       }
     } else {
-      switch (rand.nextInt(6)) {
+      switch (rand.nextInt(6)) { default: break;
       case 0:
       case 1:
 	cr = rank / 5;
@@ -502,7 +502,7 @@
     setBarrageType(br, BarrageManager.LARGE, mode);
     float cr, sr1, sr2;
     if (mode == ROLL) {
-      switch (rand.nextInt(9)) {
+      switch (rand.nextInt(9)) { default: break;
       case 0:
       case 1:
       case 2:
@@ -529,7 +529,7 @@
 	break;
       }
     } else {
-      switch (rand.nextInt(9)) {
+      switch (rand.nextInt(9)) { default: break;
       case 0:
 	cr = rank / 4 * 3;
 	sr1 = sr2 = 0;
@@ -587,7 +587,7 @@
       Barrage br = barrage[i];
       setBarrageType(br, BarrageManager.LARGE, mode);
       float cr, sr;
-      switch (rand.nextInt(3)) {
+      switch (rand.nextInt(3)) { default: break;
       case 0:
 	cr = rank;
 	sr = 0;
@@ -625,7 +625,7 @@
       Barrage br = barrage[i];
       setBarrageType(br, BarrageManager.LARGE, mode);
       float cr, sr1, sr2;
-      switch (rand.nextInt(3)) {
+      switch (rand.nextInt(3)) { default: break;
       case 0:
 	cr = rank;
 	sr1 = sr2 = 0;
--- a/src/abagames/p47/Field.d
+++ b/src/abagames/p47/Field.d
@@ -46,7 +46,7 @@
   }
 
   public void setColor(int mode) {
-    switch (mode){
+    switch (mode){ default: break;
     case P47GameManager.ROLL:
       r = 0.2;
       g = 0.2;
@@ -72,7 +72,7 @@
   }
 
   public void setType(int type) {
-    switch (type) {
+    switch (type) { default: break;
     case 0:
       aimYawYBase = 30;
       aimYawZBase = 0;
--- a/src/abagames/p47/LetterRender.d
+++ b/src/abagames/p47/LetterRender.d
@@ -23,7 +23,7 @@
     WHITE, RED
   }
 
-  private static void changeColor(int c) {
+  public static void changeColor(int c) {
     colorIdx = c * LETTER_NUM;
   }
 
@@ -40,12 +40,12 @@
     TO_RIGHT, TO_DOWN, TO_LEFT, TO_UP,
   }
 
-  public static void drawString(char[] str, float lx, float y, float s, int d) {
+  public static void drawString(string str, float lx, float y, float s, int d) {
     float x = lx;
     int c;
     int idx;
     float ld;
-    switch (d) {
+    switch (d) { default: break;
     case TO_RIGHT:
       ld = 0;
       break;
@@ -79,7 +79,7 @@
 	}
 	drawLetter(idx, x, y, s, ld);
       }
-      switch(d) {
+      switch(d) { default: break;
       case TO_RIGHT:
 	x += s * 1.7f;
 	break;
@@ -100,7 +100,7 @@
     int n = num;
     float x = lx;
     float ld;
-    switch (d) {
+    switch (d) { default: break;
     case TO_RIGHT:
       ld = 0;
       break;
@@ -116,7 +116,7 @@
     }
     for (;;) {
       drawLetter(n % 10, x, y, s, ld);
-      switch(d) {
+      switch(d) { default: break;
       case TO_RIGHT:
 	x -= s * 1.7f;
 	break;
@@ -147,7 +147,7 @@
 	n /= 6;
       }
       if ((i & 1) == 1 || i == 0) {
-	switch (i) {
+	switch (i) { default: break;
 	case 3:
 	  drawLetter(41, x + s * 1.16f, y, s);
 	  break;
--- a/src/abagames/p47/Lock.d
+++ b/src/abagames/p47/Lock.d
@@ -106,7 +106,7 @@
 	lockedPos.y = lockedEnemy.pos.y + lockedEnemy.type.batteryType[lockedPart].collisionPos.y;
       }
     }
-    switch (state) {
+    switch (state) { default: break;
     case LOCKING:
       if (cnt >= LOCK_CNT) {
 	state = LOCKED;
@@ -175,7 +175,7 @@
   }
 
   public override void draw() {
-    switch (state) {
+    switch (state) { default: break;
     case LOCKING:
       float y = lockedPos.y - (LOCK_CNT - cnt) * 0.5;
       float d = (LOCK_CNT - cnt) * 0.1;
--- a/src/abagames/p47/P47Boot.d
+++ b/src/abagames/p47/P47Boot.d
@@ -7,7 +7,8 @@
 
 private:
 import std.string;
-import std.c.stdlib;
+private import std.conv;
+import core.stdc.stdlib;
 import abagames.util.Logger;
 import abagames.util.sdl.Pad;
 import abagames.util.sdl.MainLoop;
@@ -28,12 +29,12 @@
 P47PrefManager prefManager;
 MainLoop mainLoop;
 
-private void usage(char[] args0) {
+private void usage(string args0) {
   Logger.error
     ("Usage: " ~ args0 ~ " [-brightness [0-100]] [-luminous [0-100]] [-nosound] [-window] [-fullscreen] [-reverse] [-lowres] [-slowship] [-nowait]");
 }
 
-private void parseArgs(char[][] args) {
+private void parseArgs(string[] args) {
   for (int i = 1; i < args.length; i++) {
     switch (args[i]) {
     case "-brightness":
@@ -42,7 +43,7 @@
 	throw new Exception("Invalid options");
       }
       i++;
-      float b = cast(float) atoi(args[i]) / 100;
+      float b = cast(float) to!int(args[i]) / 100;
       if (b < 0 || b > 1) {
 	usage(args[0]);
 	throw new Exception("Invalid options");
@@ -55,7 +56,7 @@
 	throw new Exception("Invalid options");
       }
       i++;
-      float l = cast(float) atoi(args[i]) / 100;
+      float l = cast(float) to!int(args[i]) / 100;
       if (l < 0 || l > 1) {
 	usage(args[0]);
 	throw new Exception("Invalid options");
@@ -93,7 +94,7 @@
   }
 }
 
-public int boot(char[][] args) {
+public int boot(string[] args) {
   screen = new P47Screen;
   pad = new Pad;
   try {
@@ -135,10 +136,10 @@
     _moduleCtor();
     char exe[4096];
     GetModuleFileNameA(null, exe, 4096);
-    char[][1] prog;
-    prog[0] = std.string.toString(exe);
-    result = boot(prog ~ std.string.split(std.string.toString(lpCmdLine)));
-  } catch (Object o) {
+    string[1] prog;
+    prog[0] = to!string(exe);
+    result = boot(prog ~ std.string.split(to!string(lpCmdLine)));
+  } catch (Throwable o) {
     //Logger.error("Exception: " ~ o.toString());
     Logger.info("Exception: " ~ o.toString());
     result = EXIT_FAILURE;
@@ -150,7 +151,7 @@
 } else {
 
 // Boot as the general executable.
-public int main(char[][] args) {
+public int main(string[] args) {
   return boot(args);
 }
 
--- a/src/abagames/p47/P47GameManager.d
+++ b/src/abagames/p47/P47GameManager.d
@@ -98,33 +98,33 @@
     Ship.createDisplayLists();
     ship = new Ship;
     ship.init(pad, field, this);
-    auto Particle particleClass = new Particle;
-    auto ParticleInitializer pi = new ParticleInitializer;
+    scope Particle particleClass = new Particle;
+    scope ParticleInitializer pi = new ParticleInitializer;
     particles = new LuminousActorPool(128, particleClass, pi);
-    auto Fragment fragmentClass = new Fragment;
-    auto FragmentInitializer fi = new FragmentInitializer;
+    scope Fragment fragmentClass = new Fragment;
+    scope FragmentInitializer fi = new FragmentInitializer;
     fragments = new LuminousActorPool(128, fragmentClass, fi);
     BulletActor.createDisplayLists();
-    auto BulletActorInitializer bi = new BulletActorInitializer(field, ship);
+    scope BulletActorInitializer bi = new BulletActorInitializer(field, ship);
     bullets = new BulletActorPool(512, bi);
     LetterRender.createDisplayLists();
-    auto Shot shotClass = new Shot;
-    auto ShotInitializer shi = new ShotInitializer(field);
+    scope Shot shotClass = new Shot;
+    scope ShotInitializer shi = new ShotInitializer(field);
     shots = new ActorPool(32, shotClass, shi);
-    auto Roll rollClass = new Roll;
-    auto RollInitializer ri = new RollInitializer(ship, field, this);
+    scope Roll rollClass = new Roll;
+    scope RollInitializer ri = new RollInitializer(ship, field, this);
     rolls = new ActorPool(4, rollClass, ri);
     Lock.init();
-    auto Lock lockClass = new Lock;
-    auto LockInitializer li = new LockInitializer(ship, field, this);
+    scope Lock lockClass = new Lock;
+    scope LockInitializer li = new LockInitializer(ship, field, this);
     locks = new ActorPool(4, lockClass, li);
-    auto Enemy enemyClass = new Enemy;
-    auto EnemyInitializer ei = new EnemyInitializer
+    scope Enemy enemyClass = new Enemy;
+    scope EnemyInitializer ei = new EnemyInitializer
       (field, bullets, shots, rolls, locks, ship, this);
     enemies = new ActorPool(ENEMY_MAX, enemyClass, ei);
     Bonus.init();
-    auto Bonus bonusClass = new Bonus;
-    auto BonusInitializer bni = new BonusInitializer(field, ship, this);
+    scope Bonus bonusClass = new Bonus;
+    scope BonusInitializer bni = new BonusInitializer(field, ship, this);
     bonuses = new ActorPool(128, bonusClass, bni);
     barrageManager = new BarrageManager;
     barrageManager.loadBulletMLs();
@@ -281,7 +281,7 @@
     this.parsecSlot = parsecSlot;
     this.mode = mode;
     int stageType = rand.nextInt(99999);
-    switch (difficulty) {
+    switch (difficulty) { default: break;
     case PRACTICE:
       stageManager.setRank(1, 4, startParsec, stageType);
       ship.setSpeedRate(0.7);
@@ -610,7 +610,7 @@
     drawBox(165, 6, bossShield, 6);
     int y = 24;
     for (int i = 0; i < BOSS_WING_NUM; i++) {
-      switch (i % 2) {
+      switch (i % 2) { default: break;
       case 0:
 	drawBox(165, y, bossWingShield[i], 6);
 	break;
--- a/src/abagames/p47/P47PrefManager.d
+++ b/src/abagames/p47/P47PrefManager.d
@@ -8,7 +8,8 @@
 private:
 import std.stream;
 import std.string;
-import std.c.stdlib;
+private import std.conv;
+import core.stdc.stdlib;
 import abagames.util.PrefManager;
 
 /**
@@ -18,7 +19,7 @@
  public:
   static const int PREV_VERSION_NUM = 10;
   static const int VERSION_NUM = 20;
-  static const char[] PREF_FILE = ".p47.prf";
+  static const string PREF_FILE = ".p47.prf";
   static const int MODE_NUM = 2;
   static const int DIFFICULTY_NUM = 4;
   static const int REACHED_PARSEC_SLOT_NUM = 10;
@@ -26,11 +27,11 @@
   int reachedParsec[MODE_NUM][DIFFICULTY_NUM];
   int selectedDifficulty, selectedParsecSlot, selectedMode;
 
-  public static char[] home_dir() {
-    char * home = getenv("HOME");
+  public static string home_dir() {
+    const(char)* home = getenv("HOME");
     if (home is null)
       throw new Error("HOME environment variable is not defined");
-    return std.string.toString(home);
+    return to!string(home);
   }
 
   private void init() {
@@ -58,8 +59,8 @@
     fd.read(selectedParsecSlot);
   }
 
-  public void load() {
-    auto File fd = new File;
+  public override void load() {
+    scope File fd = new File;
     try {
       int ver;
       fd.open(home_dir() ~ "/" ~ PREF_FILE);
@@ -90,8 +91,8 @@
     }
   }
 
-  public void save() {
-    auto File fd = new File;
+  public override void save() {
+    scope File fd = new File;
     fd.create(home_dir ~ "/" ~ PREF_FILE);
     fd.write(VERSION_NUM);
     for (int k = 0; k < MODE_NUM; k++) {
--- a/src/abagames/p47/P47Screen.d
+++ b/src/abagames/p47/P47Screen.d
@@ -17,7 +17,7 @@
  */
 public class P47Screen: Screen3D {
  public:
-  static const char[] CAPTION = "PARSEC47";
+  static const string CAPTION = "PARSEC47";
   static float luminous = 0;
  private:
   static Rand rand;
@@ -63,7 +63,7 @@
       luminousScreen.draw();
   }
 
-  public void resized(int width, int height) {
+  public override void resized(int width, int height) {
     if (luminousScreen)
       luminousScreen.resized(width, height);
     super.resized(width, height);
--- a/src/abagames/p47/Ship.d
+++ b/src/abagames/p47/Ship.d
@@ -27,10 +27,10 @@
   static bool isSlow = false;
   static int displayListIdx;
   Vector pos;
-  const float SIZE = 0.3;
+  static const float SIZE = 0.3;
   bool restart;
-  const int RESTART_CNT = 300;
-  const int INVINCIBLE_CNT = 228;
+  static const int RESTART_CNT = 300;
+  static const int INVINCIBLE_CNT = 228;
   int cnt;
  private:
   static Rand rand;
@@ -58,11 +58,8 @@
   int rollLockCnt;
   bool rollCharged;
 
-  public static this() {
-    rand = new Rand;
-  }
-
   public void init(Pad pad, Field field, P47GameManager manager) {
+    if (rand is null) rand = new Rand;
     this.pad = pad;
     this.field = field;
     this.manager = manager;
@@ -177,7 +174,7 @@
       pos.y = fieldLimitY;
     if (btn & Pad.PAD_BUTTON1) {
       float td;
-      switch (fireCnt % 4) {
+      switch (fireCnt % 4) { default: break;
       case 0:
 	firePos.x = pos.x + TURRET_INTERVAL_LENGTH;
 	firePos.y = pos.y;
--- a/src/abagames/p47/SoundManager.d
+++ b/src/abagames/p47/SoundManager.d
@@ -26,9 +26,9 @@
   Sound bgm[BGM_NUM];
   Sound se[SE_NUM];
 
-  const char[][] bgmFileName = 
+  const string[] bgmFileName = 
     ["ptn0.ogg", "ptn1.ogg", "ptn2.ogg", "ptn3.ogg"];
-  const char[][] seFileName = 
+  const string[] seFileName = 
     ["shot.wav", "rollchg.wav", "rollrls.wav", "shipdst.wav", "getbonus.wav", "extend.wav",
     "enemydst.wav", "largedst.wav", "bossdst.wav", "lock.wav", "laser.wav"];
   const int[] seChannel = 
--- a/src/abagames/p47/StageManager.d
+++ b/src/abagames/p47/StageManager.d
@@ -104,7 +104,7 @@
   }
 
   private void setAppearancePattern(EnemyAppearance* ap) {
-    switch (rand.nextInt(5)) {
+    switch (rand.nextInt(5)) { default: break;
     case 0:
       ap.pattern = ONE_SIDE;
       break;
@@ -117,7 +117,7 @@
       ap.pattern = BOTH_SIDES;
       break;
     }
-    switch (rand.nextInt(3)) {
+    switch (rand.nextInt(3)) { default: break;
     case 0:
       ap.sequence = RANDOM;
       break;
@@ -142,7 +142,7 @@
     setAppearancePattern(ap);
     if (ap.pattern == ONE_SIDE)
       ap.pattern = ALTERNATE;
-    switch (rand.nextInt(4)) {
+    switch (rand.nextInt(4)) { default: break;
     case 0:
       ap.num = 7 + rand.nextInt(5);
       ap.groupInterval = 72 + rand.nextInt(15);
@@ -177,7 +177,7 @@
     mt = BarrageManager.MIDDLEMOVE;
     ap.moveParser = barrageManager.parser[mt][rand.nextInt(barrageManager.parserNum[mt])];
     setAppearancePattern(ap);
-    switch (rand.nextInt(3)) {
+    switch (rand.nextInt(3)) { default: break;
     case 0:
       ap.num = 4;
       ap.groupInterval = 240 + rand.nextInt(150);
@@ -203,7 +203,7 @@
     mt = BarrageManager.LARGEMOVE;
     ap.moveParser = barrageManager.parser[mt][rand.nextInt(barrageManager.parserNum[mt])];
     setAppearancePattern(ap);
-    switch (rand.nextInt(3)) {
+    switch (rand.nextInt(3)) { default: break;
     case 0:
       ap.num = 3;
       ap.groupInterval = 400 + rand.nextInt(100);
@@ -223,7 +223,7 @@
   }
 
   private void setAppearance(EnemyAppearance* ap, int type) {
-    switch (type) {
+    switch (type) { default: break;
     case SMALL:
       setSmallAppearance(ap);
       break;
@@ -255,7 +255,7 @@
     field.aimSpeed = 0.1 + section * 0.02;
     if (section == 4) {
       // Set the middle boss.
-      auto Vector pos = new Vector;
+      scope Vector pos = new Vector;
       pos.x = 0; pos.y = field.size.y / 4 * 3;
       gameManager.addBoss(pos, std.math.PI, middleBossType);
       bossSection = true;
@@ -264,7 +264,7 @@
       return;
     } else if (section == 9) {
       // Set the large boss.
-      auto Vector pos = new Vector;
+      scope Vector pos = new Vector;
       pos.x = 0; pos.y = field.size.y / 4 * 3;
       gameManager.addBoss(pos, std.math.PI, largeBossType);
       bossSection = true;
@@ -295,16 +295,16 @@
     else if (middleRushSection)
       ap = MIDDLE_RUSH_SECTION_PATTERN;
     for (int i = 0; i < apparancePattern[gameManager.mode][ap][0]; i++, apNum++) {
-      EnemyAppearance* ap = &(appearance[apNum]);
-      setAppearance(ap, SMALL);
+      EnemyAppearance* eap = &(appearance[apNum]);
+      setAppearance(eap, SMALL);
     }
     for (int i = 0; i < apparancePattern[gameManager.mode][ap][1]; i++, apNum++) {
-      EnemyAppearance* ap = &(appearance[apNum]);
-      setAppearance(ap, MIDDLE);
+      EnemyAppearance* eap = &(appearance[apNum]);
+      setAppearance(eap, MIDDLE);
     }
     for (int i = 0; i < apparancePattern[gameManager.mode][ap][2]; i++, apNum++) {
-      EnemyAppearance* ap = &(appearance[apNum]);
-      setAppearance(ap, LARGE);
+      EnemyAppearance* eap = &(appearance[apNum]);
+      setAppearance(eap, LARGE);
     }
   }
 
@@ -364,7 +364,7 @@
 	continue;
       }
       float p;
-      switch (ap.sequence) {
+      switch (ap.sequence) { default: break;
       case RANDOM:
 	p = rand.nextFloat(1);
 	break;
@@ -373,7 +373,7 @@
 	break;
       }
       float d;
-      switch (ap.point) {
+      switch (ap.point) { default: break;
       case TOP:
 	switch (ap.pattern) {
 	case BOTH_SIDES:
--- a/src/abagames/p47/Title.d
+++ b/src/abagames/p47/Title.d
@@ -153,9 +153,9 @@
   }
 
   private const int BOX_SMALL_SIZE = 24;
-  private const char[][] DIFFICULTY_SHORT_STR = ["P", "N", "H", "E", "Q"];
-  private const char[][] DIFFICULTY_STR = ["PRACTICE", "NORMAL", "HARD", "EXTREME", "QUIT"];
-  private const char[][] MODE_STR = ["ROLL", "LOCK"];
+  private const string[] DIFFICULTY_SHORT_STR = ["P", "N", "H", "E", "Q"];
+  private const string[] DIFFICULTY_STR = ["PRACTICE", "NORMAL", "HARD", "EXTREME", "QUIT"];
+  private const string[] MODE_STR = ["ROLL", "LOCK"];
 
   private void drawTitleBoard() {
     glEnable(GL_TEXTURE_2D);
--- a/src/abagames/util/ActorPool.d
+++ b/src/abagames/util/ActorPool.d
@@ -16,7 +16,7 @@
  public:
   Actor[] actor;
  protected:
-  int actorIdx;
+  ptrdiff_t actorIdx;
 
   public this(int n, Actor act, ActorInitializer ini) {
     actor = new Actor[n];
--- a/src/abagames/util/Logger.d
+++ b/src/abagames/util/Logger.d
@@ -6,7 +6,8 @@
 module abagames.util.Logger;
 
 private:
-import std.stream;
+import std.stdio;
+import std.conv;
 
 /**
  * Logger(error/info).
@@ -14,35 +15,32 @@
 version(Win32_release) {
 
 import std.string;
+private import std.conv;
 import std.c.windows.windows;
 
 public class Logger {
 
-  public static void info(char[] msg) {
+  public static void info(string msg) {
     // Win32 exe file crashes if it writes something to stderr.
-    //stderr.writeLine("Info: " ~ msg);
+    //stderr.writeln("Info: " ~ msg);
   }
 
   public static void info(int n) {
     /*if (n >= 0)
-      stderr.writeLine("Info: " ~ std.string.toString(n));
+      stderr.writeln("Info: " ~ to!string(n));
     else
-    stderr.writeLine("Info: -" ~ std.string.toString(-n));*/
+    stderr.writeln("Info: -" ~ to!string(-n));*/
   }
 
-  private static void putMessage(char[] msg) {
+  private static void putMessage(string msg) {
     MessageBoxA(null, std.string.toStringz(msg), "Error", MB_OK | MB_ICONEXCLAMATION);
   }
 
-  public static void error(char[] msg) {
+  public static void error(string msg) {
     putMessage("Error: " ~ msg);
   }
 
-  public static void error(Exception e) {
-    putMessage("Error: " ~ e.toString());
-  }
-
-  public static void error(Error e) {
+  public static void error(Throwable e) {
     putMessage("Error: " ~ e.toString());
   }
 }
@@ -51,27 +49,23 @@
 
 public class Logger {
 
-  public static void info(char[] msg) {
-    stderr.writeLine("Info: " ~ msg);
+  public static void info(string msg) {
+    stderr.writeln("Info: " ~ msg);
   }
 
   public static void info(int n) {
     if (n >= 0)
-      stderr.writeLine("Info: " ~ std.string.toString(n));
+      stderr.writeln("Info: " ~ to!string(n));
     else
-      stderr.writeLine("Info: -" ~ std.string.toString(-n));
-  }
-
-  public static void error(char[] msg) {
-    stderr.writeLine("Error: " ~ msg);
+      stderr.writeln("Info: -" ~ to!string(-n));
   }
 
-  public static void error(Exception e) {
-    stderr.writeLine("Error: " ~ e.toString());
+  public static void error(string msg) {
+    stderr.writeln("Error: " ~ msg);
   }
 
-  public static void error(Error e) {
-    stderr.writeLine("Error: " ~ e.toString());
+  public static void error(Throwable e) {
+    stderr.writeln("Error: " ~ e.toString());
     if (e.next)
       error(e.next);
   }
--- a/src/abagames/util/Rand.d
+++ b/src/abagames/util/Rand.d
@@ -6,7 +6,7 @@
 module abagames.util.Rand;
 
 private:
-import std.date;
+import std.datetime;
 import mt;
 
 /**
@@ -15,12 +15,12 @@
 public class Rand {
   
   public this() {
-    d_time timer = getUTCtime();
-    init_genrand(timer);
+    long timer = Clock.currStdTime();
+    init_genrand(cast(uint)timer);
   }
 
   public void setSeed(long n) {
-    init_genrand(n);
+    init_genrand(cast(uint)n);
   }
 
   public int nextInt(int n) {
--- a/src/abagames/util/sdl/MainLoop.d
+++ b/src/abagames/util/sdl/MainLoop.d
@@ -91,7 +91,7 @@
       frame = cast(int) (nowTick-prvTickCount) / interval;
       if (frame <= 0) {
 	frame = 1;
-	SDL_Delay(prvTickCount+interval-nowTick);
+	SDL_Delay(cast(uint)(prvTickCount+interval-nowTick));
 	if (accframe) {
 	  prvTickCount = SDL_GetTicks();
 	} else {
--- a/src/abagames/util/sdl/Pad.d
+++ b/src/abagames/util/sdl/Pad.d
@@ -7,6 +7,7 @@
 
 private:
 import std.string;
+private import std.conv;
 import SDL;
 import abagames.util.sdl.Input;
 import abagames.util.sdl.SDLInitFailedException;
@@ -32,12 +33,12 @@
   public void openJoystick() {
     if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) < 0) {
       throw new SDLInitFailedException(
-	"Unable to init SDL joystick: " ~ std.string.toString(SDL_GetError()));
+	"Unable to init SDL joystick: " ~ to!string(SDL_GetError()));
     }
     stick = SDL_JoystickOpen(0);
   }
 
-  public void handleEvent(SDL_Event *event) {
+  public override void handleEvent(SDL_Event *event) {
     keys = SDL_GetKeyState(null);
   }
   
--- a/src/abagames/util/sdl/SDLInitFailedException.d
+++ b/src/abagames/util/sdl/SDLInitFailedException.d
@@ -9,7 +9,7 @@
  * SDL initialize failed.
  */
 public class SDLInitFailedException: Exception {
-  public this(char[] msg) {
+  public this(string msg) {
     super(msg);
   }
 }
--- a/src/abagames/util/sdl/Screen3D.d
+++ b/src/abagames/util/sdl/Screen3D.d
@@ -7,6 +7,7 @@
 
 private:
 import std.string;
+private import std.conv;
 import SDL;
 import opengl;
 import abagames.util.Logger;
@@ -41,7 +42,7 @@
     // Initialize SDL.
     if (SDL_Init(SDL_INIT_VIDEO) < 0) {
       throw new SDLInitFailedException(
-	"Unable to initialize SDL: " ~ std.string.toString(SDL_GetError()));
+	"Unable to initialize SDL: " ~ to!string(SDL_GetError()));
     }
     // Create an OpenGL screen.
     if (windowMode) {
@@ -51,7 +52,7 @@
     } 
     if (SDL_SetVideoMode(width, height, 0, videoFlags) == null) {
       throw new SDLInitFailedException
-	("Unable to create SDL screen: " ~ std.string.toString(SDL_GetError()));
+	("Unable to create SDL screen: " ~ to!string(SDL_GetError()));
     }
     glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
     resized(width, height);
@@ -64,7 +65,7 @@
   private void screenResized() {
     if (SDL_SetVideoMode(width, height, 0, videoFlags) == null) {
       throw new Exception
-        ("Unable to resize SDL screen: " ~ std.string.toString(SDL_GetError()));
+        ("Unable to resize SDL screen: " ~ to!string(SDL_GetError()));
     }
 
     glViewport(0, 0, width, height);
@@ -105,7 +106,7 @@
     throw new Exception("OpenGL error");
   }
 
-  protected void setCaption(char[] name) {
+  protected void setCaption(string name) {
     SDL_WM_SetCaption(std.string.toStringz(name), null);
   }
 
--- a/src/abagames/util/sdl/Sound.d
+++ b/src/abagames/util/sdl/Sound.d
@@ -7,6 +7,7 @@
 
 private:
 import std.string;
+private import std.conv;
 import SDL;
 import SDL_mixer;
 import abagames.util.sdl.SDLInitFailedException;
@@ -18,8 +19,8 @@
  public:
   static bool noSound = false;
   static int fadeOutSpeed = 1280;
-  static char[] soundsDir = "/usr/share/games/parsec47/sounds/";
-  static char[] chunksDir = "/usr/share/games/parsec47/sounds/";
+  static string soundsDir = "/usr/share/games/parsec47/sounds/";
+  static string chunksDir = "/usr/share/games/parsec47/sounds/";
 
   public static void init() {
     if (noSound) return;
@@ -32,7 +33,7 @@
     if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) {
       noSound = 1;
       throw new SDLInitFailedException
-	("Unable to initialize SDL_AUDIO: " ~ std.string.toString(SDL_GetError()));
+	("Unable to initialize SDL_AUDIO: " ~ to!string(SDL_GetError()));
     }
 
     audio_rate = 44100;
@@ -42,7 +43,7 @@
     if (Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers) < 0) {
       noSound = 1;
       throw new SDLInitFailedException
-	("Couldn't open audio: " ~ std.string.toString(SDL_GetError()));
+	("Couldn't open audio: " ~ to!string(SDL_GetError()));
     }
     Mix_QuerySpec(&audio_rate, &audio_format, &audio_channels);
   }
@@ -64,25 +65,25 @@
 
   // Load a sound or a chunk.
 
-  public void loadSound(char[] name) {
+  public void loadSound(string name) {
     if (noSound) return;
-    char[] fileName = soundsDir ~ name;
+    string fileName = soundsDir ~ name;
     music = Mix_LoadMUS(std.string.toStringz(fileName));
     if (!music) {
       noSound = true;
       throw new SDLInitFailedException("Couldn't load: " ~ fileName ~ 
-				       " (" ~ std.string.toString(Mix_GetError()) ~ ")");
+				       " (" ~ to!string(Mix_GetError()) ~ ")");
     }
   }
   
-  public void loadChunk(char[] name, int ch) {
+  public void loadChunk(string name, int ch) {
     if (noSound) return;
-    char[] fileName = chunksDir ~ name;
+    string fileName = chunksDir ~ name;
     chunk = Mix_LoadWAV(std.string.toStringz(fileName));
     if (!chunk) {
       noSound = true;
       throw new SDLInitFailedException("Couldn't load: " ~ fileName ~ 
-				       " (" ~ std.string.toString(Mix_GetError()) ~ ")");
+				       " (" ~ to!string(Mix_GetError()) ~ ")");
     }
     chunkChannel = ch;
   }
--- a/src/abagames/util/sdl/Texture.d
+++ b/src/abagames/util/sdl/Texture.d
@@ -16,13 +16,13 @@
  */
 public class Texture {
  public:
-  static char[] imagesDir = "/usr/share/games/parsec47/images/";
+  static string imagesDir = "/usr/share/games/parsec47/images/";
 
  private:
   GLuint num;
 
-  public this(char[] name) {
-    char[] fileName = imagesDir ~ name;
+  public this(string name) {
+    string fileName = imagesDir ~ name;
     SDL_Surface *surface;    
     surface = SDL_LoadBMP(std.string.toStringz(fileName));
     if (!surface) {
--- a/src/dirent.d
+++ b/src/dirent.d
@@ -3,8 +3,8 @@
 extern (C) {
 	alias void DIR;
 	alias void dirent;
-	DIR* opendir(char* name);
+	DIR* opendir(const(char)* name);
 	dirent* readdir(DIR* dir);
 	int closedir(DIR* dir);
-	char* readdir_filename(DIR* ent);
+	const(char)* readdir_filename(DIR* ent);
 }
--- a/src/mt.d
+++ b/src/mt.d
@@ -5,7 +5,7 @@
      Matthe Bellew, and Isaku Wada
    Andrew C. Edwards  v0.1  30 September 2003  edwardsac@ieee.org
 
-   Before using, initialize the state by using init_genrand(seed) 
+   Before using, initialize the state by using init_genrand(cast(uint)seed) 
    or init_by_array(init_key, key_length).
 
    Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
@@ -48,8 +48,7 @@
    Please CC: edwardsac@ieee.org on all correspondence
 */
 
-module MersenneTwister;
-import std.stream;
+module mt;
 
 /* Period parameters */  
 const int N = 624;
@@ -70,7 +69,7 @@
 {
     state[0]= s & 0xffffffffUL;
     for (int j=1; j<N; j++) {
-        state[j] = (1812433253UL * (state[j-1] ^ (state[j-1] >> 30)) + j); 
+        state[j] = (1812433253U * (state[j-1] ^ (state[j-1] >> 30)) + j); 
         /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */
         /* In the previous versions, MSBs of the seed affect   */
         /* only MSBs of the array state[].                        */
@@ -88,11 +87,11 @@
 void init_by_array(uint init_key[], uint key_length)
 {
     int i, j, k;
-    init_genrand(19650218UL);
+    init_genrand(cast(uint)19650218UL);
     i=1; j=0;
     k = (N>key_length ? N : key_length);
     for (; k; k--) {
-        state[i] = (state[i] ^ ((state[i-1] ^ (state[i-1] >> 30)) * 1664525UL))
+        state[i] = (state[i] ^ ((state[i-1] ^ (state[i-1] >> 30)) * 1664525U))
           + init_key[j] + j; /* non linear */
         state[i] &= 0xffffffffUL; /* for WORDSIZE > 32 machines */
         i++; j++;
@@ -100,7 +99,7 @@
         if (j>=key_length) j=0;
     }
     for (k=N-1; k; k--) {
-        state[i] = (state[i] ^ ((state[i-1] ^ (state[i-1] >> 30)) * 1566083941UL))
+        state[i] = (state[i] ^ ((state[i-1] ^ (state[i-1] >> 30)) * 1566083941U))
           - i; /* non linear */
         state[i] &= 0xffffffffUL; /* for WORDSIZE > 32 machines */
         i++;
@@ -113,14 +112,14 @@
 
 static void next_state()
 {
-    uint *p=state;
+    uint *p=state.ptr;
 
-    /* if init_genrand() has not been called, */
+    /* if init_genrand(cast(uint)) has not been called, */
     /* a default initial seed is used         */
-    if (initf==0) init_genrand(5489UL);
+    if (initf==0) init_genrand(cast(uint)5489UL);
 
     left = N;
-    next = state;
+    next = state.ptr;
     
     for (int j=N-M+1; --j; p++) 
         *p = p[M] ^ TWIST(p[0], p[1]);
@@ -233,7 +232,7 @@
     uint length=4;
     init_by_array(init, length);
     /* This is an example of initializing by an array.       */
-    /* You may use init_genrand(seed) with any 32bit integer */
+    /* You may use init_genrand(cast(uint)seed) with any 32bit integer */
     /* as a seed for a simpler initialization                */
     printf("1000 outputs of genrand_int32()\n");
     for (int i=0; i<1000; i++) {
--- a/src/abagames/p47/Enemy.d
+++ b/src/abagames/p47/Enemy.d
@@ -79,15 +79,12 @@
   bool damaged;
   int bossTimer;
   
-  public static this() {
-    rand = new Rand;
-  }
-
   public override Actor newActor() {
     return new Enemy;
   }
 
   public override void init(ActorInitializer ini) {
+    if (rand is null) rand = new Rand;
     EnemyInitializer ei = cast(EnemyInitializer) ini;
     field = ei.field;
     bullets = ei.bullets;
@@ -410,7 +407,7 @@
 	Roll rl = cast(Roll) rolls.actor[i];
 	ch = checkHit(rl.pos[0], 1.0, 1.0);
 	if (ch >= HIT) {
-	  for (int i = 0; i < 4; i++)
+	  for (int ii = 0; ii < 4; ii++)
 	    manager.addParticle(rl.pos[0], rand.nextFloat(std.math.PI * 2), 0, Shot.SPEED / 10);
 	  float rd = ROLL_DAMAGE;
 	  if (rl.released) {
@@ -442,7 +439,7 @@
 	} else if (lk.state == Lock.FIRED && lk.lockedEnemy == this) {
 	  ch = checkHit(lk.pos[0], 1.5, 1.5);
 	  if (ch >= HIT && ch == lk.lockedPart) {
-	    for (int i = 0; i < 4; i++)
+	    for (int ii = 0; ii < 4; ii++)
 	      manager.addParticle(lk.pos[0], rand.nextFloat(std.math.PI * 2), 0, Shot.SPEED / 10);
 	    if (ch == HIT)
 	      addDamage(LOCK_DAMAGE);
@@ -694,21 +691,21 @@
 	P47Screen.drawLineRetro(pos.x + bt.wingShapePos[0].x, pos.y + bt.wingShapePos[0].y,
 				pos.x + bt.wingShapePos[1].x, pos.y + bt.wingShapePos[1].y);
       } else {
-	for (int i = 0; i < BatteryType.WING_SHAPE_POINT_NUM; i++, ni++) {
+	for (int ii = 0; ii < BatteryType.WING_SHAPE_POINT_NUM; ii++, ni++) {
 	  if (ni >= BatteryType.WING_SHAPE_POINT_NUM)
 	    ni = 0;
-	  P47Screen.drawLineRetro(pos.x + bt.wingShapePos[i].x, pos.y + bt.wingShapePos[i].y,
+	  P47Screen.drawLineRetro(pos.x + bt.wingShapePos[ii].x, pos.y + bt.wingShapePos[ii].y,
 				  pos.x + bt.wingShapePos[ni].x, pos.y + bt.wingShapePos[ni].y);
 	}
 	if (type.type != EnemyType.SMALL) {
 	  glBegin(GL_TRIANGLE_FAN);
 	  Screen3D.setColor
 	    (P47Screen.retroR, P47Screen.retroG, P47Screen.retroB, P47Screen.retroA);
-	  for (int i = 0; i < BatteryType.WING_SHAPE_POINT_NUM; i++) {
-	    if (i == 2)
+	  for (int ii = 0; ii < BatteryType.WING_SHAPE_POINT_NUM; ii++) {
+	    if (ii == 2)
 	      Screen3D.setColor
 		(P47Screen.retroR, P47Screen.retroG, P47Screen.retroB, 0);
-	    glVertex3f(pos.x + bt.wingShapePos[i].x, pos.y + bt.wingShapePos[i].y, z);
+	    glVertex3f(pos.x + bt.wingShapePos[ii].x, pos.y + bt.wingShapePos[ii].y, z);
 	  }
 	  glEnd();
 	}
--- a/src/abagames/p47/Fragment.d
+++ b/src/abagames/p47/Fragment.d
@@ -34,15 +34,12 @@
   float retro;
   int cnt;
 
-  public static this() {
-    rand = new Rand;
-  }
-
   public override Actor newActor() {
     return new Fragment;
   }
 
   public override void init(ActorInitializer ini) {
+    if (rand is null) rand = new Rand;
     FragmentInitializer fi = cast(FragmentInitializer) ini;
     for (int i = 0; i < POINT_NUM; i++) {
       pos[i] = new Vector;
--- a/src/abagames/p47/LuminousScreen.d
+++ b/src/abagames/p47/LuminousScreen.d
@@ -25,9 +25,9 @@
   float luminous;
 
   private void makeLuminousTexture() {
-    uint *data = td;
+    uint *data = td.ptr;
     int i;
-    memset(data, 0, luminousTextureWidth * luminousTextureHeight * 4 * uint.sizeof);
+    td[] = 0;
     glGenTextures(1, &luminousTexture);
     glBindTexture(GL_TEXTURE_2D, luminousTexture);
     glTexImage2D(GL_TEXTURE_2D, 0, 4, luminousTextureWidth, luminousTextureHeight, 0,
--- a/src/abagames/p47/Particle.d
+++ b/src/abagames/p47/Particle.d
@@ -30,15 +30,12 @@
   float lumAlp;
   int cnt;
 
-  public static this() {
-    rand = new Rand;
-  }
-
   public override Actor newActor() {
     return new Particle;
   }
 
   public override void init(ActorInitializer ini) {
+    if (rand is null) rand = new Rand;
     pos = new Vector;
     ppos = new Vector;
     vel = new Vector;
--- a/src/abagames/p47/Shot.d
+++ b/src/abagames/p47/Shot.d
@@ -20,7 +20,7 @@
 public class Shot: Actor {
  public:
   Vector pos;
-  const float SPEED = 1;
+  static const float SPEED = 1;
  private:
   static const float FIELD_SPACE = 1;
   static int displayListIdx;