MCPcopy Create free account
hub / github.com/crawl/crawl / _write_dump

Function _write_dump

crawl-ref/source/chardump.cc:1902–1938  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1900}
1901
1902static bool _write_dump(const string &fname, const dump_params &par, bool quiet)
1903{
1904 bool succeeded = false;
1905
1906 string file_name = morgue_directory();
1907
1908 file_name += strip_filename_unsafe_chars(fname);
1909
1910 StashTrack.update_corpses();
1911
1912 string stash_file_name;
1913 stash_file_name = file_name;
1914 stash_file_name += ".lst";
1915 StashTrack.dump(stash_file_name.c_str(), par.full_id);
1916
1917 file_name += ".txt";
1918 FILE *handle = fopen_replace(file_name.c_str());
1919
1920 dprf("File name: %s", file_name.c_str());
1921
1922 if (handle != nullptr)
1923 {
1924 fputs(OUTS(par.text), handle);
1925 fclose(handle);
1926 succeeded = true;
1927 if (!quiet)
1928#ifdef DGAMELAUNCH
1929 mpr("Char dumped successfully.");
1930#else
1931 mprf("Char dumped to '%s'.", file_name.c_str());
1932#endif
1933 }
1934 else
1935 mprf(MSGCH_ERROR, "Error opening file '%s'", file_name.c_str());
1936
1937 return succeeded;
1938}
1939
1940static int _add_text(formatted_scroller &scr, const string &tag,
1941 const string &text)

Callers 1

dump_charFunction · 0.85

Calls 8

morgue_directoryFunction · 0.85
fopen_replaceFunction · 0.85
dprfFunction · 0.85
mprFunction · 0.85
mprfFunction · 0.85
update_corpsesMethod · 0.80
dumpMethod · 0.45

Tested by

no test coverage detected