HouseMap

The HouseMap is what’s responsible for mapping a user’s POH (Player owned house).


type THouseLoader

type
  THouseLoader = record
    AMOUNT, SIZE: Int32;
    Map: TMufasaBitmap;

    Rooms: array of array of THouseRoom;

    //helpers:
    TeleportRooms: array of array of TTeleportRoom;

    RoomsBitmap, IconBitmap: TMufasaBitmap;
    RoomBitmaps, IconBitmaps: array [EHouseRoom] of TMufasaBitmap;

    Selected: record
      Matrix, Map: TPoint;
    end;
    HouseBounds: TBox;

    Decoration: EHouseDecoration;
    Colors: record
      Outdoors, Indoors, Dungeon: Int32;
    end;
    Config: TConfigJSON;
  end;

Helper record used by the type THouseHandler. All THouseLoader methods are helper methods for the type THouseHandler and you shouldn’t have to call them for anything.


THouseLoader.Free()

procedure THouseLoader.Free();

Internal method automatically called for your on script termination. You do not have to call it yourself.


THouseLoader.Init()

procedure THouseLoader.Init(size, amount: Int32);

Internal method automatically called for your when you use TScriptForm.CreateHouseBuilder(). You don’t usually have to call it yourself.


THouseLoader.GetRoomBitmapBox()

function THouseLoader.GetRoomBitmapBox(room: EHouseRoom): TBox;

Internal method used to get the box of the type EHouseRoom you pass in.

This box is a box of the following image:

poh rooms

Example:

{$I WaspLib/optional/handlers/poh.simba}
begin
  WriteLn POH.Map.GetRoomBitmapBox(EHouseRoom.SUPERIOR_GARDEN);
end;

THouseLoader.GetRoomBitmap()

function THouseLoader.GetRoomBitmap(room: EHouseRoom; color: Int32 = -1): TMufasaBitmap;

Internal method used to retrieve a bitmap of the type EHouseRoom you pass in.

Example:

{$I WaspLib/optional/handlers/poh.simba}
var
  bmp: TMufasaBitmap;
begin
  bmp := POH.Map.GetRoomBitmap(EHouseRoom.SUPERIOR_GARDEN);
  bmp.Debug();
  bmp.Free();
end;

THouseLoader.WriteRoom()

procedure THouseLoader.WriteRoom(room: EHouseRoom; index: TPoint);

Internal method used to write a room to THouseLoader.Rooms cache. This uses an TPoint as a room index in a 2D array of type EHouseRoom.

Unless you know what you are doing, you definitly should not use this for anything.

Example:

POH.Map.WriteRoom(EHouseRoom.SUPERIOR_GARDEN, [3,3]);

THouseLoader.ReadRoom()

function THouseLoader.ReadRoom(index: TPoint): EHouseRoom;

Internal method used to read a cached room in THouseLoader.Rooms. This uses an TPoint as a room index.

Unless you know what you are doing, you don’t need this, but there’s no harm in using it.

Example:

WriteLn POH.Map.ReadRoom([3,3]);

THouseLoader.PrintRooms()

procedure THouseLoader.PrintRooms();

Debugging helper method used to read a cached rooms in THouseLoader.Rooms. This will print the whole cache nicely formated in a way that is human friendly like you were looking at the house map.

Unless you know what you are doing, you don’t need this, but there’s no harm in using it.

Example:

POH.Setup();
POH.Map.PrintRooms();

THouseLoader.DrawMap()

procedure THouseLoader.DrawMap(bmp: TMufasaBitmap; room: EHouseRoom; p: TPoint);
procedure THouseLoader.DrawMap(room: EHouseRoom; color: Int32; p: TPoint); overload;

Methods used to draw the POH map and cache the rooms drawn in THouseLoader.Rooms.

Example:

POH.Map.DrawMap(EHouseRoom.SUPERIOR_GARDEN, POH.GrassColor, [3,3]);
POH.Map.Debug();
POH.Map.PrintRooms();