From 7f4d782c0d1b855b4329d88a27dcc242a18366de Mon Sep 17 00:00:00 2001 From: elasota Date: Mon, 8 Mar 2021 21:58:34 -0500 Subject: [PATCH] Fix room count mismatch --- GpApp/House.cpp | 4 ++-- GpApp/HouseLegal.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/GpApp/House.cpp b/GpApp/House.cpp index b265201..41ee32b 100644 --- a/GpApp/House.cpp +++ b/GpApp/House.cpp @@ -117,7 +117,7 @@ Boolean CreateNewHouse (void) theSpec.m_name[0] = static_cast(savePathLength); memcpy(theSpec.m_name + 1, savePath, savePathLength); - // Don't try to overwrite the current house - The GPF will probably be locked anyway + // Don't try to overwrite the current house if (houseCFile && theSpec.m_dir == houseCFile->GetDirectory() && !StrCmp::CompareCaseInsensitive(theSpec.m_name, houseCFile->GetFileName())) { CheckFileError(PLErrors::kFileIsBusy, theSpec.m_name); @@ -173,7 +173,7 @@ Boolean InitializeEmptyHouse (void) if (thisHouse != nil) thisHouse.Dispose(); - thisHouse = NewHandle(sizeof(houseType)).StaticCast(); + thisHouse = NewHandle(sizeof(houseType) - sizeof(roomType)).StaticCast(); if (thisHouse == nil) { diff --git a/GpApp/HouseLegal.cpp b/GpApp/HouseLegal.cpp index 743d4d8..94e328c 100644 --- a/GpApp/HouseLegal.cpp +++ b/GpApp/HouseLegal.cpp @@ -616,7 +616,7 @@ void ValidateNumberOfRooms (void) reportsRooms = (long)(*thisHouse)->nRooms; countedRooms = (GetHandleSize(thisHouse.StaticCast()) - - sizeof(houseType)) / sizeof(roomType); + sizeof(houseType)) / sizeof(roomType) + 1; if (reportsRooms != countedRooms) { (*thisHouse)->nRooms = (short)countedRooms;