Differences From Artifact [b301f73c74ef62f4]:
- File
src/output.d
- 2012-07-15 11:17:59 - part of checkin [ff0ab77d3d] on branch trunk - new game class. (user: kinaba) [annotate]
To Artifact [e2d0d7db868c3a44]:
- File
src/output.d
- 2012-07-15 11:26:58 - part of checkin [bd650eb3f9] on branch trunk - Output is now fully functional. (user: kinaba) [annotate]
14 14 this(in Game g) {}
15 15 override void on_game_changed(char c, in Game g, bool finished)
16 16 {
17 17 stdout.write(c);
18 18 stdout.flush();
19 19 }
20 20 }
21 -/*
21 +
22 22 class GuardedOutput : GameObserver
23 23 {
24 24 this(in Game g)
25 25 {
26 26 setup_sigint_handling();
27 27 score_log ~= g.score;
28 28 flushed = false;
................................................................................
31 31 override void on_game_changed(char c, in Game g, bool finished)
32 32 {
33 33 if(flushed)
34 34 return;
35 35
36 36 log ~= c;
37 37 score_log ~= g.score;
38 - if(finished || log.length+1==g.map.W*g.map.H)
38 + if(finished || log.length+1==g.W*g.H)
39 39 flush();
40 40 }
41 41
42 42 private:
43 43 string log;
44 44 long[] score_log;
45 45 bool flushed;
................................................................................
68 68 {
69 69 assert(g_output is null);
70 70 g_output = this;
71 71 extern(C) static void catch_sigint(int) { g_output.flush(); application_exit(); }
72 72 core.stdc.signal.signal(SIGINT, &catch_sigint);
73 73 }
74 74 }
75 -*/