X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;f=src%2Fmisc.c;h=97c9fa69a96d0a2445eb54965c2fa6b5fdab3b47;hb=10680a2398daf76e6a0cd261c2b247e6902f2ad0;hp=0518aef5ca90f37d4563985033864383091d9b6b;hpb=d504e5724574f9502ec203d495284738601bb6a0;p=plomrogue
diff --git a/src/misc.c b/src/misc.c
index 0518aef..97c9fa6 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -6,8 +6,8 @@
#include /* for size_t, calloc(), free() */
#include /* for strlen(), strcmp(), memcpy() */
#include /* for uint8_t, uint16_t */
-#include "readwrite.h" /* for try_fopen(), try_fclose(), get_linemax(),
- * try_fputc()
+#include "readwrite.h" /* for try_fopen(), try_fclose(), textfile_sizes(),
+ * try_fputc(), try_fgetc()
*/
#include "map_objects.h" /* for struct MapObj, get_player(), read_map_objects(),
* write_map_objects()
@@ -202,11 +202,11 @@ extern void turn_over(char action)
{
FILE * file_old = try_fopen(recordfile, "r", f_name);
FILE * file_new = try_fopen(recordfile_tmp, "w", f_name);
- char c = fgetc(file_old);
+ int c = try_fgetc(file_old, f_name);
while (EOF != c)
{
- try_fputc(c, file_new, f_name);
- c = fgetc(file_old);
+ try_fputc((uint8_t) c, file_new, f_name);
+ c = try_fgetc(file_old, f_name);
}
try_fclose(file_old, f_name);
try_fputc(action, file_new, f_name);
@@ -283,7 +283,7 @@ extern void load_game()
char * f_name = "load_game2()";
char * filename = "savefile";
FILE * file = try_fopen(filename, "r", f_name);
- uint16_t linemax = get_linemax(file, f_name);
+ uint16_t linemax = textfile_sizes(file, NULL);
char line[linemax + 1];
try_fgets(line, linemax + 1, file, f_name);
world.mapseed = atoi(line);