summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Wallin <nibbler.v1@gmail.com>2010-09-03 14:05:09 (GMT)
committer Felix Wallin <nibbler.v1@gmail.com>2010-09-03 14:05:09 (GMT)
commit5b5a80c0af4d66c9a247366fe6aedb34b277b67b (patch)
tree63fb031cae7d73b0662c1b810bb2ec0b569a178c
parentaba3109f6f70aeff6353869f53aa9a9876adcc36 (diff)
downloadpowder-5b5a80c0af4d66c9a247366fe6aedb34b277b67b.zip
powder-5b5a80c0af4d66c9a247366fe6aedb34b277b67b.tar.gz
Added todo, const correctness.
-rw-r--r--graphics.c2
-rw-r--r--graphics.h4
-rw-r--r--main.c10
-rw-r--r--powder.h23
4 files changed, 21 insertions, 18 deletions
diff --git a/graphics.c b/graphics.c
index 0cca507..7508c57 100644
--- a/graphics.c
+++ b/graphics.c
@@ -799,7 +799,7 @@ inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a)
return x + w;
}
-int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a)
+int drawtext(pixel *vid, int x, int y, const char *s, int r, int g, int b, int a)
{
#ifdef OpenGL
#else
diff --git a/graphics.h b/graphics.h
index 2bfacaa..6a1507e 100644
--- a/graphics.h
+++ b/graphics.h
@@ -75,7 +75,7 @@ _inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a
extern inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a);
#endif
-int drawtext(pixel *vid, int x, int y, char *s, int r, int g, int b, int a);
+int drawtext(pixel *vid, int x, int y, const char *s, int r, int g, int b, int a);
void drawrect(pixel *vid, int x, int y, int w, int h, int r, int g, int b, int a);
@@ -141,4 +141,4 @@ void RenderScene ();
void ClearScreen();
#endif
-#endif \ No newline at end of file
+#endif
diff --git a/main.c b/main.c
index 82e407f..30c86e6 100644
--- a/main.c
+++ b/main.c
@@ -50,7 +50,7 @@
#include "air.h"
#include "icon.h"
-char *it_msg =
+static const char *it_msg =
"\brThe Powder Toy\n"
"\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\n"
"\n"
@@ -90,9 +90,9 @@ typedef struct
} upstruc;
#ifdef BETA
-char *old_ver_msg_beta = "A new beta is available - click here!";
+static const char *old_ver_msg_beta = "A new beta is available - click here!";
#endif
-char *old_ver_msg = "A new version is available - click here!";
+static const char *old_ver_msg = "A new version is available - click here!";
float mheat = 0.0f;
int do_open = 0;
@@ -130,7 +130,7 @@ int core_count()
return numCPU;
}
-int mousex, mousey = 0; //They contain mouse position
+int mousex = 0, mousey = 0; //They contain mouse position
void sdl_seticon(void)
{
@@ -964,7 +964,7 @@ int main(int argc, char *argv[])
#ifdef MT
numCores = core_count();
#endif
-
+//TODO: Move out version stuff
#ifdef BETA
if(is_beta)
{
diff --git a/powder.h b/powder.h
index 7bd2a9c..6b6610a 100644
--- a/powder.h
+++ b/powder.h
@@ -114,12 +114,15 @@
#define ST_SOLID 1
#define ST_LIQUID 2
#define ST_GAS 3
-
-static unsigned char TYPE_PART = 0x01; //1
-static unsigned char TYPE_LIQUID = 0x02; //2
-static unsigned char TYPE_SOLID = 0x04; //4
-static unsigned char TYPE_GAS = 0x08; //8
-static unsigned char PROP_CONDUCTS = 0x10; //16
+/*
+ We should start to implement these.
+*/
+static const unsigned short TYPE_PART = 0x01; //1
+static const unsigned short TYPE_LIQUID = 0x02; //2
+static const unsigned short TYPE_SOLID = 0x04; //4
+static const unsigned short TYPE_GAS = 0x08; //8
+static const unsigned short PROP_CONDUCTS = 0x10; //16
+static const unsigned short PROP_DEADLY = 0x12; //18 Is deadly for stickman.
#define FLAG_STAGNANT 1
struct particle
@@ -156,7 +159,7 @@ struct part_type
float heat;
unsigned char hconduct;
const char *descs;
- unsigned char properties;
+ const unsigned short properties;
};
typedef struct part_type part_type;
@@ -173,8 +176,8 @@ struct part_state
float btemp;
};
typedef struct part_state part_state;
-
-static part_type ptypes[PT_NUM] =
+//Should probably be const.
+static const part_type ptypes[PT_NUM] =
{
//Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description
{"", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SPECIAL, R_TEMP+0.0f, 251, "Erases particles."},
@@ -467,4 +470,4 @@ int create_parts(int x, int y, int r, int c);
void create_line(int x1, int y1, int x2, int y2, int r, int c);
-#endif \ No newline at end of file
+#endif