- 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>
137 lines
4.8 KiB
C++
137 lines
4.8 KiB
C++
// Borland C++ - (C) Copyright 1994 by Borland International
|
|
|
|
#include <windows.h>
|
|
#include <ctl3d.h>
|
|
#include <idapi.h>
|
|
#include <string.h>
|
|
#include <io.h>
|
|
#include <dos.h> // for date structure and getdate function
|
|
#include <malloc.h> // malloc
|
|
#include <stdio.h>
|
|
#include <stdlib.h> // atoi
|
|
#include <direct.h>
|
|
#include <errno.h>
|
|
#include "id_defs.h"
|
|
#include "macro.h"
|
|
|
|
// Definitions needed for engine.c
|
|
#define IDLENGTH 6
|
|
#define FLDLENGTH 50
|
|
#define FLTLENGTH 20
|
|
#define DATELEN 14
|
|
#define COMMENTLEN 300
|
|
|
|
#define TOP 0
|
|
#define BOTTOM 2
|
|
#define PREV_REC -1
|
|
#define NEXT_REC 1
|
|
#define RANGEERROR 2
|
|
|
|
|
|
// Externs for global data
|
|
extern HINSTANCE hInst;
|
|
extern HWND hMainWnd;
|
|
extern HWND hErrorWnd;
|
|
extern BOOL NewRecMode;
|
|
extern BOOL RangeSet;
|
|
extern WNDPROC _wpOrigWndProc;
|
|
extern char szNoneOnOrder[];
|
|
|
|
// Variables for ENGINE.C
|
|
typedef struct {
|
|
CHAR ItemId[IDLENGTH];
|
|
CHAR Building[FLDLENGTH];
|
|
CHAR Item[FLDLENGTH];
|
|
CHAR In_Stock[FLTLENGTH];
|
|
CHAR Cost[FLTLENGTH];
|
|
CHAR DateD[DATELEN];
|
|
CHAR Message[COMMENTLEN];
|
|
} RecordType;
|
|
|
|
// Function prototypes for INV_MAIN.C
|
|
long FAR _pascal _export MainDlgProc (HWND, UINT, WPARAM, LPARAM);
|
|
BOOL InitApp(int nCmdShow);
|
|
long FAR _pascal _export EditSubClassProc(HWND, WORD, WORD, LONG);
|
|
BOOL FAR _pascal _export AboutDlg(HWND, WORD, WORD, LONG);
|
|
BOOL FAR _pascal _export OrderDlg(HWND, WORD, WORD, LONG);
|
|
BOOL FAR _pascal _export RangeDlg(HWND, WORD, WORD, LONG);
|
|
BOOL FAR _pascal _export SearchDlg(HWND, WORD, WORD, LONG);
|
|
BOOL FillStruct(RecordType *, UINT16);
|
|
BOOL DisplayTable(hDBICur);
|
|
BOOL TableExist(pCHAR);
|
|
BOOL FillTable(hDBICur, phDBIDb);
|
|
BOOL DispRec(RecordType *);
|
|
void MoveRec (hDBICur, INT16);
|
|
void CheckButtons(hDBICur);
|
|
void SetupEdits(void);
|
|
BOOL SaveRec(hDBICur, BOOL);
|
|
BOOL GetRec(RecordType *);
|
|
BOOL DeleteRecord(hDBICur);
|
|
void SetControl(UINT16, BOOL);
|
|
UINT16 FillDropList (HWND, hDBICur, UINT16);
|
|
void SetItemFocus(void);
|
|
BOOL ClearDlg(void);
|
|
BOOL verified(void);
|
|
BOOL CanContinue(pCHAR, UINT16);
|
|
void EndNewRec(hDBICur);
|
|
void SetDefaultDate(void);
|
|
void FillFieldList(HWND);
|
|
void GetField(RecordType *, pCHAR, UINT16);
|
|
void PutField(RecordType *, pCHAR, UINT16);
|
|
void SetFieldLength(HWND, UINT16, UINT16, UINT16, BOOL);
|
|
UINT16 GetCond(HWND);
|
|
|
|
// Function prototypes for INV_UTIL.C
|
|
UINT16 WinMsg(pCHAR, UINT16, UINT16);
|
|
void ChangeEntryMode(void);
|
|
int MakeFullPath(pCHAR pszDirectory, pCHAR pszRelativeDirectory);
|
|
|
|
// Functions for ENGINE.C
|
|
DBIResult DbInit(void);
|
|
DBIResult DbExit(void);
|
|
DBIResult CreateTable(phDBIDb, phDBICur);
|
|
DBIResult AddRecord(hDBICur, RecordType *, BOOL);
|
|
DBIResult SetDate(pDATE, pCHAR);
|
|
DBIResult GetTable(phDBIDb, phDBICur);
|
|
DBIResult CloseDb(phDBIDb);
|
|
DBIResult GetData(hDBICur, RecordType *);
|
|
DBIResult FillRec(hDBICur, pBYTE, RecordType *);
|
|
DBIResult GoTop(hDBICur, BOOL);
|
|
DBIResult GetNextRec(hDBICur);
|
|
DBIResult GetPrevRec(hDBICur);
|
|
DBIResult GoBottom(hDBICur, BOOL);
|
|
DBIResult SetIndex(phDBICur, UINT16);
|
|
DBIResult DoIndexes(phDBICur, UINT16);
|
|
BOOL AtEOF(hDBICur);
|
|
BOOL AtBOF(hDBICur);
|
|
UINT16 GetIndexNum(hDBICur);
|
|
DBIResult DeleteRec(hDBICur);
|
|
DBIResult SetRange(RecordType *, RecordType *, BOOL, BOOL, hDBICur, BOOL,
|
|
BOOL);
|
|
DBIResult FillBuf(hDBICur, pBYTE, RecordType *);
|
|
DBIResult Search(hDBICur, DBISearchCond, pBYTE);
|
|
DBIResult ResetRange(hDBICur);
|
|
DBIResult DateEncode(UINT16 mon, UINT16 day, UINT16 year, pDATE pTempDate);
|
|
void CreateVchk(UINT16 uNumFields, UINT16 uNumVchks, pFLDDesc fldDesc, pVCHKDesc VchkDesc);
|
|
|
|
// Variables for table creation
|
|
extern FLDDesc fldDesc[]; // used in engine.c
|
|
extern const UINT16 uNumFields; // used in engine.c
|
|
extern IDXDesc idxDesc[]; // used in engine.c
|
|
extern const UINT16 uNumIndexes; // used in engine.c
|
|
extern const UINT16 uNumRecs; // Number of records to insert
|
|
extern const pCHAR IndexList[]; // Index descriptions for the index listbox
|
|
extern const UINT16 uNumVchks;
|
|
extern VCHKDesc VchkDesc[];
|
|
|
|
// The name of the table to use and the directory of where to put it.
|
|
extern const char far szTblName[];
|
|
extern char far szTblDirectory[];
|
|
extern char far szPrivDirectory[];
|
|
extern const char far szTblType[];
|
|
|
|
// Macro for Subclassing the edit control.
|
|
#define SubClassWindow(hWnd, lpfn) \
|
|
((WNDPROC)SetWindowLong((hWnd), GWL_WNDPROC, \
|
|
(LPARAM)(WNDPROC)(lpfn)))
|