Added todo, const correctness.

This commit is contained in:
Felix Wallin 2010-09-03 16:05:09 +02:00
parent aba3109f6f
commit 5b5a80c0af
4 changed files with 21 additions and 18 deletions

View File

@ -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; 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 #ifdef OpenGL
#else #else

View File

@ -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); extern inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a);
#endif #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); 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(); void ClearScreen();
#endif #endif
#endif #endif

10
main.c
View File

@ -50,7 +50,7 @@
#include "air.h" #include "air.h"
#include "icon.h" #include "icon.h"
char *it_msg = static const char *it_msg =
"\brThe Powder Toy\n" "\brThe Powder Toy\n"
"\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\n" "\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\n"
"\n" "\n"
@ -90,9 +90,9 @@ typedef struct
} upstruc; } upstruc;
#ifdef BETA #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 #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; float mheat = 0.0f;
int do_open = 0; int do_open = 0;
@ -130,7 +130,7 @@ int core_count()
return numCPU; return numCPU;
} }
int mousex, mousey = 0; //They contain mouse position int mousex = 0, mousey = 0; //They contain mouse position
void sdl_seticon(void) void sdl_seticon(void)
{ {
@ -964,7 +964,7 @@ int main(int argc, char *argv[])
#ifdef MT #ifdef MT
numCores = core_count(); numCores = core_count();
#endif #endif
//TODO: Move out version stuff
#ifdef BETA #ifdef BETA
if(is_beta) if(is_beta)
{ {

View File

@ -114,12 +114,15 @@
#define ST_SOLID 1 #define ST_SOLID 1
#define ST_LIQUID 2 #define ST_LIQUID 2
#define ST_GAS 3 #define ST_GAS 3
/*
static unsigned char TYPE_PART = 0x01; //1 We should start to implement these.
static unsigned char TYPE_LIQUID = 0x02; //2 */
static unsigned char TYPE_SOLID = 0x04; //4 static const unsigned short TYPE_PART = 0x01; //1
static unsigned char TYPE_GAS = 0x08; //8 static const unsigned short TYPE_LIQUID = 0x02; //2
static unsigned char PROP_CONDUCTS = 0x10; //16 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 #define FLAG_STAGNANT 1
struct particle struct particle
@ -156,7 +159,7 @@ struct part_type
float heat; float heat;
unsigned char hconduct; unsigned char hconduct;
const char *descs; const char *descs;
unsigned char properties; const unsigned short properties;
}; };
typedef struct part_type part_type; typedef struct part_type part_type;
@ -173,8 +176,8 @@ struct part_state
float btemp; float btemp;
}; };
typedef struct part_state part_state; typedef struct part_state part_state;
//Should probably be const.
static part_type ptypes[PT_NUM] = 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 //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."}, {"", 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); void create_line(int x1, int y1, int x2, int y2, int r, int c);
#endif #endif