Make changes to prefs file regarding build_num and updated

This commit is contained in:
Simon Robertshaw 2011-09-24 17:13:28 +01:00
parent 5a824850b3
commit 4514c5e619
3 changed files with 19 additions and 8 deletions

View File

@ -224,7 +224,7 @@ extern int legacy_enable; //Used to disable new features such as heat, will be s
extern int framerender;
extern pixel *vid_buf;
extern unsigned char last_major, last_minor, update_flag;
extern unsigned char last_major, last_minor, update_flag, last_build;
extern char http_proxy_string[256];

View File

@ -2657,7 +2657,7 @@ int main(int argc, char *argv[])
if (update_flag)
{
info_box(vid_buf, "Finalizing update...");
if (last_major>SAVE_VERSION || (last_major==SAVE_VERSION && last_minor>=MINOR_VERSION) || last_build>BUILD_NUM)
if (last_build>BUILD_NUM)
{
update_cleanup();
error_ui(vid_buf, 0, "Update failed - try downloading a new version.");

View File

@ -120,7 +120,7 @@ void clean_text(char *text, int vwidth)
void save_presets(int do_update)
{
FILE *f=fopen("powder.def", "wb");
unsigned char sig[4] = {0x50, 0x44, 0x65, 0x67};
unsigned char sig[4] = {0x50, 0x44, 0x65, 0x68};
unsigned char tmp = sdl_scale;
if (!f)
return;
@ -137,10 +137,12 @@ void save_presets(int do_update)
tmp = svf_mod;
fwrite(&tmp, 1, 1, f);
save_string(f, http_proxy_string);
tmp = SAVE_VERSION;
tmp = MAJOR_VERSION;
fwrite(&tmp, 1, 1, f);
tmp = MINOR_VERSION;
fwrite(&tmp, 1, 1, f);
tmp = BUILD_NUM;
fwrite(&tmp, 1, 1, f);
tmp = do_update;
fwrite(&tmp, 1, 1, f);
fclose(f);
@ -178,8 +180,9 @@ void load_presets(void)
remove("powder.def");
goto fail;
}
last_major = sig[0];
last_minor = sig[1];
//last_major = sig[0];
//last_minor = sig[1];
last_build = 0;
update_flag = sig[2];
}
fclose(f);
@ -214,8 +217,16 @@ void load_presets(void)
svf_mod = tmp;
if (load_string(f, http_proxy_string, 255))
goto fail;
if (sig[3]!=0x68) { //Pre v64 format
if (fread(sig, 1, 3, f) != 3)
goto fail;
last_build = 0;
} else {
if (fread(sig, 1, 4, f) != 4)
goto fail;
last_build = sig[3];
}
last_major = sig[0];
last_minor = sig[1];
update_flag = sig[2];