Codebase list alex4 / 3bb405e debian / patches / fix_errors_with_multiple_definitions.patch
3bb405e

Tree @3bb405e (Download .tar.gz)

fix_errors_with_multiple_definitions.patch @3bb405eraw · history · blame

Author: Andreas Rönnquist <gusnan@debian.org>
Description: Fixes a few "multiple definition of" instances
 
--- a/src/timer.c
+++ b/src/timer.c
@@ -23,6 +23,15 @@
 #include "allegro.h"
 #include "timer.h"
 
+// the variables used by the timers
+volatile int frame_count;
+volatile int fps;
+volatile int logic_count;
+volatile int lps;
+volatile int cycle_count;
+volatile int game_count;
+
+
 // keeps track of frames each second
 void fps_counter(void) {
 	fps = frame_count;
@@ -60,4 +69,4 @@
 	game_count ++;
 
 	return TRUE;
-}
+}
--- a/src/timer.h
+++ b/src/timer.h
@@ -24,12 +24,12 @@
 #define _TIMERS_H_
 
 // the variables used by the timers
-volatile int frame_count;
-volatile int fps;
-volatile int logic_count;
-volatile int lps;
-volatile int cycle_count;
-volatile int game_count;
+extern volatile int frame_count;
+extern volatile int fps;
+extern volatile int logic_count;
+extern volatile int lps;
+extern volatile int cycle_count;
+extern volatile int game_count;
 
 
 // functions
@@ -37,4 +37,4 @@
 void fps_counter(void);
 void cycle_counter(void);
 
-#endif
+#endif
--- a/src/particle.c
+++ b/src/particle.c
@@ -24,7 +24,10 @@
 #include "defs.h"
 
 // pointer to datafile
-DATAFILE *data;
+extern DATAFILE *data;
+
+// the particles themselves
+Tparticle particle[MAX_PARTICLES];
 
 
 // set datafile to use
--- a/src/particle.h
+++ b/src/particle.h
@@ -42,7 +42,7 @@
 
 
 // the particles themselves
-Tparticle particle[MAX_PARTICLES];
+extern Tparticle particle[MAX_PARTICLES];
 
 // functions
 void set_datafile(DATAFILE *d);
--- a/src/player.c
+++ b/src/player.c
@@ -25,6 +25,9 @@
 #include "timer.h"
 #include "../data/data.h"
 
+// the player 
+Tplayer player;
+
 // draws the player depending on his state
 void draw_player(BITMAP *bmp, Tplayer *p, int x, int y) {
 	BITMAP *head, *body;
--- a/src/player.h
+++ b/src/player.h
@@ -53,7 +53,7 @@
 
 
 // the player 
-Tplayer player;
+extern Tplayer player;
 
 // functions
 void draw_player(BITMAP *bmp, Tplayer *p, int x, int y);
--- a/src/bullet.c
+++ b/src/bullet.c
@@ -26,6 +26,9 @@
 #include "timer.h"
 #include "../data/data.h"
 
+// the bullets themselves
+Tbullet bullet[MAX_BULLETS];
+
 
 // sets values on a bullet
 void set_bullet(Tbullet *b, int x, int y, double dx, double dy, BITMAP *bmp, int bad) {
--- a/src/bullet.h
+++ b/src/bullet.h
@@ -42,7 +42,7 @@
 #define MAX_BULLETS	64
 
 // the bullets themselves
-Tbullet bullet[MAX_BULLETS];
+extern Tbullet bullet[MAX_BULLETS];
 
 // functions
 void reset_bullets(Tbullet *b, int max);
--- a/src/script.c
+++ b/src/script.c
@@ -35,7 +35,7 @@
 
 
 // datafile to use
-DATAFILE *data;
+extern DATAFILE *data;
 // internal buffers
 BITMAP *buffer;
 BITMAP *swap_buffer;
@@ -44,6 +44,9 @@
 // any objects
 Tscript_object *objects = NULL;
 
+// array holding the sounds ids
+int active_sounds[MAX_SCRIPT_SOUNDS];
+
 
 
 // shows a speak bulb 
--- a/src/script.h
+++ b/src/script.h
@@ -42,7 +42,7 @@
 // max number of sounds played by the script
 #define MAX_SCRIPT_SOUNDS	16
 // array holding the sounds ids
-int active_sounds[MAX_SCRIPT_SOUNDS];
+extern int active_sounds[MAX_SCRIPT_SOUNDS];
 
 
 // functions
--- a/src/edit.c
+++ b/src/edit.c
@@ -34,7 +34,7 @@
 // path to current map
 char edit_path_and_file[1024];
 // datafile to use
-DATAFILE *data;
+extern DATAFILE *data;
 // current edit mode
 int edit_mode;