From 95260f8d8af0ed575af247a04d87c35470c89020 Mon Sep 17 00:00:00 2001 From: elasota Date: Tue, 11 May 2021 19:47:05 -0400 Subject: [PATCH] Zero out structures when creating houses and rooms --- GpApp/House.cpp | 1 + GpApp/Room.cpp | 2 ++ GpApp/StructuresInit2.cpp | 2 ++ 3 files changed, 5 insertions(+) diff --git a/GpApp/House.cpp b/GpApp/House.cpp index 6251468..e332bb6 100644 --- a/GpApp/House.cpp +++ b/GpApp/House.cpp @@ -224,6 +224,7 @@ Boolean InitializeEmptyHouse (void) } thisHousePtr = *thisHouse; + memset(thisHousePtr, 0, houseSizeNoRooms); thisHousePtr->version = kHouseVersion; thisHousePtr->firstRoom = -1; diff --git a/GpApp/Room.cpp b/GpApp/Room.cpp index 0e806d1..a5259f6 100644 --- a/GpApp/Room.cpp +++ b/GpApp/Room.cpp @@ -171,6 +171,8 @@ Boolean CreateNewRoom (short h, short v) char wasState; CopyThisRoomToRoom(); // save off current room + + memset(thisRoom, 0, sizeof(roomType)); PasStringCopy(PSTR("Untitled Room"), thisRoom->name); thisRoom->leftStart = 32; // fill out fields of new room diff --git a/GpApp/StructuresInit2.cpp b/GpApp/StructuresInit2.cpp index 21051e9..40312fe 100644 --- a/GpApp/StructuresInit2.cpp +++ b/GpApp/StructuresInit2.cpp @@ -182,6 +182,8 @@ void CreatePointers (void) thisRoom = (roomPtr)NewPtr(sizeof(roomType)); if (thisRoom == nil) RedAlert(kErrNoMemory); + + memset(thisRoom, 0, sizeof(roomType)); hotSpots = nil; hotSpots = (hotPtr)NewPtr(sizeof(hotObject) * kMaxHotSpots);