r3863 - packages/trunk/titanion/debian/patches
Peter De Wachter
pdewacht-guest at alioth.debian.org
Sun Aug 26 20:23:45 UTC 2007
Author: pdewacht-guest
Date: 2007-08-26 20:23:45 +0000 (Sun, 26 Aug 2007)
New Revision: 3863
Added:
packages/trunk/titanion/debian/patches/dotfile.patch
Modified:
packages/trunk/titanion/debian/patches/series
Log:
Put preferences and replay data in ~/.titanion
Added: packages/trunk/titanion/debian/patches/dotfile.patch
===================================================================
--- packages/trunk/titanion/debian/patches/dotfile.patch (rev 0)
+++ packages/trunk/titanion/debian/patches/dotfile.patch 2007-08-26 20:23:45 UTC (rev 3863)
@@ -0,0 +1,83 @@
+Index: titanion_0.3.dfsg1/src/abagames/ttn/replay.d
+===================================================================
+--- titanion_0.3.dfsg1.orig/src/abagames/ttn/replay.d 2007-08-26 22:18:35.000000000 +0200
++++ titanion_0.3.dfsg1/src/abagames/ttn/replay.d 2007-08-26 22:20:06.000000000 +0200
+@@ -8,13 +8,13 @@
+ private import std.stream;
+ private import abagames.util.sdl.pad;
+ private import abagames.util.sdl.recordableinput;
++private import abagames.ttn.preference;
+
+ /**
+ * Save/Load a replay data.
+ */
+ public class ReplayData {
+ public:
+- static const char[] DIR = "replay";
+ static const int VERSION_NUM = 30;
+ InputRecord!(PadState) inputRecord;
+ long seed;
+@@ -24,7 +24,7 @@
+ private:
+
+ public void save(char[] fileName) {
+- auto File fd = new File(DIR ~ "/" ~ fileName, FileMode.OutNew);
++ auto File fd = new File(Preference.pref_dir() ~ "/" ~ fileName, FileMode.OutNew);
+ fd.write(VERSION_NUM);
+ fd.write(seed);
+ fd.write(score);
+@@ -35,7 +35,7 @@
+ }
+
+ public void load(char[] fileName) {
+- auto File fd = new File(DIR ~ "/" ~ fileName, FileMode.In);
++ auto File fd = new File(Preference.pref_dir() ~ "/" ~ fileName, FileMode.In);
+ int ver;
+ fd.read(ver);
+ if (ver != VERSION_NUM)
+Index: titanion_0.3.dfsg1/src/abagames/ttn/preference.d
+===================================================================
+--- titanion_0.3.dfsg1.orig/src/abagames/ttn/preference.d 2007-08-26 22:18:35.000000000 +0200
++++ titanion_0.3.dfsg1/src/abagames/ttn/preference.d 2007-08-26 22:18:40.000000000 +0200
+@@ -6,6 +6,9 @@
+ module abagames.ttn.preference;
+
+ private import std.stream;
++private import std.file;
++private import std.c.stdlib;
++private import std.string;
+ private import abagames.util.preference;
+
+ /**
+@@ -21,10 +24,21 @@
+ int[RANKING_NUM][MODE_NUM] _highScore;
+ int _lastMode;
+
++ public static char[] pref_dir()
++ {
++ char[] dir = std.string.toString(getenv("HOME")) ~ "/.titanion";
++ try {
++ mkdir(dir);
++ } catch (FileException e) {
++ }
++ return dir;
++ }
++
++
+ public void load() {
+ auto File fd = null;
+ try {
+- fd = new File(PREF_FILE_NAME, FileMode.In);
++ fd = new File(pref_dir() ~ "/" ~ PREF_FILE_NAME, FileMode.In);
+ int ver;
+ fd.read(ver);
+ if (ver != VERSION_NUM)
+@@ -50,7 +64,7 @@
+ }
+
+ public void save() {
+- auto File fd = new File(PREF_FILE_NAME, FileMode.OutNew);
++ auto File fd = new File(pref_dir() ~ "/" ~ PREF_FILE_NAME, FileMode.OutNew);
+ fd.write(VERSION_NUM);
+ fd.write(_lastMode);
+ for(int j = 0; j < MODE_NUM; j++)
Modified: packages/trunk/titanion/debian/patches/series
===================================================================
--- packages/trunk/titanion/debian/patches/series 2007-08-26 20:17:40 UTC (rev 3862)
+++ packages/trunk/titanion/debian/patches/series 2007-08-26 20:23:45 UTC (rev 3863)
@@ -1,3 +1,4 @@
fix.diff
directories.patch
windowed.patch
+dotfile.patch
More information about the Pkg-games-commits
mailing list