Visual Studio compatibility

Also fix two compiler warnings
This commit is contained in:
jacksonmj 2011-02-13 00:05:09 +00:00
parent 457ceeff0a
commit d57c5ef5e0
4 changed files with 16 additions and 11 deletions

View File

@ -83,6 +83,10 @@ typedef unsigned int pixel;
#define GLASS_IOR 1.9
#define GLASS_DISP 0.07
#ifdef WIN32
#define strcasecmp stricmp
#endif
typedef unsigned char uint8;
extern int amd;

View File

@ -3841,7 +3841,7 @@ struct command_history {
typedef struct command_history command_history;
command_history *last_command = NULL;
char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show previous commands
int mx,my,b,bq,cc,ci = -1;
int mx,my,b,cc,ci = -1;
command_history *currentcommand;
ui_edit ed;
ed.x = 15;
@ -3857,7 +3857,6 @@ char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show
//fillrect(vid_buf, -1, -1, XRES, 220, 0, 0, 0, 190);
while (!sdl_poll())
{
bq = b;
b = SDL_GetMouseState(&mx, &my);
mx /= sdl_scale;
my /= sdl_scale;
@ -3994,9 +3993,9 @@ int console_parse_coords(char *txt, int *x, int *y, char *err)
}
int console_parse_partref(char *txt, int *which, char *err)
{
int i = -1, nx, ny;
strcpy(err,"");
// TODO: use regex?
int i = -1, nx, ny;
if (strchr(txt,',') && console_parse_coords(txt, &nx, &ny, err))
{
i = pmap[ny][nx];

View File

@ -1198,9 +1198,9 @@ int main(int argc, char *argv[])
void *load_data=NULL;
pixel *load_img=NULL;//, *fbi_img=NULL;
int save_mode=0, save_x=0, save_y=0, save_w=0, save_h=0, copy_mode=0;
SDL_AudioSpec fmt;
GSPEED = 1;
SDL_AudioSpec fmt;
/* Set 16-bit stereo audio at 22Khz */
fmt.freq = 22050;
fmt.format = AUDIO_S16;
@ -2361,16 +2361,18 @@ int main(int argc, char *argv[])
{
char buff[256];
int sldr;
char *buff2;
memset(buff, 0, sizeof(buff));
for(sldr=3; signs[signi].text[sldr] != '|'; sldr++)
buff[sldr-3] = signs[signi].text[sldr];
char buff2[sldr-2]; //TODO: Fix this for Visual Studio
memset(buff2, 0, sizeof(buff2));
buff2 = malloc(sldr-2);
memset(buff2, 0, sldr-2);
memcpy(&buff2, &buff, sldr-3);
open_ui(vid_buf, buff2, 0);
free(buff2);
}
}
}
@ -2753,18 +2755,18 @@ int process_command(pixel *vid_buf,char *console,char *console_error) {
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)
console_parse_coords(console4, &nx , &ny, console_error);
char fileread[5000];//TODO: make this change with file size
char pch[5000];
memset(pch,0,sizeof(pch));
memset(fileread,0,sizeof(fileread));
char tokens[10];
int tokensize;
fread(fileread,1,5000,f);
for(i=0; i<strlen(fileread); i++)
{

View File

@ -454,7 +454,7 @@ inline void part_change_type(int i, int x, int y, int t)
#endif
{
if (x<0 || y<0 || x>=XRES || y>=YRES || i>=NPART)
return -1;
return;
parts[i].type = t;
if (t==PT_PHOT)// || t==PT_NEUT)
{