summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2011-09-24 16:13:28 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-09-24 16:13:28 (GMT)
commit4514c5e61969f4187706545cb769981d6adae15e (patch)
tree582ac5b84bb4481611346c5c2dc0f9611d63745e /src
parent5a824850b3c719b4e376b47e5f93c9ff7ccb251d (diff)
downloadpowder-4514c5e61969f4187706545cb769981d6adae15e.zip
powder-4514c5e61969f4187706545cb769981d6adae15e.tar.gz
Make changes to prefs file regarding build_num and updated
Diffstat (limited to 'src')
-rw-r--r--src/main.c2
-rw-r--r--src/misc.c23
2 files changed, 18 insertions, 7 deletions
diff --git a/src/main.c b/src/main.c
index a67836b..4abf2ef 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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.");
diff --git a/src/misc.c b/src/misc.c
index 6739624..25594ea 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -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 (fread(sig, 1, 3, f) != 3)
- 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];