Files
TeslaRel410/CODE/RP/MUNGA/WRHOUS.CPP
T
CydandClaude Fable 5 fdd9ac9d97 Initial import: Tesla Release 4.10 (Tesla:BattleTech & Tesla:Red Planet)
Archival snapshot of the Virtual World Entertainment Tesla cockpit
software, 1994-1996: MUNGA engine and L4 pod layer source (Borland
C++ 5.0), BT/RP game code, and game content (models, audio, maps,
gauges, Division renderer data). Includes third-party libraries:
Division dVS/DPL graphics, HMI SOS audio, WATTCP networking.

Files are preserved byte-for-byte (.gitattributes disables all
line-ending conversion). README.md documents the layout, target
hardware, and toolchain.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 13:21:58 -05:00

186 lines
4.4 KiB
C++

//===========================================================================//
// File: wrhous.cc //
// Project: MUNGA Brick: Gauge Renderer Manager //
// Contents: //
// This object manages creation and deletion of dynamically-created objects //
// of which only on instantiation should exist. It is currently used //
// only by the gauge renderer. //
//---------------------------------------------------------------------------//
// Date Who Modification //
// -------- --- ---------------------------------------------------------- //
// 08/01/95 CPB Initial coding. //
//---------------------------------------------------------------------------//
// Copyright (C) 1995, Virtual World Entertainment, Inc. All rights reserved //
// PROPRIETARY and CONFIDENTIAL //
//===========================================================================//
#include <munga.hpp>
#pragma hdrstop
#if !defined(WRHOUS_HPP)
# include <wrhous.hpp>
#endif
// #define LOCAL_TEST
#if defined(LOCAL_TEST)
# define Test_Tell(n) DEBUG_STREAM << n
#else
# define Test_Tell(n)
#endif
//#######################################################################
// WarehouseObject
//#######################################################################
WarehouseObject::WarehouseObject(
const char *new_name,
Logical keep_forever
):
Plug(WarehouseObject::WarehouseObjectClassID)
{
Test_Tell("WarehouseObject::WarehouseObject(" << new_name << "\n");
Str_Copy(name, new_name, sizeof(name));
resourceID = ResourceDescription::NullResourceType;
referenceCount = 1; // at least one reference exists, otherwise no obj
keepForever = keep_forever;
Check_Fpu();
}
WarehouseObject::WarehouseObject(
ResourceDescription::ResourceID new_resource_id,
Logical keep_forever
):
Plug(WarehouseObject::WarehouseObjectClassID)
{
Test_Tell("WarehouseObject::WarehouseObject(" << new_resource_id << "\n");
name[0] = '\0';
resourceID = new_resource_id;
referenceCount = 1; // at least one reference exists, otherwise no obj
keepForever = keep_forever;
Check_Fpu();
}
WarehouseObject::~WarehouseObject()
{
Check(this);
Check_Fpu();
}
Logical
WarehouseObject::TestInstance() const
{
return True;
}
//#######################################################################
// WarehouseBin
//#######################################################################
WarehouseBin::WarehouseBin() :
Node(WarehouseBin::WarehouseBinClassID),
instanceList(this)
{
Test_Tell("WarehouseBin::WarehouseBin()\n");
Check_Pointer(this);
Check_Fpu();
}
WarehouseBin::~WarehouseBin()
{
Check(this);
}
Logical
WarehouseBin::TestInstance() const
{
return True;
}
WarehouseObject *
WarehouseBin::Find(const char *old_name)
{
Check(this);
ChainIteratorOf<WarehouseObject*>
i(instanceList);
WarehouseObject
*object_instance;
while ((object_instance=i.ReadAndNext()) != NULL)
{
Check(object_instance);
if (stricmp(object_instance->name, old_name) == 0)
{
Check_Fpu();
return object_instance;
}
}
Check_Fpu();
return NULL;
}
WarehouseObject *
WarehouseBin::Find(ResourceDescription::ResourceID old_resource_id)
{
Check(this);
ChainIteratorOf<WarehouseObject*>
i(instanceList);
WarehouseObject
*object_instance;
while ((object_instance=i.ReadAndNext()) != NULL)
{
Check(object_instance);
if (object_instance->resourceID == old_resource_id)
{
Check_Fpu();
return object_instance;
}
}
Check_Fpu();
return NULL;
}
//#######################################################################
// Warehouse
//#######################################################################
Warehouse::Warehouse()
{
Test_Tell("Warehouse::Warehouse\n");
Check_Pointer(this);
}
Warehouse::~Warehouse()
{
Test_Tell("Warehouse::~Warehouse\n");
Check(this);
Purge();
Check_Fpu();
}
void
Warehouse::Purge()
{
Check(this);
bitMapBin.Purge();
pixelMap8Bin.Purge();
palette8Bin.Purge();
Check_Fpu();
}
Logical
Warehouse::TestInstance() const
{
Check_Pointer(this);
return True;
}