From 626cc8fa6a6cf5e2f046d138b72e3122614c46ad Mon Sep 17 00:00:00 2001 From: Simon Date: Fri, 8 Apr 2011 15:28:57 +0100 Subject: [PATCH] Remove a TON of warnings --- includes/graphics.h | 19 +- includes/misc.h | 19 +- includes/powder.h | 51 +-- src/main.c | 1013 ++++++++++++++++++++++--------------------- 4 files changed, 525 insertions(+), 577 deletions(-) diff --git a/includes/graphics.h b/includes/graphics.h index eed3ed641..31f8c57d4 100644 --- a/includes/graphics.h +++ b/includes/graphics.h @@ -64,17 +64,9 @@ int draw_tool_xy(pixel *vid_buf, int x, int y, int b, unsigned pc); void draw_menu(pixel *vid_buf, int i, int hover); -#if defined(WIN32) && !defined(__GNUC__) -_inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a); -#else -extern inline void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a); -#endif +void drawpixel(pixel *vid, int x, int y, int r, int g, int b, int a); -#if defined(WIN32) && !defined(__GNUC__) -_inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a); -#else -extern inline int drawchar(pixel *vid, int x, int y, int c, int r, int g, int b, int a); -#endif +int drawchar(pixel *vid, int x, int y, int c, 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); @@ -99,13 +91,10 @@ void textnpos(char *s, int n, int w, int *cx, int *cy); int textwidthx(char *s, int w); int textposxy(char *s, int width, int w, int h); + int textwrapheight(char *s, int width); -#if defined(WIN32) && !defined(__GNUC__) -_inline void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a); -#else void blendpixel(pixel *vid, int x, int y, int r, int g, int b, int a); -#endif void draw_icon(pixel *vid_buf, int x, int y, char ch, int flag); @@ -122,7 +111,9 @@ void xor_line(int x1, int y1, int x2, int y2, pixel *vid); void xor_rect(pixel *vid, int x, int y, int w, int h); void draw_parts(pixel *vid); + void draw_wavelengths(pixel *vid, int x, int y, int h, int wl); + void render_signs(pixel *vid_buf); void render_fire(pixel *dst); diff --git a/includes/misc.h b/includes/misc.h index c3ba03e8f..ef23b1e2a 100644 --- a/includes/misc.h +++ b/includes/misc.h @@ -20,24 +20,13 @@ __asm__ __volatile ("cpuid":\ #endif static char hex[] = "0123456789ABCDEF"; + //Signum function -#if defined(WIN32) && !defined(__GNUC__) -extern _inline int isign(float i); -#else -extern inline int isign(float i); -#endif +int isign(float i); -#if defined(WIN32) && !defined(__GNUC__) -extern _inline unsigned clamp_flt(float f, float min, float max); -#else -extern inline unsigned clamp_flt(float f, float min, float max); -#endif +unsigned clamp_flt(float f, float min, float max); -#if defined(WIN32) && !defined(__GNUC__) -extern _inline float restrict_flt(float f, float min, float max); -#else -extern inline float restrict_flt(float f, float min, float max); -#endif +float restrict_flt(float f, float min, float max); char *mystrdup(char *s); diff --git a/includes/powder.h b/includes/powder.h index 8e40eadbe..66614b280 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -814,43 +814,19 @@ static void create_gain_photon(int pp); void kill_part(int i); -#if defined(WIN32) && !defined(__GNUC__) -extern _inline void part_change_type(int i, int x, int y, int t); -#else -extern inline void part_change_type(int i, int x, int y, int t); -#endif +void part_change_type(int i, int x, int y, int t); -#if defined(WIN32) && !defined(__GNUC__) -extern _inline int create_part(int p, int x, int y, int t); -#else -extern inline int create_part(int p, int x, int y, int t); -#endif +int create_part(int p, int x, int y, int t); -#if defined(WIN32) && !defined(__GNUC__) -extern _inline void delete_part(int x, int y); -#else -extern inline void delete_part(int x, int y); -#endif +void delete_part(int x, int y); -#if defined(WIN32) && !defined(__GNUC__) -extern _inline int is_wire(int x, int y); -#else -extern inline int is_wire(int x, int y); -#endif +int is_wire(int x, int y); -#if defined(WIN32) && !defined(__GNUC__) -extern _inline int is_wire_off(int x, int y); -#else -extern inline int is_wire_off(int x, int y); -#endif +int is_wire_off(int x, int y); void set_emap(int x, int y); -#if defined(WIN32) && !defined(__GNUC__) -extern _inline int parts_avg(int ci, int ni, int t); -#else -extern int parts_avg(int ci, int ni, int t); -#endif +int parts_avg(int ci, int ni, int t); int nearest_part(int ci, int t); @@ -869,20 +845,11 @@ int flood_parts(int x, int y, int c, int cm, int bm); int create_parts(int x, int y, int rx, int ry, int c); void create_line(int x1, int y1, int x2, int y2, int rx, int ry, int c); + void *transform_save(void *odata, int *size, matrix2d transform, vector2d translate); +void orbitalparts_get(int block1, int block2, int resblock1[], int resblock2[]); -#if defined(WIN32) && !defined(__GNUC__) -extern _inline void orbitalparts_get(int block1, int block2, int resblock1[], int resblock2[]); -#else -extern inline void orbitalparts_get(int block1, int block2, int resblock1[], int resblock2[]); -#endif - - -#if defined(WIN32) && !defined(__GNUC__) -extern _inline void orbitalparts_set(int *block1, int *block2, int resblock1[], int resblock2[]); -#else -extern inline void orbitalparts_set(int *block1, int *block2, int resblock1[], int resblock2[]); -#endif +void orbitalparts_set(int *block1, int *block2, int resblock1[], int resblock2[]); #endif diff --git a/src/main.c b/src/main.c index c019bfdf2..c6776d3bf 100644 --- a/src/main.c +++ b/src/main.c @@ -2049,6 +2049,508 @@ static PyMethodDef EmbMethods[] = { //WARNING! don't forget to register your fun }; #endif +#ifdef PYCONSOLE +int process_command(pixel *vid_buf,char *console,char *console_error,PyObject *pfunc) { + int y,x,nx,ny,i,j,k,m; + int do_next = 1; + char xcoord[10]; + char ycoord[10]; + char console2[15]; + char console3[15]; + char console4[15]; + char console5[15]; + PyObject *pvalue,*pargs; + //sprintf(console_error, "%s", console); + if (console && strcmp(console, "")!=0 && strncmp(console, " ", 1)!=0) + { + sscanf(console,"%14s %14s %14s %14s", console2, console3, console4, console5);//why didn't i know about this function?! + if (strcmp(console2, "quit")==0) + { + return -1; + } else { + //handle them command + pargs=Py_BuildValue("(s)",console); + pvalue = PyObject_CallObject(pfunc, pargs); + Py_DECREF(pargs); + pargs=NULL; + if (pvalue==NULL) + strcpy(console_error,"failed to execute code."); + pvalue=NULL; + } + } + return 1; +} +#endif +int process_command_old(pixel *vid_buf,char *console,char *console_error) { + int y,x,nx,ny,i,j,k,m; + float f; + int do_next = 1; + char xcoord[10] = ""; + char ycoord[10] = ""; + char console2[15] = ""; + char console3[15] = ""; + char console4[15] = ""; + char console5[15] = ""; + //sprintf(console_error, "%s", console); + if (console && strcmp(console, "")!=0 && strncmp(console, " ", 1)!=0) + { + sscanf(console,"%14s %14s %14s %14s", console2, console3, console4, console5);//why didn't i know about this function?! + if (strcmp(console2, "quit")==0) + { + return -1; + } + else if (strcmp(console2, "file")==0 && console3[0]) + { + if (file_script) { + FILE *f=fopen(console3, "r"); + if (f) + { + char fileread[5000];//TODO: make this change with file size + char pch[5000]; + char tokens[10]; + int tokensize; + nx = 0; + ny = 0; + j = 0; + m = 0; + if (console4[0]) + console_parse_coords(console4, &nx , &ny, console_error); + memset(pch,0,sizeof(pch)); + memset(fileread,0,sizeof(fileread)); + fread(fileread,1,5000,f); + for (i=0; i