Package: hannah / 1.0-3

fix-compiler-errors Patch series | 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
Index: hannah/pacman.cc
===================================================================
--- hannah.orig/pacman.cc	2015-06-07 18:28:33.512146734 +0200
+++ hannah/pacman.cc	2015-06-07 18:29:09.720969486 +0200
@@ -661,21 +661,21 @@
 
 };
 
-void drawBigTextAt(char* text, int x, int y){
+void drawBigTextAt(const char* text, int x, int y){
 	SDL_Surface* textsurface;
 	SDL_Color color = {0,0,0};
 	char tt[40];
-	sprintf(tt, text);
+	sprintf(tt, "%s", text);
 	textsurface = TTF_RenderText_Blended(bigfont,tt,color);
 	blit(textsurface,x,y);
 	SDL_FreeSurface(textsurface);	
 };
 
-void drawTextAt(char* text, int x, int y){
+void drawTextAt(const char* text, int x, int y){
 	SDL_Surface* textsurface;
 	SDL_Color color = {0,0,0};
 	char tt[40];
-	sprintf(tt, text);
+	sprintf(tt, "%s", text);
 	textsurface = TTF_RenderText_Blended(subgamefont,tt,color);
 	blit(textsurface,x,y);
 	SDL_FreeSurface(textsurface);	
Index: hannah/Animation.cc
===================================================================
--- hannah.orig/Animation.cc	2015-06-07 18:28:33.512146734 +0200
+++ hannah/Animation.cc	2015-06-07 18:28:33.504146552 +0200
@@ -7,7 +7,7 @@
 
 #define delay_set 3
 
-Animation::Animation(char* spritename, char* filename, bool loop, char* knownAs){
+Animation::Animation(const char* spritename, const char* filename, bool loop, const char* knownAs){
 	this->currentframe = 0;
 	this->name = filename;
 	this->loop = loop;
@@ -58,7 +58,7 @@
 	//printf("Finished with Animation constructor: %d frames\n",numframes);
 };
 
-char* Animation::getKnown(){
+const char* Animation::getKnown(){
 	return knownAs;
 };
 
Index: hannah/Animation.h
===================================================================
--- hannah.orig/Animation.h	2015-06-07 18:28:33.512146734 +0200
+++ hannah/Animation.h	2015-06-07 18:28:33.504146552 +0200
@@ -15,16 +15,16 @@
 
 class Animation{
 	public:
-		Animation(char* spritename, char *filename, bool loop, char* knownAs);
+		Animation(const char* spritename, const char *filename, bool loop, const char* knownAs);
 		virtual ~Animation();
 		SDL_Surface* getFrame();
 		SDL_Surface* getFrame(int fnum);
-		char* getKnown();
+		const char* getKnown();
 		void reset();
 		bool loop;
 		bool finished;
-		char* name;
-		char* knownAs;
+		const char* name;
+		const char* knownAs;
 	//private:
 		int numframes;
 		int currentframe;
Index: hannah/AnimationFactory.cc
===================================================================
--- hannah.orig/AnimationFactory.cc	2015-06-07 18:28:33.512146734 +0200
+++ hannah/AnimationFactory.cc	2015-06-07 18:28:33.504146552 +0200
@@ -53,7 +53,7 @@
 	return NULL;
 };
 
-void AnimationFactory::loadAnimation(char* spriteName, char* path, bool loop, char* knownAs){
+void AnimationFactory::loadAnimation(const char* spriteName, const char* path, bool loop, const char* knownAs){
 	Animation* a = new Animation(spriteName, path, loop, knownAs);
 	store.push_back(a);
 	//printf("Added. Store now stands at %d item\n",store.size());
Index: hannah/AnimationFactory.h
===================================================================
--- hannah.orig/AnimationFactory.h	2015-06-07 18:28:33.512146734 +0200
+++ hannah/AnimationFactory.h	2015-06-07 18:28:33.504146552 +0200
@@ -9,7 +9,7 @@
 		virtual ~AnimationFactory();
 		Animation* getByName(const char* name);
 		Animation* getByNumber(unsigned int n);
-		void loadAnimation(char* spriteName, char* path, bool loop, char* knownAs);
+		void loadAnimation(const char* spriteName, const char* path, bool loop, const char* knownAs);
 		Animation* getLast();
 		int size();
 		void list();
Index: hannah/Bonus.cc
===================================================================
--- hannah.orig/Bonus.cc	2015-06-07 18:28:33.512146734 +0200
+++ hannah/Bonus.cc	2015-06-07 18:28:33.504146552 +0200
@@ -2,7 +2,7 @@
 
 class Bonus;
 
-Bonus::Bonus(char *filename, int x, int y, int speed,AnimationFactory* af, char type):
+Bonus::Bonus(const char *filename, int x, int y, int speed,AnimationFactory* af, char type):
 	Ghost1(filename, x, y, speed, af){
 	this->lifeforce = 300;
 	this->alive = true;
Index: hannah/Bonus.h
===================================================================
--- hannah.orig/Bonus.h	2015-06-07 18:28:33.512146734 +0200
+++ hannah/Bonus.h	2015-06-07 18:28:33.504146552 +0200
@@ -6,7 +6,7 @@
 
 class Bonus : public Ghost1{
 	public:
-		Bonus(char *filename, int x, int y, int speed, AnimationFactory* af, char type);
+		Bonus(const char *filename, int x, int y, int speed, AnimationFactory* af, char type);
 		// Type is 's' for stop ghosts, 'k' for kill ghosts, 'u' for speed up ghosts, 'c' for switch controls
 		void decLife();
 		bool alive;
Index: hannah/Food.cc
===================================================================
--- hannah.orig/Food.cc	2015-06-07 18:28:33.512146734 +0200
+++ hannah/Food.cc	2015-06-07 18:28:33.504146552 +0200
@@ -2,7 +2,7 @@
 
 class Food;
 
-Food::Food(char *filename, int x, int y, int speed,AnimationFactory* af):
+Food::Food(const char *filename, int x, int y, int speed,AnimationFactory* af):
 	Ghost1(filename, x, y, speed, af){
 	this->alive = true;
 };
Index: hannah/Food.h
===================================================================
--- hannah.orig/Food.h	2015-06-07 18:28:33.512146734 +0200
+++ hannah/Food.h	2015-06-07 18:28:33.504146552 +0200
@@ -7,7 +7,7 @@
 
 class Food : public Ghost1{
 	public:
-		Food(char *filename, int x, int y, int speed, AnimationFactory* af);
+		Food(const char *filename, int x, int y, int speed, AnimationFactory* af);
 		bool alive;
 		virtual ~Food();	
 };
Index: hannah/Ghost.cc
===================================================================
--- hannah.orig/Ghost.cc	2015-06-07 18:28:33.512146734 +0200
+++ hannah/Ghost.cc	2015-06-07 18:28:33.504146552 +0200
@@ -17,7 +17,7 @@
 	return tot;
 };
 
-Ghost::Ghost(char *filename, int x, int y, int speed, AnimationFactory* af) :
+Ghost::Ghost(const char *filename, int x, int y, int speed, AnimationFactory* af) :
 	Sprite(filename, af){
 	this->effect = ' ';
 	timeleft = 0;
Index: hannah/Ghost.h
===================================================================
--- hannah.orig/Ghost.h	2015-06-07 18:28:33.512146734 +0200
+++ hannah/Ghost.h	2015-06-07 18:28:33.504146552 +0200
@@ -13,7 +13,7 @@
 
 class Ghost : public Sprite{
 	public:
-		Ghost(char* filename, int x, int y, int speed, AnimationFactory* af);	// Load all sprites in directory
+		Ghost(const char* filename, int x, int y, int speed, AnimationFactory* af);	// Load all sprites in directory
 		virtual ~Ghost();
 //		SDL_Surface* frame();
 		void x(int x);	// Set X
Index: hannah/Ghost1.cc
===================================================================
--- hannah.orig/Ghost1.cc	2015-06-07 18:28:33.512146734 +0200
+++ hannah/Ghost1.cc	2015-06-07 18:28:33.504146552 +0200
@@ -5,7 +5,7 @@
 
 class Ghost1;
 
-Ghost1::Ghost1(char* filename, int x, int y, int speed, AnimationFactory* af) :
+Ghost1::Ghost1(const char* filename, int x, int y, int speed, AnimationFactory* af) :
 	Ghost(filename, x, y, speed, af){
 	this->startx = x;
 	this->starty = y;
Index: hannah/Ghost1.h
===================================================================
--- hannah.orig/Ghost1.h	2015-06-07 18:28:33.512146734 +0200
+++ hannah/Ghost1.h	2015-06-07 18:28:33.504146552 +0200
@@ -11,7 +11,7 @@
 
 class Ghost1 : public Ghost{
 	public:
-		Ghost1(char* filename,int x, int y, int speed, AnimationFactory* af);	// Load all sprites in directory
+		Ghost1(const char* filename,int x, int y, int speed, AnimationFactory* af);	// Load all sprites in directory
 //		virtual ~Ghost1();
 		//SDL_Surface* frame();
 		//void x(int x);	// Set X
Index: hannah/Ghost2.cc
===================================================================
--- hannah.orig/Ghost2.cc	2015-06-07 18:28:33.512146734 +0200
+++ hannah/Ghost2.cc	2015-06-07 18:28:33.508146643 +0200
@@ -5,7 +5,7 @@
 
 class Ghost2;
 
-Ghost2::Ghost2(char* filename, int x, int y, int speed, AnimationFactory* af) : Ghost(filename,x,y,speed, af){
+Ghost2::Ghost2(const char* filename, int x, int y, int speed, AnimationFactory* af) : Ghost(filename,x,y,speed, af){
 
 	this->speed = speed;
 	this->startx = x;
Index: hannah/Ghost2.h
===================================================================
--- hannah.orig/Ghost2.h	2015-06-07 18:28:33.512146734 +0200
+++ hannah/Ghost2.h	2015-06-07 18:28:33.508146643 +0200
@@ -9,7 +9,7 @@
 
 class Ghost2 : public Ghost{
 	public:
-		Ghost2(char* filename, int x, int y, int speed, AnimationFactory* af);	// Load all sprites in directory
+		Ghost2(const char* filename, int x, int y, int speed, AnimationFactory* af);	// Load all sprites in directory
 		//virtual ~Ghost2();
 		//SDL_Surface* frame();
 		//void x(int x);	// Set X
Index: hannah/Ghost3.cc
===================================================================
--- hannah.orig/Ghost3.cc	2015-06-07 18:28:33.512146734 +0200
+++ hannah/Ghost3.cc	2015-06-07 18:28:33.508146643 +0200
@@ -5,7 +5,7 @@
 
 class Ghost3;
 
-Ghost3::Ghost3(char* filename, int x, int y, int speed, AnimationFactory* af) : Ghost(filename,x,y,speed, af){
+Ghost3::Ghost3(const char* filename, int x, int y, int speed, AnimationFactory* af) : Ghost(filename,x,y,speed, af){
 	
 	this->speed = speed;
 	this->startx = x;
Index: hannah/Ghost3.h
===================================================================
--- hannah.orig/Ghost3.h	2015-06-07 18:28:33.512146734 +0200
+++ hannah/Ghost3.h	2015-06-07 18:28:33.508146643 +0200
@@ -9,7 +9,7 @@
 
 class Ghost3 : public Ghost{
 	public:
-		Ghost3(char* filename, int x, int y, int speed, AnimationFactory* af);	// Load all sprites in directory
+		Ghost3(const char* filename, int x, int y, int speed, AnimationFactory* af);	// Load all sprites in directory
 //		virtual ~Ghost3();
 		//SDL_Surface* frame();
 		//void x(int x);	// Set X
Index: hannah/Player.cc
===================================================================
--- hannah.orig/Player.cc	2015-06-07 18:28:33.512146734 +0200
+++ hannah/Player.cc	2015-06-07 18:28:33.508146643 +0200
@@ -1,7 +1,7 @@
 #include "Player.h"
 
 
-Player::Player(char *name, AnimationFactory* af) : Sprite(name, af){
+Player::Player(const char *name, AnimationFactory* af) : Sprite(name, af){
 
 };
 
Index: hannah/Player.h
===================================================================
--- hannah.orig/Player.h	2015-06-07 18:28:33.512146734 +0200
+++ hannah/Player.h	2015-06-07 18:28:33.508146643 +0200
@@ -2,7 +2,7 @@
 
 class Player : public Sprite{
 	public:
-		Player(char* name, AnimationFactory* af);
+		Player(const char* name, AnimationFactory* af);
 //		virtual ~Player();
 		void move();
 		void respawn();
Index: hannah/Sprite.cc
===================================================================
--- hannah.orig/Sprite.cc	2015-06-07 18:28:33.512146734 +0200
+++ hannah/Sprite.cc	2015-06-07 18:28:33.508146643 +0200
@@ -6,7 +6,7 @@
 
 class Sprite;
 
-Sprite::Sprite(char* spritename, AnimationFactory* af){
+Sprite::Sprite(const char* spritename, AnimationFactory* af){
 	//printf(">-------Creating sprite\n");
 	this->name = spritename;
 	this->af = af;
@@ -47,7 +47,7 @@
 	}
 };
 
-bool Sprite::isAnimation(char* name){
+bool Sprite::isAnimation(const char* name){
 	if(strcmp(name,current->name)==0){
 		return true;
 	} else {
@@ -55,7 +55,7 @@
 	}
 };
 
-char* Sprite::getAnimation(){
+const char* Sprite::getAnimation(){
 	return current->name;
 };
 /*
@@ -64,7 +64,7 @@
 	animations.push_back(tmp);
 };*/
 
-void Sprite::setAnimation(char* name){
+void Sprite::setAnimation(const char* name){
 	alive = true;
 	string s(name);
 	string nn(this->name);
Index: hannah/Sprite.h
===================================================================
--- hannah.orig/Sprite.h	2015-06-07 18:28:33.512146734 +0200
+++ hannah/Sprite.h	2015-06-07 18:28:33.508146643 +0200
@@ -8,13 +8,13 @@
 
 class Sprite{
 	public:
-		Sprite(char* filename, AnimationFactory* af);	// Load all sprites in directory
+		Sprite(const char* filename, AnimationFactory* af);	// Load all sprites in directory
 		virtual ~Sprite();
 		SDL_Surface* frame();
-		void loadAnimation(char *animName, bool loop);
-		bool isAnimation(char* name);
-		char* getAnimation();
-		void setAnimation(char *name);
+		void loadAnimation(const char *animName, bool loop);
+		bool isAnimation(const char* name);
+		const char* getAnimation();
+		void setAnimation(const char *name);
 		bool animationFinished();
 		void kill();
 		void x(int x);	// Set X
@@ -33,7 +33,7 @@
 		vector<Animation*> animations;
 		Animation* current;
 		AnimationFactory* af;
-		char* name;
+		const char* name;
 		int xpos;
 		int ypos;
 		int gridxpos;