updated on Tue Jan 17 12:00:36 UTC 2012
[aur-mirror.git] / dragonhunt / dragonhunt.patch
bloba0d9c42bb315cfb54e6198c4387758fd129d9f5c
1 --- code/g.py~ 2007-05-06 13:17:19.000000000 +0600
2 +++ code/g.py 2009-11-06 14:53:20.374121445 +0500
3 @@ -31,7 +31,7 @@
4 from random import random
5 #needed for save/load game
6 import pickle
7 -from os import path, mkdir, remove, walk
8 +from os import path, mkdir, remove, walk, environ
10 #needed for scripting
11 from scripting import *
12 @@ -137,11 +137,11 @@
13 #uses pickle, first line is a version number.
14 def savegame(save_file):
15 #If there is no save directory, make one.
16 - if path.isdir(g.mod_directory + "/saves") == 0:
17 - if path.exists(g.mod_directory + "/saves") == 1:
18 - remove(g.mod_directory + "/saves")
19 - mkdir(g.mod_directory + "/saves")
20 - save_loc = g.mod_directory + "/saves/" + save_file
21 + if path.isdir(environ["HOME"] + "/.dragonhunt/saves/" + g.mod_directory + "/saves") == 0:
22 + if path.exists(environ["HOME"] + "/.dragonhunt/saves/" + g.mod_directory + "/saves") == 1:
23 + remove(environ["HOME"] + "/.dragonhunt/saves/" + g.mod_directory + "/saves")
24 + mkdir(environ["HOME"] + "/.dragonhunt/saves/" + g.mod_directory + "/saves")
25 + save_loc = environ["HOME"] + "/.dragonhunt/saves/" + g.mod_directory + "/saves/" + save_file
26 savefile=open(save_loc, 'w')
27 #savefile version; update whenever the data saved changes.
28 pickle.dump("dh3.3", savefile)
29 @@ -187,7 +187,7 @@
30 savefile.close()
32 def loadgame(save_file):
33 - save_loc = g.mod_directory + "/saves/" + save_file
34 + save_loc = environ["HOME"] + "/.dragonhunt/saves/" + g.mod_directory + "/saves/" + save_file
35 savefile=open(save_loc, 'r')
36 version = pickle.load(savefile)
37 if version != "dh3.3":
38 @@ -229,7 +229,7 @@
39 savefile.close()
41 def loadgame_31(save_file):
42 - save_loc = g.mod_directory + "/saves/" + save_file
43 + save_loc = environ["HOME"] + "/.dragonhunt/saves/" + g.mod_directory + "/saves/" + save_file
44 savefile=open(save_loc, 'r')
45 version = pickle.load(savefile)
46 if version != "dh3.2":
47 @@ -372,7 +372,7 @@
48 fullscreen = 0
49 #try to open settings.txt. If it doesn't exist,
50 # just use the default settings.
51 - try: file = open("../settings.txt", 'r')
52 + try: file = open(environ["HOME"] + "/.dragonhunt/settings.txt", 'r')
53 except IOError: return 0
54 line = file.readline()
55 while (line != ''):
56 --- code/loadgame.py~ 2007-05-05 10:43:50.000000000 +0600
57 +++ code/loadgame.py 2009-11-06 14:54:55.267445839 +0500
58 @@ -21,7 +21,7 @@
60 import pygame
61 import g
62 -from os import listdir, path, mkdir, remove
63 +from os import listdir, path, mkdir, remove, environ
65 #was a game loaded? Used to determine whether to use newgame script.
66 did_load = ""
67 @@ -92,7 +92,7 @@
68 tmp_titles.append("")
69 # return
70 else:
71 - save_loc = g.mod_directory + "/saves/" + saves_array[saves_pos]
72 + save_loc = environ["HOME"] + "/.dragonhunt/saves/" + g.mod_directory + "/saves/" + saves_array[saves_pos]
73 savefile=open(save_loc, 'r')
74 version_unused = g.pickle.load(savefile)
75 tmp_stats["name"] = str(g.pickle.load(savefile))
76 @@ -359,14 +359,14 @@
77 pixels_per_line = 20
79 #If there is no save directory, make one.
80 - if path.isdir(g.mod_directory + "/saves") == 0:
81 - if path.exists(g.mod_directory + "/saves") == 1:
82 - remove(g.mod_directory + "/saves")
83 - mkdir(g.mod_directory + "/saves")
84 + if path.isdir(environ["HOME"] + "/.dragonhunt/saves/" + g.mod_directory + "/saves") == 0:
85 + if path.exists(environ["HOME"] + "/.dragonhunt/saves/" + g.mod_directory + "/saves") == 1:
86 + remove(environ["HOME"] + "/.dragonhunt/saves/" + g.mod_directory + "/saves")
87 + mkdir(environ["HOME"] + "/.dragonhunt/saves/" + g.mod_directory + "/saves")
88 #show the files contained in the saves directory.
89 global saves_array
90 saves_array = []
91 - tmp_saves_array = listdir(g.mod_directory + "/saves")
92 + tmp_saves_array = listdir(environ["HOME"] + "/.dragonhunt/saves/" + g.mod_directory + "/saves")
93 for save_name in tmp_saves_array:
94 if save_name [:1] != "." and save_name != "CVS":
95 saves_array.append(save_name)
96 --- code/options.py~ 2007-05-06 12:04:14.000000000 +0600
97 +++ code/options.py 2009-11-06 15:05:38.880717907 +0500
98 @@ -20,7 +20,7 @@
100 import pygame
101 import g
102 -from os import path
103 +from os import path, environ
105 #-1=none, 0=fullscreen, 1=difficulty, 2=custom key, 3=use joy, 4=custom joy
106 #5=save, 6=reset, 7=cancel
107 @@ -276,8 +276,8 @@
109 #save the settings to disk
110 options_file_text = []
111 - if path.exists(g.mod_directory + "/../../settings.txt") == 1:
112 - optionfile = open(g.mod_directory + "/../../settings.txt")
113 + if path.exists(environ["HOME"] + "/.dragonhunt/settings.txt") == 1:
114 + optionfile = open(environ["HOME"] + "/.dragonhunt/settings.txt")
115 options_file_text = optionfile.readlines()
116 else:
117 "Could not open settings.txt. Not saving settings."
118 @@ -309,7 +309,7 @@
119 options_file_text[linenum]=command+"="+str(g.joy_axis1)+"\n"
121 optionfile.close()
122 - optionfile = open(g.mod_directory + "/../../settings.txt", "w")
123 + optionfile = open(environ["HOME"] + "/.dragonhunt/settings.txt", "w")
124 optionfile.writelines(options_file_text)