Changeset 500
- Timestamp:
- 08/11/07 17:33:30 (1 year ago)
- Files:
-
- trunk/src/Makefile.inc (modified) (1 diff)
- trunk/src/Makefile.src (modified) (2 diffs)
- trunk/src/birth.c (modified) (1 diff)
- trunk/src/dungeon.c (modified) (5 diffs)
- trunk/src/externs.h (modified) (4 diffs)
- trunk/src/files.c (modified) (3 diffs)
- trunk/src/load.c (modified) (3 diffs)
- trunk/src/main.c (modified) (3 diffs)
- trunk/src/save.c (modified) (1 diff)
- trunk/src/signals.c (modified) (1 diff)
- trunk/src/variable.c (modified) (2 diffs)
- trunk/src/wizard2.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/Makefile.inc
r421 r500 16 16 17 17 z-form.o: z-form.h z-util.h z-virt.h 18 z-rand.o: z-rand.h19 18 z-term.o: z-term.h z-virt.h 20 z-util.o: z-util.h21 19 z-virt.o: z-virt.h z-util.h 22 z- file.o: z-file.h20 z-smap.o: z-smap.h 23 21 24 22 # Various files depend on various headers trunk/src/Makefile.src
r480 r500 15 15 16 16 ZFILES = z-file.o z-form.o z-msg.o z-quark.o z-rand.o z-term.o z-type.o \ 17 z-util.o z-virt.o 17 z-util.o z-virt.o z-blockfile.o z-smap.o 18 18 MAINFILES = main.o maid-x11.o main-crb.o main-gcu.o main-gtk.o \ 19 19 main-ros.o main-sdl.o main-win.o main-x11.o main-xaw.o snd-sdl.o … … 37 37 init2.o \ 38 38 load.o \ 39 loadsave.o \ 39 40 melee1.o \ 40 41 melee2.o \ trunk/src/birth.c
r404 r500 1892 1892 1893 1893 /* 1894 * If this a pre-existing savefile, offer to do a quick creation, based 1895 * on the previous character. 1894 * If the birth height value is set, we can do a quick-start character. 1896 1895 */ 1897 if ( character_existed &&p_ptr->ht_birth)1896 if (p_ptr->ht_birth) 1898 1897 { 1899 1898 /* Prompt */ trunk/src/dungeon.c
r469 r500 1785 1785 * 1786 1786 * If the savefile does not exist, cannot be loaded, or contains a dead 1787 * (non-wizard-mode)character, then a new game will be started.1787 * character, then a new game will be started. 1788 1788 * 1789 1789 * Several platforms (Windows, Macintosh, Amiga) start brand new games … … 1799 1799 void play_game(bool new_game) 1800 1800 { 1801 bool character_loaded; 1802 bool reusing_savefile; 1801 /*** Do horrible, hacky things, to start the game off ***/ 1803 1802 1804 1803 /* Hack -- Increase "icky" depth */ 1805 1804 character_icky++; 1806 1805 1807 1808 1806 /* Verify main term */ 1809 1807 if (!term_screen) 1810 {1811 1808 quit("main window does not exist"); 1812 }1813 1809 1814 1810 /* Make sure main term is active */ … … 1817 1813 /* Verify minimum size */ 1818 1814 if ((Term->hgt < 24) || (Term->wid < 80)) 1819 {1820 1815 quit("main window is too small"); 1821 }1822 1816 1823 1817 /* Hack -- Turn off the cursor */ 1824 1818 (void)Term_set_cursor(FALSE); 1825 1819 1826 /* Attempt to load */ 1827 if (!load_player(&character_loaded, &reusing_savefile)) 1828 { 1829 /* Oops */ 1830 quit("broken savefile"); 1831 } 1832 1833 /* Nothing loaded */ 1834 if (!character_loaded) 1820 1821 /*** Try to load the savefile ***/ 1822 1823 p_ptr->is_dead = TRUE; 1824 1825 if (savefile[0] && file_exists(savefile)) 1826 { 1827 bool ok = new_save ? load(savefile) : old_load(); 1828 if (!ok) quit("broken savefile"); 1829 1830 if (p_ptr->is_dead && arg_wizard) 1831 { 1832 p_ptr->is_dead = FALSE; 1833 p_ptr->noscore |= NOSCORE_WIZARD; 1834 } 1835 } 1836 1837 /* No living character loaded */ 1838 if (p_ptr->is_dead) 1835 1839 { 1836 1840 /* Make new player */ … … 1846 1850 /* Hack -- Default base_name */ 1847 1851 if (!op_ptr->base_name[0]) 1848 {1849 1852 my_strcpy(op_ptr->base_name, "PLAYER", sizeof(op_ptr->base_name)); 1850 } 1853 1851 1854 1852 1855 /* Init RNG */ … … 1898 1901 1899 1902 /* Hack -- enter the world */ 1900 turn = 1; 1901 } 1903 old_turn = turn = 1; 1904 } 1905 1902 1906 1903 1907 /* Normal machine (process player name) */ 1904 1908 if (savefile[0]) 1905 {1906 1909 process_player_name(FALSE); 1907 }1908 1910 1909 1911 /* Weird machine (process player name, pick savefile name) */ 1910 1912 else 1911 {1912 1913 process_player_name(TRUE); 1913 } 1914 1914 1915 1915 1916 /* Check if we're overwriting a savefile */ 1916 while (!reusing_savefile && file_exists(savefile)) 1917 { 1918 /* Ask for confirmation */ 1917 while (new_game && file_exists(savefile)) 1918 { 1919 1919 bool overwrite = get_check("Continuing will overwrite an existing savefile. Overwrite? "); 1920 1920 1921 if (overwrite) 1922 { 1923 break; 1924 } 1925 else 1926 { 1927 get_name(TRUE); 1928 } 1929 } 1921 if (overwrite) break; 1922 get_name(TRUE); 1923 } 1924 1925 /* Stop the player being quite so dead */ 1926 p_ptr->is_dead = FALSE; 1927 1928 1930 1929 1931 1930 /* Flash a message */ 1932 1931 prt("Please wait...", 0, 0); 1932 1933 1933 1934 1934 /* Flush the message */ trunk/src/externs.h
r488 r500 134 134 extern bool closing_flag; 135 135 extern char savefile[1024]; 136 extern char panic_savefile[1024]; 136 137 extern s16b macro__num; 137 138 extern char **macro__pat; … … 337 338 338 339 /* load.c */ 339 extern bool load_player(bool *character_loaded, bool *reusing_savefile); 340 extern bool old_load(void); 341 342 /* loadsave.c */ 343 bool save(char *filename); 344 bool load(char *filename); 340 345 341 346 /* melee1.c */ … … 489 494 490 495 /* save.c */ 491 extern bool save_player(void);496 extern bool old_save(void); 492 497 493 498 /* spells1.c */ … … 742 747 bool make_fake_artifact(object_type *o_ptr, byte name1); 743 748 749 /* Testing Hacks XXX */ 750 extern bool new_save; 751 744 752 #endif /* !INCLUDED_EXTERNS_H */ trunk/src/files.c
r480 r500 2583 2583 2584 2584 /* Save the player */ 2585 if ( save_player())2585 if (new_save ? save(savefile) : old_save()) 2586 2586 { 2587 2587 prt("Saving game... done.", 0, 0); … … 3027 3027 3028 3028 /* Save dead player */ 3029 if ( !save_player())3029 if (new_save ? !save(savefile) : !old_save()) 3030 3030 { 3031 3031 msg_print("death save failed!"); … … 3285 3285 3286 3286 /* Panic save, or get worried */ 3287 if (!save_player()) quit("panic save failed!"); 3287 if (new_save ? !save(panic_savefile) : !old_save()) quit("panic save failed!"); 3288 3288 3289 3289 3290 /* Successful panic save */ trunk/src/load.c
r469 r500 2244 2244 * there is no such file, so we must check for "empty" savefile names. 2245 2245 */ 2246 bool load_player(bool *character_loaded, bool *reusing_savefile)2246 bool old_load(void) 2247 2247 { 2248 2248 ang_file *fh; … … 2251 2251 errr err = 0; 2252 2252 2253 2254 /* Paranoia */2255 turn = 0;2256 p_ptr->is_dead = FALSE;2257 2258 *character_loaded = FALSE;2259 *reusing_savefile = FALSE;2260 2261 /* Allow empty savefile name */2262 if (!savefile[0]) return (TRUE);2263 2264 /* No file */2265 if (!file_exists(savefile))2266 {2267 /* Give a message */2268 msg_print("Savefile does not exist.");2269 message_flush();2270 2271 /* Allow this */2272 return (TRUE);2273 }2274 2275 /* Open savefile */2276 safe_setuid_grab();2277 2253 fh = file_open(savefile, MODE_READ, -1); 2278 safe_setuid_drop(); 2254 2279 2255 2280 2256 /* No file */ … … 2340 2316 if (!err) 2341 2317 { 2342 *reusing_savefile = TRUE;2343 2344 /* Give a conversion warning */2345 if ((version_major != sf_major) ||2346 (version_minor != sf_minor) ||2347 (version_patch != sf_patch))2348 {2349 /* Message */2350 msg_format("Converted a %d.%d.%d savefile.",2351 sf_major, sf_minor, sf_patch);2352 message_flush();2353 }2354 2355 /* Player is dead */2356 if (p_ptr->is_dead)2357 {2358 /* Cheat death (unless the character retired) */2359 if (arg_wizard)2360 {2361 /* A character was loaded */2362 *character_loaded = TRUE;2363 2364 /* Mark the savefile */2365 p_ptr->noscore |= NOSCORE_WIZARD;2366 2367 /* Done */2368 return (TRUE);2369 }2370 2371 /* Forget death */2372 p_ptr->is_dead = FALSE;2373 2374 /* A character existed in this savefile. */2375 character_existed = TRUE;2376 2377 /* Count lives */2378 sf_lives++;2379 2380 /* Forget turns */2381 turn = old_turn = 0;2382 2383 /* Done */2384 return (TRUE);2385 }2386 2387 /* A character was loaded */2388 *character_loaded = TRUE;2389 2390 2318 /* Still alive */ 2391 2319 if (p_ptr->chp >= 0) trunk/src/main.c
r467 r500 54 54 #ifdef USE_SOUND 55 55 56 bool new_save; 57 56 58 /* 57 59 * List of sound modules in the order they should be tried. … … 362 364 } 363 365 366 case 'L': 367 { 368 new_save = TRUE; 369 break; 370 } 371 364 372 case 'F': 365 373 case 'f': … … 439 447 puts("Usage: angband [options] [-- subopts]"); 440 448 puts(" -n Start a new character"); 449 puts(" -L Load a new-format save file"); 441 450 puts(" -w Resurrect dead character (marks savefile)"); 442 451 puts(" -f Request fiddle (verbose) mode"); trunk/src/save.c
r489 r500 1040 1040 * Attempt to save the player in a savefile 1041 1041 */ 1042 bool save_player(void)1042 bool old_save(void) 1043 1043 { 1044 1044 char new_savefile[1024]; trunk/src/signals.c
r199 r500 222 222 223 223 /* Attempt to save */ 224 if ( save_player())224 if (new_save ? save(panic_savefile) : old_save()) 225 225 { 226 226 Term_putstr(45, 23, -1, TERM_RED, "Panic save succeeded!"); trunk/src/variable.c
r469 r500 60 60 61 61 bool character_generated; /* The character exists */ 62 bool character_existed; /* A character existed on the same savefile */63 62 bool character_dungeon; /* The character has a dungeon */ 64 63 bool character_saved; /* The character was just saved to a savefile */ … … 133 132 */ 134 133 char savefile[1024]; 134 char panic_savefile[1024]; 135 135 136 136 trunk/src/wizard2.c
r449 r500 118 118 } 119 119 } 120 121 120 122 121 /* … … 1649 1648 } 1650 1649 1650 case 'S': 1651 { 1652 save("savefile.new"); 1653 break; 1654 } 1655 1651 1656 /* Teleport */ 1652 1657 case 't':
