Isolate JKRHeap operator overloads

Fixes #25

This isolates the JKRHeap operator new/delete overloads. Every single new/delete site in the code has been replaced with a macro.

Sadly for new[] and delete[] we have to keep global operators. The global new[] just allocates into malloc() however, and delete[] goes into free() if it's not in a JKRHeap. So that's fine.
This commit is contained in:
PJB3005
2026-02-27 23:11:59 +01:00
parent 2204ad0813
commit 038ef4216f
634 changed files with 3451 additions and 3350 deletions
+6 -6
View File
@@ -107,7 +107,7 @@ static char* l_arcName = "Coach2D";
static daCoach2D_HIO_c l_HOSTIO;
int daCoach2D_c::createHeap() {
mpScrn = new J2DScreen();
mpScrn = JKR_NEW J2DScreen();
if (mpScrn == NULL) {
return 0;
}
@@ -124,15 +124,15 @@ int daCoach2D_c::createHeap() {
mpFireIconBrk->searchUpdateMaterialID(mpScrn);
setBrkAnime(true);
mpPaneAll = new CPaneMgr(mpScrn, MULTI_CHAR('n_all'), 2, NULL);
mpPaneBasha = new CPaneMgr(mpScrn, MULTI_CHAR('basha_n'), 2, NULL);
mpPaneFire = new CPaneMgr(mpScrn, MULTI_CHAR('fire_n'), 2, NULL);
mpPaneAll = JKR_NEW CPaneMgr(mpScrn, MULTI_CHAR('n_all'), 2, NULL);
mpPaneBasha = JKR_NEW CPaneMgr(mpScrn, MULTI_CHAR('basha_n'), 2, NULL);
mpPaneFire = JKR_NEW CPaneMgr(mpScrn, MULTI_CHAR('fire_n'), 2, NULL);
mpScrn->search(MULTI_CHAR('fire_b_n'))->move(mpPaneFire->getPosX(), mpPaneFire->getPosY());
mpPaneFireB = new CPaneMgr(mpScrn, MULTI_CHAR('fire_b_n'), 2, NULL);
mpPaneFireB = JKR_NEW CPaneMgr(mpScrn, MULTI_CHAR('fire_b_n'), 2, NULL);
mMsgLight = new dMsgScrnLight_c(6, 0xFF);
mMsgLight = JKR_NEW dMsgScrnLight_c(6, 0xFF);
if (mpPaneAll == NULL || mpPaneBasha == NULL || mpPaneFire == NULL || mpPaneFireB == NULL || mMsgLight == NULL) {
return 0;