- BORLAND/: Borland C++ 4.52 (chosen over 4.5 by byte-match: CODE/RP/CW32.LIB
is identical to 4.52's install lib). BCC32/TLINK32/TLIB/MAKE run natively on
Win11; CODE/BT/OPT.MAK is the shipped BTL4OPT.EXE's exact flag recipe
(extender = Borland PowerPack DPMI32, not Phar Lap TNT).
- restoration/source410/: the literal 1995-form reconstruction of the missing
BT game source (never mixed into CODE/). Round 1-3 state:
* 6 of 10 surviving original TUs COMPILE CLEAN under the period toolchain
(BTMSSN, BTCNSL, BTSCNRL, BTTEAM, BTL4MODE, BTL4ARND) - first builds
since 1996.
* BT_L4/BTL4APP.CPP pilot reconstruction: 12/12 functions, Fail() lands on
its binary-recorded line 400 exactly.
* BT/BTCNSL.HPP: console wire IDs recovered from the binary's ctors
(Killed=9, Damaged=10, ScoreUpdate=13, DeathWithoutHonor=15 [T1];
TeamScore=12 flagged [T4]).
* MUNGA/: 8 engine-header backfills back-dated from the BT412 WinTesla tree
(VDATA numbering decomp-verified; AUDREND's OpenAL-era virtual removed -
the period compiler is the drift detector).
* Tooling: backdate.py (WinTesla->1995 header transform), compile410.sh
(per-TU verification sweep under authentic OPT.MAK flags).
* README: corrected roadmap - MECH.HPP is the capstone grown with the mech
TU reconstructions; BTREG.CPP green = the header-family milestone.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
144 lines
2.7 KiB
C++
144 lines
2.7 KiB
C++
//----------------------------------------------------------------------------
|
|
// ObjectWindows
|
|
// (C) Copyright 1993, 1994 by Borland International, All Rights Reserved
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
#include <owl/owlpch.h>
|
|
#include <owl/bitset.h>
|
|
#include <classlib/objstrm.h>
|
|
|
|
uint8 near TBitSet::Masks[8] = {
|
|
0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80
|
|
};
|
|
|
|
TBitSet::TBitSet()
|
|
{
|
|
for (int i = 0; i < 32; i++)
|
|
Bits[i] = 0;
|
|
}
|
|
|
|
TBitSet::TBitSet(const TBitSet& bs)
|
|
{
|
|
for (int i = 0; i < 32; i++)
|
|
Bits[i] = bs.Bits[i];
|
|
}
|
|
|
|
int
|
|
TBitSet::Has(uint8 item)
|
|
{
|
|
return (Bits[Loc(item)] & Mask(item)) != 0;
|
|
}
|
|
|
|
TBitSet
|
|
TBitSet::operator ~() const
|
|
{
|
|
TBitSet temp;
|
|
for (int i = 0; i < 32; i++)
|
|
temp.Bits[i] = uint8(~Bits[i]);
|
|
return temp;
|
|
}
|
|
|
|
void
|
|
TBitSet::DisableItem(uint8 item)
|
|
{
|
|
Bits[Loc(item)] &= uint8(~Mask(item));
|
|
}
|
|
|
|
void
|
|
TBitSet::EnableItem(const TBitSet& bs)
|
|
{
|
|
for (int i = 0; i < 32; i++)
|
|
Bits[i] |= bs.Bits[i];
|
|
}
|
|
|
|
void
|
|
TBitSet::DisableItem(const TBitSet& bs)
|
|
{
|
|
for (int i = 0; i < 32; i++)
|
|
Bits[i] &= uint8(~(bs.Bits[i]));
|
|
}
|
|
|
|
void
|
|
TBitSet::EnableItem(uint8 item)
|
|
{
|
|
Bits[Loc(item)] |= Mask(item);
|
|
}
|
|
|
|
TBitSet&
|
|
TBitSet::operator &=(const TBitSet& bs)
|
|
{
|
|
for (int i = 0; i < 32; i++)
|
|
Bits[i] &= bs.Bits[i];
|
|
return *this;
|
|
}
|
|
|
|
TBitSet
|
|
operator &(const TBitSet& bs1, const TBitSet& bs2)
|
|
{
|
|
TBitSet temp(bs1);
|
|
temp &= bs2;
|
|
return temp;
|
|
}
|
|
|
|
TBitSet
|
|
operator |(const TBitSet& bs1, const TBitSet& bs2)
|
|
{
|
|
TBitSet temp(bs1);
|
|
temp |= bs2;
|
|
return temp;
|
|
}
|
|
|
|
int
|
|
TBitSet::IsEmpty()
|
|
{
|
|
for (int i = 0; i < 32; i++)
|
|
if (Bits[i] != 0)
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
int
|
|
operator ==(const TBitSet& bs1, const TBitSet& bs2)
|
|
{
|
|
for (int i = 0; i < 32; i++)
|
|
if (bs1.Bits[i] != bs2.Bits[i])
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
opstream& operator <<(opstream& out, const TBitSet& bs)
|
|
{
|
|
out.fwriteBytes(bs.Bits, sizeof(bs.Bits));
|
|
return out;
|
|
}
|
|
|
|
ipstream& operator >>(ipstream& in, TBitSet& bs)
|
|
{
|
|
in.freadBytes(bs.Bits, sizeof(bs.Bits));
|
|
return in;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
TCharSet::TCharSet() : TBitSet()
|
|
{
|
|
}
|
|
|
|
TCharSet::TCharSet(const TCharSet& cs) : TBitSet(cs)
|
|
{
|
|
}
|
|
|
|
TCharSet::TCharSet(const char far* str) : TBitSet()
|
|
{
|
|
for (const char far* p = str; *p; p++) {
|
|
if (*p == '\\')
|
|
p++;
|
|
else if (*p == '-' && p > str && p[1]) { // handle "A-Z" type shorthands
|
|
p++;
|
|
for (char c = char(p[-2]+1); c < *p; c++) // replace "-" with "B..Y"
|
|
EnableItem(c);
|
|
}
|
|
EnableItem(*p);
|
|
}
|
|
}
|