use atoi instead of sscanf for plx reading, so the setting for showing the reticle is read properly on big endian computers

This commit is contained in:
kreatordxx 2008-05-10 10:46:34 +00:00
parent 519e3dacb2
commit 40fe9adf4c
2 changed files with 13 additions and 13 deletions

View file

@ -1,5 +1,9 @@
D1X-Rebirth Changelog D1X-Rebirth Changelog
20080510
--------
main/playsave.c: use atoi instead of sscanf for plx reading, so the setting for showing the reticle is read properly on big endian computers
20080508 20080508
-------- --------
main/newmenu.c, main/render.c, arch/sdl/key.c, arch/include/key.h: Some code improvements and small fixes main/newmenu.c, main/render.c, arch/sdl/key.c, arch/include/key.h: Some code improvements and small fixes

View file

@ -213,7 +213,7 @@ int read_player_d1x(char *filename)
while(!strstr(word,"END") && !PHYSFS_eof(f)) while(!strstr(word,"END") && !PHYSFS_eof(f))
{ {
if(!strcmp(word,"DEADZONE")) if(!strcmp(word,"DEADZONE"))
sscanf(line,"%i",&PlayerCfg.JoystickDeadzone); PlayerCfg.JoystickDeadzone = atoi(line);
d_free(word); d_free(word);
cfgets(line,50,f); cfgets(line,50,f);
word=splitword(line,'='); word=splitword(line,'=');
@ -230,11 +230,7 @@ int read_player_d1x(char *filename)
while(!strstr(word,"END") && !PHYSFS_eof(f)) while(!strstr(word,"END") && !PHYSFS_eof(f))
{ {
if(!strcmp(word,"SENSITIVITY")) if(!strcmp(word,"SENSITIVITY"))
{ PlayerCfg.MouseSensitivity = atoi(line);
int tmp;
sscanf(line,"%i",&tmp);
PlayerCfg.MouseSensitivity = (ubyte) tmp;
}
d_free(word); d_free(word);
cfgets(line,50,f); cfgets(line,50,f);
word=splitword(line,'='); word=splitword(line,'=');
@ -251,9 +247,9 @@ int read_player_d1x(char *filename)
while(!strstr(word,"END") && !PHYSFS_eof(f)) while(!strstr(word,"END") && !PHYSFS_eof(f))
{ {
if(!strcmp(word,"MODE")) if(!strcmp(word,"MODE"))
sscanf(line,"%i",&PlayerCfg.CockpitMode); PlayerCfg.CockpitMode = atoi(line);
else if(!strcmp(word,"HUD")) else if(!strcmp(word,"HUD"))
sscanf(line,"%i",&PlayerCfg.HudMode); PlayerCfg.HudMode = atoi(line);
d_free(word); d_free(word);
cfgets(line,50,f); cfgets(line,50,f);
word=splitword(line,'='); word=splitword(line,'=');
@ -270,9 +266,9 @@ int read_player_d1x(char *filename)
while(!strstr(word,"END") && !PHYSFS_eof(f)) while(!strstr(word,"END") && !PHYSFS_eof(f))
{ {
if(!strcmp(word,"RETICLE")) if(!strcmp(word,"RETICLE"))
sscanf(line,"%i",(int*)&PlayerCfg.ReticleOn); PlayerCfg.ReticleOn = atoi(line);
else if(!strcmp(word,"PERSISTENTDEBRIS")) else if(!strcmp(word,"PERSISTENTDEBRIS"))
sscanf(line,"%i",&PlayerCfg.PersistentDebris); PlayerCfg.PersistentDebris = atoi(line);
d_free(word); d_free(word);
cfgets(line,50,f); cfgets(line,50,f);
word=splitword(line,'='); word=splitword(line,'=');
@ -289,11 +285,11 @@ int read_player_d1x(char *filename)
while(!strstr(word,"END") && !PHYSFS_eof(f)) while(!strstr(word,"END") && !PHYSFS_eof(f))
{ {
if(!strcmp(word,"OGLALPHAEFFECTS")) if(!strcmp(word,"OGLALPHAEFFECTS"))
sscanf(line,"%i",&PlayerCfg.OglAlphaEffects); PlayerCfg.OglAlphaEffects = atoi(line);
else if(!strcmp(word,"OGLRETICLE")) else if(!strcmp(word,"OGLRETICLE"))
sscanf(line,"%i",&PlayerCfg.OglReticle); PlayerCfg.OglReticle = atoi(line);
else if(!strcmp(word,"OGLPRSHOT")) else if(!strcmp(word,"OGLPRSHOT"))
sscanf(line,"%i",&PlayerCfg.OglPRShot); PlayerCfg.OglPRShot = atoi(line);
d_free(word); d_free(word);
cfgets(line,50,f); cfgets(line,50,f);
word=splitword(line,'='); word=splitword(line,'=');