From a969f5c6f3fd22b97aa7e992daaa3e3bf4b93dab Mon Sep 17 00:00:00 2001 From: Robin Eklind Date: Sat, 12 Jan 2019 17:38:47 +0100 Subject: [PATCH] Uncomment delete to make appfat.cpp compile as C. Note, in the future, we want to figure out how the delete operator was overloaded and included while still compiling the project as C. Most likely it was overloaded in the Storm header, and being included by appfat.cpp (which is the first file being compiled in alphabetic order), it was included here. Fixes #528. --- MakefileVC | 5 +---- Source/appfat.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/MakefileVC b/MakefileVC index 984664890..e9b9df98a 100644 --- a/MakefileVC +++ b/MakefileVC @@ -56,9 +56,6 @@ debug: Diablo.exe DIABLO_SRC=$(sort $(filter-out Source/_asm.cpp Source/_render.cpp Source/render.cpp, $(wildcard Source/*.cpp))) DIABLO_SRC += Source/render.cpp OBJS=$(DIABLO_SRC:.cpp=.obj) -# hardcoded list of src files, because only some of them are ready to be compiled as C instead of C++ -# once all files compile as C we should use the /TC flag abd DIABLO_SRC instead -DIABLO_SRC_FIXED = Source/appfat.cpp /TcSource/automap.cpp /TcSource/capture.cpp /TcSource/codec.cpp /TcSource/control.cpp /TcSource/cursor.cpp /TcSource/dead.cpp /TcSource/debug.cpp /TcSource/diablo.cpp /TcSource/doom.cpp /TcSource/drlg_l1.cpp /TcSource/drlg_l2.cpp /TcSource/drlg_l3.cpp /TcSource/drlg_l4.cpp /TcSource/dthread.cpp /TcSource/dx.cpp /TcSource/effects.cpp /TcSource/encrypt.cpp /TcSource/engine.cpp /TcSource/error.cpp /TcSource/fault.cpp /TcSource/gamemenu.cpp /TcSource/gendung.cpp /TcSource/gmenu.cpp /TcSource/help.cpp /TcSource/init.cpp /TcSource/interfac.cpp /TcSource/inv.cpp /TcSource/items.cpp /TcSource/lighting.cpp /TcSource/loadsave.cpp /TcSource/logging.cpp /TcSource/mainmenu.cpp /TcSource/minitext.cpp /TcSource/missiles.cpp /TcSource/monster.cpp /TcSource/movie.cpp /TcSource/mpqapi.cpp /TcSource/msg.cpp /TcSource/msgcmd.cpp /TcSource/multi.cpp /TcSource/nthread.cpp /TcSource/objects.cpp /TcSource/pack.cpp /TcSource/palette.cpp /TcSource/path.cpp /TcSource/pfile.cpp /TcSource/player.cpp /TcSource/plrmsg.cpp /TcSource/portal.cpp /TcSource/quests.cpp /TcSource/restrict.cpp /TcSource/scrollrt.cpp /TcSource/setmaps.cpp /TcSource/sha.cpp /TcSource/sound.cpp /TcSource/spells.cpp /TcSource/stores.cpp /TcSource/sync.cpp /TcSource/textdat.cpp /TcSource/themes.cpp /TcSource/tmsg.cpp /TcSource/town.cpp /TcSource/towners.cpp /TcSource/track.cpp /TcSource/trigs.cpp /TcSource/wave.cpp /TcSource/render.cpp PKWARE_SRC=$(sort $(wildcard 3rdParty/PKWare/*.cpp)) PKWARE_OBJS=$(PKWARE_SRC:.cpp=.obj) @@ -80,7 +77,7 @@ DiabloUI/diabloui.lib: $(DIABLOUI_OBJS) 3rdParty/Storm/Source/storm.lib # compiles all main source files with once compiler call main_files: - $(CL) $(CFLAGS) /FoSource/ $(DIABLO_SRC_FIXED) + $(CL) $(CFLAGS) /TC /FoSource/ $(DIABLO_SRC) %.obj: %.cpp $(CL) $(CFLAGS) /Fo$@ $< diff --git a/Source/appfat.cpp b/Source/appfat.cpp index e86c929ee..7f74667c2 100644 --- a/Source/appfat.cpp +++ b/Source/appfat.cpp @@ -7,12 +7,12 @@ int terminating; // weak int cleanup_thread_id; // weak // delete overloads the delete operator. -void operator delete(void *ptr) -{ - if (ptr != NULL) { - SMemFree(ptr, "delete", -1, 0); - } -} +//void operator delete(void *ptr) +//{ +// if (ptr != NULL) { +// SMemFree(ptr, "delete", -1, 0); +// } +//} char *__fastcall GetErrorStr(int error_code) {