Mercurial > otakunoraifu
comparison scn2k/scn2k_impl.cc @ 43:01aa5ddf7dc8
A lot of very minor improvements (deleted some unused variables, and other things like that...)
author | thib |
---|---|
date | Tue, 24 Mar 2009 19:45:48 +0000 |
parents | 94fe9153efa5 |
children | 35ce1a30f3f9 |
comparison
equal
deleted
inserted
replaced
42:039d813d4cef | 43:01aa5ddf7dc8 |
---|---|
309 if (cmd.cmd1 == 0 && cmd.cmd2 == 1 && cmd.cmd3 == 1) { | 309 if (cmd.cmd1 == 0 && cmd.cmd2 == 1 && cmd.cmd3 == 1) { |
310 fprintf(stderr,"*** unsupported: cond 1\n"); | 310 fprintf(stderr,"*** unsupported: cond 1\n"); |
311 } | 311 } |
312 script = script_start + cmd.args[0].value; | 312 script = script_start + cmd.args[0].value; |
313 if (script < script_start || script >= script_end) { | 313 if (script < script_start || script >= script_end) { |
314 fprintf(stderr,"scn %d pt %d: Cannot jump to %d; fall back to the top\n",scn_number, cmd.args[0].value); | 314 fprintf(stderr,"scn %d pt %d: Cannot jump to %d; fall back to the top\n", scn_number, scn_point, cmd.args[0].value); |
315 script = script_start; | 315 script = script_start; |
316 } | 316 } |
317 cmd.clear(); | 317 cmd.clear(); |
318 continue; | 318 continue; |
319 } | 319 } |
941 savedata[sz] = 0; | 941 savedata[sz] = 0; |
942 fclose(f); | 942 fclose(f); |
943 | 943 |
944 sprintf(buf, "KEY=%s\n", config.GetParaStr("#REGNAME")); | 944 sprintf(buf, "KEY=%s\n", config.GetParaStr("#REGNAME")); |
945 if (strncmp(savedata, buf, strlen(buf)) != 0) { | 945 if (strncmp(savedata, buf, strlen(buf)) != 0) { |
946 fprintf(stderr,"Invalid header in save file %s: it must be started with \"%s\"\n",buf); | 946 fprintf(stderr,"Invalid header in save file %s: it must be started with \"%s\"\n", path.c_str(), buf); |
947 } else { | 947 } else { |
948 char* config_str = strstr(savedata, "\nCONFIG="); | 948 char* config_str = strstr(savedata, "\nCONFIG="); |
949 if (config_str) { | 949 if (config_str) { |
950 config_str += strlen("\nCONFIG="); | 950 config_str += strlen("\nCONFIG="); |
951 char* strend = strchr(config_str, '\n'); | 951 char* strend = strchr(config_str, '\n'); |
1183 savedata[sz] = 0; | 1183 savedata[sz] = 0; |
1184 fclose(f); | 1184 fclose(f); |
1185 | 1185 |
1186 sprintf(buf, "KEY=%s\n", config.GetParaStr("#REGNAME")); | 1186 sprintf(buf, "KEY=%s\n", config.GetParaStr("#REGNAME")); |
1187 if (strncmp(savedata, buf, strlen(buf)) != 0) { | 1187 if (strncmp(savedata, buf, strlen(buf)) != 0) { |
1188 fprintf(stderr,"Invalid header in save file %s: it must be started with \"%s\"\n",buf); | 1188 fprintf(stderr,"Invalid header in save file %s: it must be started with \"%s\"\n", path.c_str(), buf); |
1189 delete[] savedata; | 1189 delete[] savedata; |
1190 return; | 1190 return; |
1191 } | 1191 } |
1192 LoadImpl(savedata); | 1192 LoadImpl(savedata); |
1193 flag.Load(savedata); | 1193 flag.Load(savedata); |
1248 save += "\n"; | 1248 save += "\n"; |
1249 } | 1249 } |
1250 } | 1250 } |
1251 | 1251 |
1252 void Scn2k::LoadImpl(const char* save) { | 1252 void Scn2k::LoadImpl(const char* save) { |
1253 char buf[1024]; | |
1254 save_scn = 0; | 1253 save_scn = 0; |
1255 save_point = 0; | 1254 save_point = 0; |
1256 window_title = ""; | 1255 window_title = ""; |
1257 stack.clear(); | 1256 stack.clear(); |
1258 cmd_stack.clear(); | 1257 cmd_stack.clear(); |