openbsd-ports/games/ivan/patches/patch-FeLib_Include_save_h

41 lines
1.5 KiB
Plaintext

$OpenBSD: patch-FeLib_Include_save_h,v 1.2 2013/04/29 11:35:29 sthen Exp $
--- FeLib/Include/save.h.orig Tue Oct 26 20:35:45 2004
+++ FeLib/Include/save.h Mon Apr 29 12:23:05 2013
@@ -36,7 +36,7 @@ class outputfile
void Put(char What) { fputc(What, Buffer); }
void Write(const char* Offset, long Size)
{ fwrite(Offset, 1, Size, Buffer); }
- truth IsOpen() { return truth(Buffer); }
+ truth IsOpen() { return truth(Buffer != NULL); }
void Close() { fclose(Buffer); }
void Flush() { fflush(Buffer); }
void ReOpen();
@@ -58,7 +58,7 @@ class inputfile
rect ReadRect();
int Get() { return fgetc(Buffer); }
void Read(char* Offset, long Size) { fread(Offset, 1, Size, Buffer); }
- truth IsOpen() { return truth(Buffer); }
+ truth IsOpen() { return truth(Buffer != NULL); }
truth Eof() { return feof(Buffer); }
void ClearFlags() { clearerr(Buffer); }
void SeekPosBegin(long Offset) { fseek(Buffer, Offset, SEEK_SET); }
@@ -203,6 +203,18 @@ inline outputfile& operator<<(outputfile& SaveFile, lo
}
inline inputfile& operator>>(inputfile& SaveFile, long& Value)
+{
+ SaveFile.Read(reinterpret_cast<char*>(&Value), sizeof(Value));
+ return SaveFile;
+}
+
+inline outputfile& operator<<(outputfile& SaveFile, long long Value)
+{
+ SaveFile.Write(reinterpret_cast<char*>(&Value), sizeof(Value));
+ return SaveFile;
+}
+
+inline inputfile& operator>>(inputfile& SaveFile, long long& Value)
{
SaveFile.Read(reinterpret_cast<char*>(&Value), sizeof(Value));
return SaveFile;