diff options
author | Ash Wolf <ninji@wuffs.org> | 2023-07-01 02:43:29 +0100 |
---|---|---|
committer | Ash Wolf <ninji@wuffs.org> | 2023-07-01 02:43:29 +0100 |
commit | 5c6a48b2ff362a70416a6a00fda7d06e0f276f2d (patch) | |
tree | 62cf542c68d91aa6f7a4e3bfa9eddca4ab352970 /src/T2DLL | |
parent | c0c336500955a23e344651e5412c9d9d441ef4ee (diff) | |
download | t2win-5c6a48b2ff362a70416a6a00fda7d06e0f276f2d.tar.gz t2win-5c6a48b2ff362a70416a6a00fda7d06e0f276f2d.zip |
i am in hell
Diffstat (limited to 'src/T2DLL')
340 files changed, 3807 insertions, 2809 deletions
diff --git a/src/T2DLL/CDefRsrcPlugin.cpp b/src/T2DLL/CDefRsrcPlugin.cpp index a4f8b42..20b1d90 100644 --- a/src/T2DLL/CDefRsrcPlugin.cpp +++ b/src/T2DLL/CDefRsrcPlugin.cpp @@ -1,12 +1,205 @@ -#include "CDefRsrcPlugin.h" +#define ATOI_KLUDGE +#include "common.h" + +// this is a horrible, horrible hack +// because CDefRsrcPlugin is the first TU +#include "UT2Utils.h" +#include "URect.h" +#include "UPoint.h" +#include "T2PaletteAnimeDef.h" +#include "LAttachment.h" +#include "LAttachable.h" +#include "T2PluginSpecifier.h" +#include "CLink.h" +#include "LArray.h" +#include "LBroadcaster.h" +#include "LListener.h" +#include "LPeriodical.h" +#include "CResFile.h" +#include "T2Archive.h" +#include "T2BitImage.h" #include "T2ImageObj.h" +#include "T2DateTime.h" +#include "T2WeatherFilter.h" +#include "T2DayLightFilter.h" +#include "T2SpriteObj.h" +#include "T2WordDef.h" +#include "T2WordDefArray.h" +#include "Wave.h" +#include "T2SoundPlayer.h" +#include "T2Balloon.h" +#include "T2FireWork.h" +#include "T2DlgItemButtonBase.h" +#include "T2DlgItemIButton.h" +#include "T2DlgItemOK.h" +#include "T2DlgItemCANCEL.h" +#include "T2DlgItemTButton.h" +#include "T2DlgItemICheck.h" +#include "T2DlgItemCheck.h" +#include "T2DlgItemScr.h" +#include "T2DlgItemHScr.h" +#include "T2DlgItemVScr.h" +#include "T2DlgItemBox.h" +#include "T2DlgItemText.h" +#include "T2DlgItemGageBase.h" +#include "T2DlgItemStressGage.h" +#include "T2DlgItemPPLEvalGage.h" +#include "T2DlgItemBelongGage.h" +#include "T2DlgItemCustomerGage.h" +#include "T2DlgItemProfitsGage.h" +#include "T2DlgItemImageTable.h" +#include "T2DlgItemImage.h" +#include "CToggleButtonDisabled.h" +#include "T2VerticalTable.h" +#include "T2MovieTable.h" +#include "T2GuestroomTable.h" +#include "T2HallEventTable.h" +#include "CTokenizer.h" +#include "T2Dialog.h" +#include "T2GlobalData.h" +#include "CPluginInfoArray.h" +#include "CPluginInfo.h" +#include "CPluginInfoComparator.h" +#include "T2TowerMessage.h" +#include "CObjectList.h" +#include "T2Object.h" +#include "T2ObjectArray.h" +#include "T2ObjectArrayList.h" +#include "T2DrawableObject.h" +#include "T2HaveOutViewObject.h" +#include "T2EquipInfoDialog.h" +#include "T2TenantInfoDialog.h" +#include "CPlugin.h" +#include "CFilePlugin.h" +#include "CFilePluginList.h" +#include "CFilePluginDB.h" +#include "CDefRsrcPlugin.h" +#include "T2TemplatePlugin.h" +#include "CProgramPlugin.h" +#include "T2ToolPlugin.h" +#include "T2TemplatePluginList.h" +#include "T2TemplatePluginDB.h" +#include "CResourcePlugin.h" +#include "T2SubPlugin.h" +#include "T2AdvertiseTable.h" +#include "T2AdvertisePlugin.h" +#include "T2HallEventPlugin.h" +#include "T2MoviePlugin.h" +#include "T2PeoplePtrList.h" +#include "T2TempPluginComparator.h" +#include "T2PlaceParamDef.h" +#include "T2TenantMemberTableDef.h" +#include "T2TenantMemberDef.h" +#include "T2PeopleTypeArray.h" +#include "T2PeopleTimeZoneList.h" +#include "T2PeopleDemandList.h" +#include "T2ToolDef.h" +#include "T2EquipDef.h" +#include "T2TenantDef.h" +#include "T2MoverDef.h" +#include "T2OuterObjDef.h" +#include "T2SilhouetteDef.h" +#include "T2MatterDef.h" +#include "T2PeopleAnimeDefElem.h" +#include "T2PeopleAnimeDef.h" +#include "T2PeopleType.h" +#include "T2Matter.h" +#include "T2PeopleDef.h" +#include "T2People.h" +#include "T2PeopleLinkIterator.h" +#include "T2Pool.h" +#include "T2Equip.h" +#include "T2Tenant.h" +#include "T2Request.h" +#include "T2Mover.h" +#include "T2PeopleArray.h" +#include "T2PeopleArrayList.h" +#include "T2OutObj.h" +#include "T2OuterObjList.h" +#include "T2OutObjArray.h" +#include "T2OutObjArrayList.h" +#include "T2TenantArray.h" +#include "T2TenantArrayList.h" +#include "T2MoverArray.h" +#include "T2MoverArrayList.h" +#include "T2RegistedTenantDB.h" +#include "T2RequestArray.h" +#include "T2RequestArrayList.h" +#include "T2RequestIDArray.h" +#include "T2MoverModule.h" +#include "T2MoverModuleList.h" +#include "T2StairModule.h" +#include "T2StairModuleList.h" +#include "T2ElevatorModule.h" +#include "T2ElvModuleList.h" +#include "T2StopInfoArray.h" +#include "T2UnitInfo.h" +#include "T2FloorInfo.h" +#include "T2FInfoAreaIterator.h" +#include "T2FInfoPtIterator.h" +#include "UT2BkgndInfo.h" +#include "T2WorldPlugin.h" +#include "UT2Coordinate.h" +#include "T2WorldDef.h" +#include "T2PeopleLoader.h" +#include "T2CrossEquipArray.h" +#include "T2TenantCEArray.h" +#include "T2RouteCEArray.h" +#include "T2FloorCEArray.h" +#include "T2MoverCEArray.h" +#include "T2EquipPlugin.h" +#include "T2TenantPlugin.h" +#include "T2MoverPlugin.h" +#include "T2OuterObjPlugin.h" +#include "T2EquipPtrList.h" +#include "T2FloorPtrList.h" +#include "T2RoutingTableElem.h" +#include "T2MoverRoutingTable.h" +#include "T2RoutingTable.h" +#include "T2RouteNavigator.h" +#include "T2TowerEvent.h" +#include "T2EventItem.h" +#include "T2XEvent.h" +#include "T2BlackOut.h" +#include "T2FireBurning.h" +#include "T2MetroRailway.h" +#include "T2SantaClaus.h" +#include "T2Terrorist.h" +#include "T2VisitVIP.h" +#include "T2OutDecoration.h" +#include "T2OutsideInfo.h" +#include "T2MovieParamArray.h" +#include "T2TrafficInfo.h" +#include "T2Name.h" +#include "T2NameList.h" +#include "T2NameTable.h" +#include "T2CustomerTableIterator.h" +#include "T2DayParamDef.h" +#include "T2PaletteAnime.h" +#include "T2TowerVision.h" +#include "T2Settlement.h" +#include "T2Maru_Reggae.h" +#include "T2RegistedTenantIterator.h" +#include "T2OptionPlugin.h" +#include "T2OptionPluginList.h" +#include "T2StewardDialog.h" +#include "T2ClassFactory.h" +#include "T2MsgWindowCallback.h" +#include "T2ToolWindow.h" +#include "T2ToolCallback.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif CDefRsrcPlugin::CDefRsrcPlugin(DWORD type, T2PluginSpecifier& specifier, CResFile* resFile) : CPlugin(type, specifier) { mStr48 = specifier.mPluginName; #line 32 - mImageObj = DEBUG_NEW T2ImageObj; + mImageObj = new T2ImageObj; } /*virtual*/ CDefRsrcPlugin::~CDefRsrcPlugin() { diff --git a/src/T2DLL/CDefRsrcPlugin.h b/src/T2DLL/CDefRsrcPlugin.h index bdfb255..ece42df 100644 --- a/src/T2DLL/CDefRsrcPlugin.h +++ b/src/T2DLL/CDefRsrcPlugin.h @@ -2,7 +2,7 @@ #include "common.h" #include "CPlugin.h" -class AFX_EXT_CLASS CDefRsrcPlugin : public CPlugin { +class AFX_CLASS_EXPORT CDefRsrcPlugin : public CPlugin { public: CDefRsrcPlugin(DWORD type, T2PluginSpecifier& specifier, CResFile* resFile); virtual ~CDefRsrcPlugin(); diff --git a/src/T2DLL/CEditWFocus.cpp b/src/T2DLL/CEditWFocus.cpp index d2ad220..0892aad 100644 --- a/src/T2DLL/CEditWFocus.cpp +++ b/src/T2DLL/CEditWFocus.cpp @@ -1,5 +1,12 @@ +#define DONT_INCLUDE_AFXTEMPL #include "CEditWFocus.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + CEditWFocus::CEditWFocus() { } diff --git a/src/T2DLL/CFilePlugin.cpp b/src/T2DLL/CFilePlugin.cpp index aac286d..71d1885 100644 --- a/src/T2DLL/CFilePlugin.cpp +++ b/src/T2DLL/CFilePlugin.cpp @@ -14,7 +14,7 @@ CFilePlugin::CFilePlugin(DWORD type, T2PluginSpecifier& specifier) success = file.OpenResource(specifier.mPath, 128, 'ATTR'); specifier.mIsLoaded = true; } else { - success = file.OpenResource(specifier.mInstance, 128, "ATTR"); + success = file.OpenResource(specifier.mInstance, 128, "Attr"); } if (success) { diff --git a/src/T2DLL/CFilePlugin.h b/src/T2DLL/CFilePlugin.h index 8aa69ff..ad6e16f 100644 --- a/src/T2DLL/CFilePlugin.h +++ b/src/T2DLL/CFilePlugin.h @@ -4,7 +4,7 @@ class CPluginInfo; -class AFX_EXT_CLASS CFilePlugin : public CPlugin { +class AFX_CLASS_EXPORT CFilePlugin : public CPlugin { public: CFilePlugin(DWORD type, T2PluginSpecifier& specifier); virtual ~CFilePlugin(); diff --git a/src/T2DLL/CFilePluginDB.cpp b/src/T2DLL/CFilePluginDB.cpp index 83d8456..65afb4d 100644 --- a/src/T2DLL/CFilePluginDB.cpp +++ b/src/T2DLL/CFilePluginDB.cpp @@ -12,17 +12,17 @@ CFilePluginDB::CFilePluginDB() /*virtual*/ void CFilePluginDB::Add(CFilePlugin* plugin) { LArrayIterator iter(*this); - BOOL found = false; + BOOL added = false; CFilePluginList *list; - while (!found && iter.Next(&list)) { + while (!added && iter.Next(&list)) { if (list->GetPluginType() == plugin->GetType()) { list->Add(plugin); - found = true; + added = true; } } - if (!found) { + if (!added) { list = new CFilePluginList(plugin->GetType()); list->Add(plugin); InsertItemsAt(1, mItemCount + 1, &list); diff --git a/src/T2DLL/CFilePluginDB.h b/src/T2DLL/CFilePluginDB.h index f707b95..d92ec3d 100644 --- a/src/T2DLL/CFilePluginDB.h +++ b/src/T2DLL/CFilePluginDB.h @@ -2,7 +2,7 @@ #include "common.h" #include "LArray.h" -class AFX_EXT_CLASS CFilePluginDB : public LArray { +class AFX_CLASS_EXPORT CFilePluginDB : public LArray { public: CFilePluginDB(); virtual ~CFilePluginDB(); diff --git a/src/T2DLL/CFilePluginList.h b/src/T2DLL/CFilePluginList.h index 3fbbb39..9eb31b1 100644 --- a/src/T2DLL/CFilePluginList.h +++ b/src/T2DLL/CFilePluginList.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS CFilePluginList : public CList<CFilePlugin *, CFilePlugin *> { +class AFX_CLASS_EXPORT CFilePluginList : public CList<CFilePlugin *, CFilePlugin *> { public: CFilePluginList(DWORD pluginType); virtual ~CFilePluginList(); diff --git a/src/T2DLL/CLink.h b/src/T2DLL/CLink.h index abb7ca5..6edfdca 100644 --- a/src/T2DLL/CLink.h +++ b/src/T2DLL/CLink.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS CLink { +class AFX_CLASS_EXPORT CLink { public: CLink(); CLink(CLink* prev); @@ -24,7 +24,7 @@ protected: friend class T2PeopleLinkIterator; }; -class AFX_EXT_CLASS CLinkIterator { +class AFX_CLASS_EXPORT CLinkIterator { public: CLinkIterator(CLink* start); virtual ~CLinkIterator(); diff --git a/src/T2DLL/CObjectList.h b/src/T2DLL/CObjectList.h index 0ea922b..6141747 100644 --- a/src/T2DLL/CObjectList.h +++ b/src/T2DLL/CObjectList.h @@ -2,7 +2,7 @@ #include "common.h" #include "LArray.h" -class AFX_EXT_CLASS CObjectList : public LArray { +class AFX_CLASS_EXPORT CObjectList : public LArray { public: CObjectList(); virtual ~CObjectList(); diff --git a/src/T2DLL/CObjectQueue.h b/src/T2DLL/CObjectQueue.h index 9a87db2..19a5519 100644 --- a/src/T2DLL/CObjectQueue.h +++ b/src/T2DLL/CObjectQueue.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class CObjectQueue : public CList<void*, void*> { +class AFX_CLASS_EXPORT CObjectQueue : public CList<void*, void*> { public: CObjectQueue(); virtual ~CObjectQueue(); diff --git a/src/T2DLL/CPEFile.cpp b/src/T2DLL/CPEFile.cpp index 7bb49de..46ce23b 100644 --- a/src/T2DLL/CPEFile.cpp +++ b/src/T2DLL/CPEFile.cpp @@ -1,26 +1,11 @@ +#define DONT_INCLUDE_AFXTEMPL #include "CPEFile.h" -CPEFile::CPEFile(const CPEFile& other) - : mFile(other.mFile) - , mFileHeader(other.mFileHeader) - , mSectionHeaders(other.mSectionHeaders) - , mRsrcPtr(other.mRsrcPtr) - , mRsrcIndex(other.mRsrcIndex) - , mStartPosition(other.mStartPosition) - , mLength(other.mLength) -{ -} - -CPEFile& CPEFile::operator=(const CPEFile& other) { - mFile = other.mFile; - mFileHeader = other.mFileHeader; - mSectionHeaders = other.mSectionHeaders; - mRsrcPtr = other.mRsrcPtr; - mRsrcIndex = other.mRsrcIndex; - mStartPosition = other.mStartPosition; - mLength = other.mLength; - return *this; -} +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif CPEFile::CPEFile() { mFile = NULL; @@ -46,7 +31,7 @@ CPEFile::~CPEFile() { BOOL result = false; #line 36 - mFile = DEBUG_NEW CFile; + mFile = new CFile; if (mFile->Open(filename, flags, pError)) { result = Init(); if (!result) @@ -126,26 +111,26 @@ BOOL CPEFile::EnumResourceDirectory(IMAGE_RESOURCE_DIRECTORY_ENTRY* entry, RESTR void CPEFile::GetResourceName(CString& s, IMAGE_RESOURCE_DIRECTORY_ENTRY& entry) { if (entry.Name & 0x80000000) { - unsigned short len; + unsigned short nameLen; mFile->Seek(mRsrcPtr + entry.NameOffset, CFile::begin); - mFile->Read(&len, sizeof(len)); + mFile->Read(&nameLen, sizeof(nameLen)); - char *widebuf = (char *) malloc(len * 2); - mFile->Read(widebuf, len * 2); + char *wstr = (char *) malloc(nameLen * 2); + mFile->Read(wstr, nameLen * 2); - int size = len * 2 + 1; - char *buf = (char *) malloc(size); - memset(buf, 0, size); + int bufferSize = nameLen * 2 + 1; + char *theBuf = (char *) malloc(bufferSize); + memset(theBuf, 0, bufferSize); int i; - for (i = 0; i < len; i++) { - buf[i] = widebuf[i * 2]; + for (i = 0; i < nameLen; i++) { + theBuf[i] = wstr[i * 2]; } - buf[i] = 0; + theBuf[i] = 0; - s = buf; - free(widebuf); - free(buf); + s = theBuf; + free(wstr); + free(theBuf); } else { s.Format("#%u", entry.Name); } @@ -162,55 +147,55 @@ void CPEFile::EnterDirectory(RESTRACKERWORK& child, RESTRACKERWORK& parent) { child.nextIndex = 0; } -/*virtual*/ BOOL CPEFile::Seek(const char* name) { +/*virtual*/ BOOL CPEFile::Seek(const char* inName) { #line 141 - _ASSERT(strncmp(name, "\\.rsrc", 6) == 0); + _ASSERT(strncmp(inName, "\\.rsrc", 6) == 0); - char *nameCopy = (char *) malloc(strlen(name) + 1); - strcpy(nameCopy, name); + char *name = (char *) malloc(strlen(inName) + 1); + strcpy(name, inName); - CString str; - str = (char *) NULL; - str = strtok(nameCopy, "\\"); + CString elem; + elem = (char *) NULL; + elem = strtok(name, "\\"); RESTRACKERWORK work; memset(&work, 0, sizeof(work)); - BOOL flag = false; + BOOL isOK = false; - CString str2(""); + CString resName = ""; - while ((str = strtok(NULL, "\\")) != "") { - if (flag) { + while ((elem = strtok(NULL, "\\")) != "") { + if (isOK) { RESTRACKERWORK child; EnterDirectory(child, work); work = child; } - flag = false; - while (EnumResource(str2, work) == 1) { - if (_stricmp(str2, str) == 0 || _stricmp(str2, str + "\\") == 0) { - flag = true; + isOK = false; + while (EnumResource(resName, work) == 1) { + if (_stricmp(resName, elem) == 0 || _stricmp(resName, elem + "\\") == 0) { + isOK = true; break; } } - if (!flag) + if (!isOK) return false; } - free(nameCopy); + free(name); - if (str2.Right(1) == "\\") + if (resName.Right(1) == "\\") return false; - IMAGE_RESOURCE_DATA_ENTRY dataEntry; + IMAGE_RESOURCE_DATA_ENTRY theEntryData; mFile->Seek(mRsrcPtr + work.entry.OffsetToData, CFile::begin); - mFile->Read(&dataEntry, sizeof(dataEntry)); + mFile->Read(&theEntryData, sizeof(theEntryData)); - mStartPosition = dataEntry.OffsetToData - (mSectionHeaders[mRsrcIndex].VirtualAddress - mSectionHeaders[mRsrcIndex].PointerToRawData); - mLength = dataEntry.Size; + mStartPosition = theEntryData.OffsetToData - (mSectionHeaders[mRsrcIndex].VirtualAddress - mSectionHeaders[mRsrcIndex].PointerToRawData); + mLength = theEntryData.Size; mFile->Seek(mStartPosition, CFile::begin); diff --git a/src/T2DLL/CPEFile.h b/src/T2DLL/CPEFile.h index 4dbc31d..3e566f8 100644 --- a/src/T2DLL/CPEFile.h +++ b/src/T2DLL/CPEFile.h @@ -9,17 +9,15 @@ struct RESTRACKERWORK { IMAGE_RESOURCE_DIRECTORY_ENTRY entry; }; -class AFX_EXT_CLASS CPEFile { +class AFX_CLASS_EXPORT CPEFile { public: - CPEFile(const CPEFile&); - CPEFile& operator=(const CPEFile&); CPEFile(); ~CPEFile(); virtual BOOL Open(const char*, unsigned int, CFileException* exc = NULL); virtual void Close(); virtual long Seek(long offset, unsigned int from); - virtual BOOL Seek(const char* name); + virtual BOOL Seek(const char* inName); virtual unsigned long GetLength(); virtual unsigned long GetPosition(); virtual unsigned int Read(void* buf, unsigned int len); diff --git a/src/T2DLL/CPieChartView.h b/src/T2DLL/CPieChartView.h index 0150e59..6354cc7 100644 --- a/src/T2DLL/CPieChartView.h +++ b/src/T2DLL/CPieChartView.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS CPieChartView : public CWnd { +class AFX_CLASS_EXPORT CPieChartView : public CWnd { public: struct PieSlice { unsigned int value; diff --git a/src/T2DLL/CPiledMultiBarChartView.h b/src/T2DLL/CPiledMultiBarChartView.h index 4beb180..d16637d 100644 --- a/src/T2DLL/CPiledMultiBarChartView.h +++ b/src/T2DLL/CPiledMultiBarChartView.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS CPiledMultiBarChartView : public CWnd { +class AFX_CLASS_EXPORT CPiledMultiBarChartView : public CWnd { public: struct GraphData { int piles, bars; diff --git a/src/T2DLL/CPlugin.cpp b/src/T2DLL/CPlugin.cpp index 15ec926..a6f71c3 100644 --- a/src/T2DLL/CPlugin.cpp +++ b/src/T2DLL/CPlugin.cpp @@ -1,5 +1,12 @@ #include "CPlugin.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + + CPlugin::CPlugin(DWORD type, T2PluginSpecifier& specifier) { mSpecifier = specifier; mModuleHandle = specifier.mInstance; diff --git a/src/T2DLL/CPlugin.h b/src/T2DLL/CPlugin.h index b63028e..5bf7d37 100644 --- a/src/T2DLL/CPlugin.h +++ b/src/T2DLL/CPlugin.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2PluginSpecifier.h" -class AFX_EXT_CLASS CPlugin { +class AFX_CLASS_EXPORT CPlugin { public: CPlugin(DWORD type, T2PluginSpecifier& specifier); virtual ~CPlugin(); diff --git a/src/T2DLL/CPluginInfo.h b/src/T2DLL/CPluginInfo.h index 704c707..71fa3c7 100644 --- a/src/T2DLL/CPluginInfo.h +++ b/src/T2DLL/CPluginInfo.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS CPluginInfo { +class AFX_CLASS_EXPORT CPluginInfo { public: static CPluginInfo* ReadPluginInfo(T2Archive& archive); protected: diff --git a/src/T2DLL/CPluginInfoArray.cpp b/src/T2DLL/CPluginInfoArray.cpp index ea6f34b..ec38e3d 100644 --- a/src/T2DLL/CPluginInfoArray.cpp +++ b/src/T2DLL/CPluginInfoArray.cpp @@ -11,24 +11,23 @@ CPluginInfoArray::CPluginInfoArray(BOOL ownsPluginInfo) /*virtual*/ CPluginInfoArray::~CPluginInfoArray() { if (mOwnsPluginInfo) { + CPluginInfo *info; LArrayIterator iter(*this); - CPluginInfo *pluginInfo; - while (iter.Next(&pluginInfo)) - delete pluginInfo; + while (iter.Next(&info)) + delete info; } } int CPluginInfoArray::GetUsedCount() { - int count = 0; - + CPluginInfo *info; + int numPlugins = 0; LArrayIterator iter(*this); - CPluginInfo *pluginInfo; - while (iter.Next(&pluginInfo)) { - if (pluginInfo->IsUsed()) - count++; + while (iter.Next(&info)) { + if (info->IsUsed()) + numPlugins++; } - return count; + return numPlugins; } diff --git a/src/T2DLL/CPluginInfoArray.h b/src/T2DLL/CPluginInfoArray.h index c07d6ff..a03f0fb 100644 --- a/src/T2DLL/CPluginInfoArray.h +++ b/src/T2DLL/CPluginInfoArray.h @@ -2,7 +2,7 @@ #include "common.h" #include "LArray.h" -class AFX_EXT_CLASS CPluginInfoArray : public LArray { +class AFX_CLASS_EXPORT CPluginInfoArray : public LArray { public: CPluginInfoArray(BOOL ownsPluginInfo = true); virtual ~CPluginInfoArray(); diff --git a/src/T2DLL/CPluginInfoComparator.h b/src/T2DLL/CPluginInfoComparator.h index c37f6ba..d810490 100644 --- a/src/T2DLL/CPluginInfoComparator.h +++ b/src/T2DLL/CPluginInfoComparator.h @@ -2,8 +2,9 @@ #include "common.h" #include "LComparator.h" -class AFX_EXT_CLASS CPluginInfoComparator : public LComparator { +class AFX_CLASS_EXPORT CPluginInfoComparator : public LComparator { public: + CPluginInfoComparator() { } virtual ~CPluginInfoComparator() { } virtual int Compare(const void* inItemOne, const void* inItemTwo, unsigned int inSizeOne, unsigned int inSizeTwo) const; virtual BOOL IsEqualTo(const void* inItemOne, const void* inItemTwo, unsigned int inSizeOne, unsigned int inSizeTwo) const; diff --git a/src/T2DLL/CProgramPlugin.h b/src/T2DLL/CProgramPlugin.h index 2781a08..27ac4d7 100644 --- a/src/T2DLL/CProgramPlugin.h +++ b/src/T2DLL/CProgramPlugin.h @@ -2,7 +2,7 @@ #include "common.h" #include "CFilePlugin.h" -class AFX_EXT_CLASS CProgramPlugin : public CFilePlugin { +class AFX_CLASS_EXPORT CProgramPlugin : public CFilePlugin { public: CProgramPlugin(DWORD type, T2PluginSpecifier& specifier); virtual ~CProgramPlugin(); diff --git a/src/T2DLL/CResFile.cpp b/src/T2DLL/CResFile.cpp index 3c31ec7..310e45d 100644 --- a/src/T2DLL/CResFile.cpp +++ b/src/T2DLL/CResFile.cpp @@ -1,3 +1,4 @@ +#define ATOI_KLUDGE #include "CPEFile.h" #include "CResFile.h" #include "GlobalFunc.h" @@ -41,19 +42,19 @@ BOOL CResFile::OpenResource(HINSTANCE inst, int name, const char* type) { BOOL CResFile::OpenResource(HINSTANCE inst, const char* name, const char* type) { HRSRC h = FindResource(inst, name, type); if (!h) { - CString strN; + CString theNameString; if (((DWORD) name) < 0x10000) - strN.Format("(%d)", ((DWORD) name) & 0xFFFF); + theNameString.Format("(%d)", ((DWORD) name) & 0xFFFF); else - strN = name; + theNameString = name; - CString strT; + CString theTypeString; if (((DWORD) type) < 0x10000) - strT.Format("(%d)", ((DWORD) type) & 0xFFFF); + theTypeString.Format("(%d)", ((DWORD) type) & 0xFFFF); else - strT = type; + theTypeString = type; - CString str = "CResFile::OpenResource ERROR : " + strN + "," + strT + " @" + GetModuleName(inst) + "\n"; + CString str = "CResFile::OpenResource ERROR : " + theNameString + "," + theTypeString + " @" + GetModuleName(inst) + "\n"; OutputDebugString(str); return false; @@ -69,16 +70,16 @@ BOOL CResFile::OpenResource(HINSTANCE inst, HRSRC rsrc) { mInstance = inst; mRsrc = rsrc; - HANDLE handle = LoadResource(inst, rsrc); - if (!handle) + HANDLE theHandle = LoadResource(inst, rsrc); + if (!theHandle) return false; - void *p = LockResource(handle); + void *theData = LockResource(theHandle); mRemaining = SizeofResource(inst, rsrc); mBuffer = (char *) malloc(mRemaining + 1); - memcpy(mBuffer, p, mRemaining); - UnlockResource(handle); - FreeResource(handle); + memcpy(mBuffer, theData, mRemaining); + UnlockResource(theHandle); + FreeResource(theHandle); SetupResource(); @@ -86,28 +87,28 @@ BOOL CResFile::OpenResource(HINSTANCE inst, HRSRC rsrc) { } BOOL CResFile::OpenResource(const char* path, int name, int type) { - CFile *theFile = new CFile; - if (!theFile->Open(path, CFile::modeRead)) { - delete theFile; + CFile *file = new CFile; + if (!file->Open(path, CFile::modeRead)) { + delete file; return false; } char magic[2]; - theFile->Read(magic, 2); - theFile->Close(); - delete theFile; + file->Read(magic, 2); + file->Close(); + delete file; if (memcmp(magic, "SP", 2) == 0) { SUBPLUGINFSENTRY entry; - CFile *f = OpenSubPluginFS(magic, name, type, &entry); - if (!f) + CFile *subPluginFile = OpenSubPluginFS(path, name, type, &entry); + if (!subPluginFile) return false; mRemaining = entry.spfse_mC; mBuffer = (char *) malloc(mRemaining + 1); - f->Read(mBuffer, mRemaining); - f->Close(); - delete f; + subPluginFile->Read(mBuffer, mRemaining); + subPluginFile->Close(); + delete subPluginFile; mIsSubPlugin = true; } else if (memcmp(magic, "PE", 2) == 0) { @@ -122,10 +123,10 @@ BOOL CResFile::OpenResource(const char* path, int name, int type) { buf[3] = ((char *) &type)[0]; buf[4] = 0; - CString str; + CString path; unsigned short langID = GetUserDefaultLangID(); - str.Format("\\.rsrc\\%s\\#%d\\#%d", buf, name, langID); - if (!pe.Seek(str)) + path.Format("\\.rsrc\\%s\\#%d\\#%d", buf, name, langID); + if (!pe.Seek(path)) return false; mRemaining = pe.GetLength(); diff --git a/src/T2DLL/CResFile.h b/src/T2DLL/CResFile.h index 24966a8..26dd4a6 100644 --- a/src/T2DLL/CResFile.h +++ b/src/T2DLL/CResFile.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS CResFile { +class AFX_CLASS_EXPORT CResFile { public: CResFile(); virtual ~CResFile(); diff --git a/src/T2DLL/CResourcePlugin.h b/src/T2DLL/CResourcePlugin.h index 9a7243e..8153236 100644 --- a/src/T2DLL/CResourcePlugin.h +++ b/src/T2DLL/CResourcePlugin.h @@ -2,7 +2,7 @@ #include "common.h" #include "CFilePlugin.h" -class AFX_EXT_CLASS CResourcePlugin : public CFilePlugin { +class AFX_CLASS_EXPORT CResourcePlugin : public CFilePlugin { public: CResourcePlugin(DWORD type, T2PluginSpecifier& specifier); virtual ~CResourcePlugin(); diff --git a/src/T2DLL/CToggleButtonDisabled.cpp b/src/T2DLL/CToggleButtonDisabled.cpp index f69f8cc..a175bbc 100644 --- a/src/T2DLL/CToggleButtonDisabled.cpp +++ b/src/T2DLL/CToggleButtonDisabled.cpp @@ -1,6 +1,12 @@ #include "CToggleButtonDisabled.h" #include "T2BitImage.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + CToggleButtonDisabled::CToggleButtonDisabled(T2TowerDoc* towerDoc, T2ImageObj* imageObj, CPalette* palette) : T2DlgItem(towerDoc, imageObj, palette) { @@ -43,8 +49,8 @@ void CToggleButtonDisabled::Disable() { } /*virtual*/ BOOL CToggleButtonDisabled::OnT2DlgItemEraseBkgnd(CDC* dc) { - CRect clientRect; - GetClientRect(clientRect); + CRect theClientRect; + GetClientRect(theClientRect); int savedDC = dc->SaveDC(); @@ -52,15 +58,15 @@ void CToggleButtonDisabled::Disable() { dc->RealizePalette(); CPen pen; - CBrush brush; + CBrush theBrush; CString text; GetWindowText(text); - RECT imageRect; - T2BitImage *image = GetObjectImage(imageRect, text, GetPattern()); - if (image) - image->CopyImage(dc, imageRect, clientRect, 0, NULL); + RECT theImageRect; + T2BitImage *theImage = GetObjectImage(theImageRect, text, GetPattern()); + if (theImage) + theImage->CopyImage(dc, theImageRect, theClientRect, 0, NULL); dc->RestoreDC(savedDC); diff --git a/src/T2DLL/CToggleButtonDisabled.h b/src/T2DLL/CToggleButtonDisabled.h index 45be553..dc52a93 100644 --- a/src/T2DLL/CToggleButtonDisabled.h +++ b/src/T2DLL/CToggleButtonDisabled.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2DlgItem.h" -class AFX_EXT_CLASS CToggleButtonDisabled : public T2DlgItem { +class AFX_CLASS_EXPORT CToggleButtonDisabled : public T2DlgItem { public: CToggleButtonDisabled(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); virtual BOOL Create(const char* windowName, DWORD style, const RECT& rect, CWnd* parentWnd, UINT nId); diff --git a/src/T2DLL/CTokenizer.cpp b/src/T2DLL/CTokenizer.cpp index e205c0b..215ffbc 100644 --- a/src/T2DLL/CTokenizer.cpp +++ b/src/T2DLL/CTokenizer.cpp @@ -1,5 +1,12 @@ +#define DONT_INCLUDE_AFXTEMPL #include "CTokenizer.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + CTokenizer::CTokenizer(char *str, const char *newLineChars, const char *spaceChars) : mNext(str) , mCurrent(NULL) diff --git a/src/T2DLL/CTokenizer.h b/src/T2DLL/CTokenizer.h index fe4475f..080d5cd 100644 --- a/src/T2DLL/CTokenizer.h +++ b/src/T2DLL/CTokenizer.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS CTokenizer { +class AFX_CLASS_EXPORT CTokenizer { public: CTokenizer(char *str, const char *newLineChars = NULL, const char *spaceChars = NULL); virtual ~CTokenizer(); diff --git a/src/T2DLL/GlobalFunc.cpp b/src/T2DLL/GlobalFunc.cpp index 754f5cd..a5f6f6f 100644 --- a/src/T2DLL/GlobalFunc.cpp +++ b/src/T2DLL/GlobalFunc.cpp @@ -1,21 +1,12 @@ +#define ATOI_KLUDGE #include "CResFile.h" #include "GlobalFunc.h" #include "T2BitImage.h" +#include "T2DLL.h" #include "T2OptionPluginList.h" #include "T2TowerDoc.h" #include "T2WorldDef.h" -T2SoundPlayer *Sounds; -CT2App *gT2App; -int gCommonColor[20]; -BOOL FFEnable; -DWORD FFBaseForce; -IDirectInput *FFgpdi; -IDirectInputDevice2W *FFJoystick; -IDirectInputEffect *FFBuild; -IDirectInputEffect *FFStatic; -T2TowerDoc *g_TowerDoc; - char *strtokEx(char * inStr, const char * inSep, char ** ioLast) { #line 11 _ASSERT(!inStr || !*ioLast); @@ -344,7 +335,7 @@ CString LoadStringTable(HINSTANCE inModule, int inID1, int inID2) { } } } else { - str.Format("%d-%d@%s", inID1, inID2); + str.Format("%d-%d", inID1, inID2); BOOL isOpen = false; CResFile theResFile; diff --git a/src/T2DLL/GlobalFunc.h b/src/T2DLL/GlobalFunc.h index 0b8fd2f..fa658bd 100644 --- a/src/T2DLL/GlobalFunc.h +++ b/src/T2DLL/GlobalFunc.h @@ -17,41 +17,30 @@ struct SUBPLUGINFSENTRY { int spfse_mC; // size? }; -char *AFX_EXT_API strtokEx(char * inStr, const char * inSep, char ** ioLast); -void AFX_EXT_API InsetRect(RECT * ioRect, int inX, int inY); -void AFX_EXT_API SetPt(POINT * outPt, int inX, int inY); -HBITMAP AFX_EXT_API Create256DIBitmap(HDC inDC, int inWidth, int inHeight); -LOGPALETTE *AFX_EXT_API ConvACTPalette(ACTPALETTEENTRY * inPalette); -LOGPALETTE *AFX_EXT_API LoadACTPaletteEntries(HINSTANCE inModule, int inResID); -void AFX_EXT_API FFSetStaticForce(int inX, int inY); -CString AFX_EXT_API GetInstallSource(); -CString AFX_EXT_API GetInstallSourceDrive(); -T2TowerDoc *AFX_EXT_API GetCurrentT2TowerDoc(); -HINSTANCE AFX_EXT_API GetWorldModuleHandle(); -CString AFX_EXT_API GetModuleName(HINSTANCE inModule); -unsigned int AFX_EXT_API TickCount(); -BOOL AFX_EXT_API DispatchOptionEvent(OPTIONEVENTTYPE inEventType, void * inData); -CFile *AFX_EXT_API OpenSubPluginFS(const char * inPath, int inID1, int inID2, SUBPLUGINFSENTRY * outEntry); -void AFX_EXT_API __Rep0(const char * inFileName, int inLineNum, const char * inMessage); -void AFX_EXT_API __Rep1(const char * inFileName, int inLineNum, const char * inMessage, unsigned long inArg1); -void AFX_EXT_API __Rep2(const char * inFileName, int inLineNum, const char * inMessage, unsigned long inArg1, unsigned long inArg2); -void AFX_EXT_API GetTowerDirectory(char * outStr); -CString AFX_EXT_API GetTowerDirectory(); -CString AFX_EXT_API LoadString(HINSTANCE inModule, int inID, int inMaxSize); -CString AFX_EXT_API LoadStringTable(HINSTANCE inModule, int inID1, int inID2); -void AFX_EXT_API CopyPalette(LOGPALETTE *inSrc, LOGPALETTE *inDst, int inSrcIndex, int inDstIndex, int inCount); -void AFX_EXT_API WriteMachineProfileString(const char * inKey, const char * inName, const char * inValue); -void AFX_EXT_API WriteMachineProfileInt(const char * inKey, const char * inName, int inValue); -CString AFX_EXT_API GetMachineProfileString(const char * inKey, const char * inName, const char * inDefaultValue); -int AFX_EXT_API GetMachineProfileInt(const char * inKey, const char * inName, int inDefaultValue); - -extern AFX_EXT_DATA T2SoundPlayer *Sounds; -extern AFX_EXT_DATA CT2App *gT2App; -extern AFX_EXT_DATA int gCommonColor[20]; -extern AFX_EXT_DATA BOOL FFEnable; -extern AFX_EXT_DATA DWORD FFBaseForce; -extern AFX_EXT_DATA IDirectInput *FFgpdi; -extern AFX_EXT_DATA IDirectInputDevice2W *FFJoystick; -extern AFX_EXT_DATA IDirectInputEffect *FFBuild; -extern AFX_EXT_DATA IDirectInputEffect *FFStatic; -extern AFX_EXT_DATA T2TowerDoc *g_TowerDoc; +AFX_API_EXPORT char *strtokEx(char * inStr, const char * inSep, char ** ioLast); +AFX_API_EXPORT void InsetRect(RECT * ioRect, int inX, int inY); +AFX_API_EXPORT void SetPt(POINT * outPt, int inX, int inY); +AFX_API_EXPORT HBITMAP Create256DIBitmap(HDC inDC, int inWidth, int inHeight); +AFX_API_EXPORT LOGPALETTE *ConvACTPalette(ACTPALETTEENTRY * inPalette); +AFX_API_EXPORT LOGPALETTE *LoadACTPaletteEntries(HINSTANCE inModule, int inResID); +AFX_API_EXPORT void FFSetStaticForce(int inX, int inY); +AFX_API_EXPORT CString GetInstallSource(); +AFX_API_EXPORT CString GetInstallSourceDrive(); +AFX_API_EXPORT T2TowerDoc *GetCurrentT2TowerDoc(); +AFX_API_EXPORT HINSTANCE GetWorldModuleHandle(); +AFX_API_EXPORT CString GetModuleName(HINSTANCE inModule); +AFX_API_EXPORT unsigned int TickCount(); +AFX_API_EXPORT BOOL DispatchOptionEvent(OPTIONEVENTTYPE inEventType, void * inData); +AFX_API_EXPORT CFile *OpenSubPluginFS(const char * inPath, int inID1, int inID2, SUBPLUGINFSENTRY * outEntry); +AFX_API_EXPORT void __Rep0(const char * inFileName, int inLineNum, const char * inMessage); +AFX_API_EXPORT void __Rep1(const char * inFileName, int inLineNum, const char * inMessage, unsigned long inArg1); +AFX_API_EXPORT void __Rep2(const char * inFileName, int inLineNum, const char * inMessage, unsigned long inArg1, unsigned long inArg2); +AFX_API_EXPORT void GetTowerDirectory(char * outStr); +AFX_API_EXPORT CString GetTowerDirectory(); +AFX_API_EXPORT CString LoadString(HINSTANCE inModule, int inID, int inMaxSize); +AFX_API_EXPORT CString LoadStringTable(HINSTANCE inModule, int inID1, int inID2); +AFX_API_EXPORT void CopyPalette(LOGPALETTE *inSrc, LOGPALETTE *inDst, int inSrcIndex, int inDstIndex, int inCount); +AFX_API_EXPORT void WriteMachineProfileString(const char * inKey, const char * inName, const char * inValue); +AFX_API_EXPORT void WriteMachineProfileInt(const char * inKey, const char * inName, int inValue); +AFX_API_EXPORT CString GetMachineProfileString(const char * inKey, const char * inName, const char * inDefaultValue); +AFX_API_EXPORT int GetMachineProfileInt(const char * inKey, const char * inName, int inDefaultValue); diff --git a/src/T2DLL/LArray.cpp b/src/T2DLL/LArray.cpp index da569e0..53c44ce 100644 --- a/src/T2DLL/LArray.cpp +++ b/src/T2DLL/LArray.cpp @@ -4,8 +4,7 @@ // unknown/assumed name -- not in T2DLL exports! class LDefaultComparator : public LComparator { public: - LDefaultComparator(); - virtual ~LDefaultComparator(); + virtual ~LDefaultComparator() {} virtual int Compare(const void* inItemOne, const void* inItemTwo, unsigned int inSizeOne, unsigned int inSizeTwo) const; virtual BOOL IsEqualTo(const void* inItemOne, const void* inItemTwo, unsigned int inSizeOne, unsigned int inSizeTwo) const; static LDefaultComparator* GetComparator(); @@ -188,65 +187,67 @@ void LArray::SetComparator(LComparator* comparator) { } /*virtual*/ void LArray::ReadAsWord(T2Archive& archive) { + unsigned char flagValue; int itemSize; - int count; - int i; - unsigned char zero; - int totalSize; - unsigned short item; + int itemCount; + int handleSize; + int n; archive >> itemSize; - archive >> count; - archive >> i; - archive >> i; - archive >> zero; - archive >> zero; - archive >> totalSize; + archive >> itemCount; + archive >> n; + archive >> n; + archive >> flagValue; + archive >> flagValue; + archive >> handleSize; if (mItemCount > 0) RemoveItemsAt(mItemCount, 1); - for (i = 0; i < count; i++) { - archive >> item; - unsigned int v = item; + unsigned short theItem; + unsigned int v; + for (n = 0; n < itemCount; n++) { + archive >> theItem; + v = theItem; Add(&v); } - for (; i < totalSize / itemSize; i++) { - archive >> item; + for (; n < handleSize / itemSize; n++) { + archive >> theItem; } } /*virtual*/ void LArray::WriteAsWord(T2Archive& archive) { - int boop = 2; - archive << boop; + int renameThisVarPleaseM = 2; + archive << renameThisVarPleaseM; - boop = mItemCount; - archive << boop; + renameThisVarPleaseM = mItemCount; + archive << renameThisVarPleaseM; - int byteCount = boop * 2; - archive << byteCount; - archive << byteCount; + int dataStored = renameThisVarPleaseM * 2; + archive << dataStored; + archive << dataStored; - unsigned char zero = 0; - archive << zero; + unsigned char flagValue = 0; + archive << flagValue; - zero = 0; - archive << zero; + flagValue = 0; + archive << flagValue; - int totalSize = mItemCount * 2; - archive << totalSize; + int handleSize = mItemCount * 2; + archive << handleSize; LArrayIterator iter(*this); - unsigned int item; - while (iter.Next(&item)) { - unsigned short v = item; - archive << v; + unsigned int v; + unsigned short item; + while (iter.Next(&v)) { + item = v; + archive << item; } } /*virtual*/ void LArray::ReadAsDWord(T2Archive& archive) { - unsigned long code; + DWORD code; archive >> code; #line 261 _ASSERT(code == 'Darr'); @@ -254,11 +255,11 @@ void LArray::SetComparator(LComparator* comparator) { if (mItemCount > 0) RemoveItemsAt(mItemCount, 1); - int count; - archive >> count; + int itemCount; + archive >> itemCount; unsigned int item; - for (int i = 0; i < count; i++) { + for (int i = 0; i < itemCount; i++) { archive >> item; Add(&item); } @@ -268,31 +269,31 @@ void LArray::SetComparator(LComparator* comparator) { if (mItemCount > 0) RemoveItemsAt(mItemCount, 1); + unsigned char v; int i; - int elemSize; - int elemCount; - int byteCount; - int byteCount2; - int totalSize; - unsigned char buf; - - archive >> elemSize; - archive >> elemCount; - archive >> byteCount; - archive >> byteCount2; - archive >> totalSize; - - for (i = 0; i < elemCount; i++) { - archive >> buf; - Add(&buf); + int itemSize; + int itemCount; + int dataStored; + int dataAllocated; + int handleSize; + + archive >> itemSize; + archive >> itemCount; + archive >> dataStored; + archive >> dataAllocated; + archive >> handleSize; + + for (i = 0; i < itemCount; i++) { + archive >> v; + Add(&v); } - for (; i < totalSize; i++) { - archive >> buf; + for (; i < handleSize; i++) { + archive >> v; } } /*virtual*/ void LArray::WriteAsDWord(T2Archive& archive) { - unsigned long code = 'Darr'; + DWORD code = 'Darr'; archive << code; archive << mItemCount; @@ -304,21 +305,21 @@ void LArray::SetComparator(LComparator* comparator) { } /*virtual*/ void LArray::WriteAsChar(T2Archive& archive) { - int elemSize = 1; - int byteCount = mItemCount; - int byteCount2 = byteCount; - int totalSize = byteCount; + unsigned char v; + int itemSize = 1; + int handleSize = mItemCount; + int dataAllocated = handleSize; + int dataStored = dataAllocated; - archive << elemSize; + archive << itemSize; archive << mItemCount; - archive << byteCount; - archive << byteCount2; - archive << totalSize; + archive << dataStored; + archive << dataAllocated; + archive << handleSize; LArrayIterator iter(*this); - unsigned char item; - while (iter.Next(&item)) { - archive << item; + while (iter.Next(&v)) { + archive << v; } } @@ -398,9 +399,3 @@ LDefaultComparator* LDefaultComparator::GetComparator() { sDefaultComparator = new LDefaultComparator; return sDefaultComparator; } - -LDefaultComparator::LDefaultComparator() { -} - -/*virtual*/ LDefaultComparator::~LDefaultComparator() { -} diff --git a/src/T2DLL/LArray.h b/src/T2DLL/LArray.h index 223e6a2..7d259a5 100644 --- a/src/T2DLL/LArray.h +++ b/src/T2DLL/LArray.h @@ -2,7 +2,7 @@ #include "common.h" #include "LComparator.h" -class AFX_EXT_CLASS LArray { +class AFX_CLASS_EXPORT LArray { public: LArray(); LArray(int size, LComparator* comparator = NULL, BOOL keepSorted = false); @@ -39,7 +39,7 @@ protected: BOOL mKeepSorted; }; -class AFX_EXT_CLASS LArrayIterator { +class AFX_CLASS_EXPORT LArrayIterator { public: LArrayIterator(const LArray& array, int index = 1); LArrayIterator(const LArrayIterator& iter); diff --git a/src/T2DLL/LAttachable.cpp b/src/T2DLL/LAttachable.cpp index 9700c4d..31f3aaa 100644 --- a/src/T2DLL/LAttachable.cpp +++ b/src/T2DLL/LAttachable.cpp @@ -48,11 +48,11 @@ LAttachable::LAttachable(const LAttachable& other) { /*virtual*/ void LAttachable::RemoveAllAttachments() { if (mAttachments) { LArrayIterator iter(*mAttachments); - LAttachment *attachment; + LAttachment *theAttachment; - while (iter.Next(&attachment)) { - if (attachment->GetOwnerHost() == this) { - delete attachment; + while (iter.Next(&theAttachment)) { + if (theAttachment->GetOwnerHost() == this) { + delete theAttachment; iter.Reset(); } } @@ -66,10 +66,10 @@ LAttachable::LAttachable(const LAttachable& other) { BOOL result = true; if (mAttachments) { LArrayIterator iter(*mAttachments); - LAttachment *attachment; + LAttachment *theAttachment; - while (iter.Next(&attachment)) { - result = result & attachment->Execute(message, data); + while (iter.Next(&theAttachment)) { + result = result & theAttachment->Execute(message, data); } } return result; diff --git a/src/T2DLL/LAttachable.h b/src/T2DLL/LAttachable.h index 97e2633..58e013d 100644 --- a/src/T2DLL/LAttachable.h +++ b/src/T2DLL/LAttachable.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS LAttachable { +class AFX_CLASS_EXPORT LAttachable { public: LAttachable(); LAttachable(const LAttachable& other); diff --git a/src/T2DLL/LAttachment.h b/src/T2DLL/LAttachment.h index f457808..a352628 100644 --- a/src/T2DLL/LAttachment.h +++ b/src/T2DLL/LAttachment.h @@ -1,23 +1,25 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS LAttachment { +class AFX_CLASS_EXPORT LAttachment { public: LAttachment(unsigned int message = 0, BOOL executeHost = true); virtual ~LAttachment(); + + unsigned int GetMessage() const { return mMessage; } virtual void SetMessage(unsigned int v) { mMessage = v; } + + BOOL GetExecuteHost() const { return mExecuteHost; } virtual void SetExecuteHost(BOOL v); + virtual void SetOwnerHost(LAttachable* v) { mOwnerHost = v; } - virtual int Execute(unsigned int message, void* data); + LAttachable* GetOwnerHost() const { return mOwnerHost; } - LAttachable* GetOwnerHost() const { return mOwnerHost; } - unsigned int GetMessage() const { return mMessage; } - BOOL GetExecuteHost() const { return mExecuteHost; } + virtual BOOL Execute(unsigned int message, void* data); protected: virtual void ExecuteSelf(unsigned int message, void*); -protected: LAttachable *mOwnerHost; unsigned int mMessage; BOOL mExecuteHost; diff --git a/src/T2DLL/LBroadcaster.h b/src/T2DLL/LBroadcaster.h index 2987d54..77a6f70 100644 --- a/src/T2DLL/LBroadcaster.h +++ b/src/T2DLL/LBroadcaster.h @@ -1,8 +1,9 @@ #pragma once +#define DONT_INCLUDE_AFXTEMPL #include "common.h" #include "LArray.h" -class AFX_EXT_CLASS LBroadcaster { +class AFX_CLASS_EXPORT LBroadcaster { public: LBroadcaster(); LBroadcaster(const LBroadcaster& other); diff --git a/src/T2DLL/LComparator.h b/src/T2DLL/LComparator.h index 8f51bd0..3d94996 100644 --- a/src/T2DLL/LComparator.h +++ b/src/T2DLL/LComparator.h @@ -1,4 +1,5 @@ #pragma once +#define DONT_INCLUDE_AFXTEMPL #include "common.h" class LComparator { diff --git a/src/T2DLL/LListener.cpp b/src/T2DLL/LListener.cpp index bb4ca1f..1fa9e83 100644 --- a/src/T2DLL/LListener.cpp +++ b/src/T2DLL/LListener.cpp @@ -10,8 +10,8 @@ LListener::LListener(const LListener& other) { } /*virtual*/ LListener::~LListener() { + LBroadcaster *broadcaster; for (int index = mBroadcasters.GetCount(); index > 0; index--) { - LBroadcaster *broadcaster; if (mBroadcasters.FetchItemAt(index, &broadcaster)) broadcaster->RemoveListener(this); } diff --git a/src/T2DLL/LListener.h b/src/T2DLL/LListener.h index 17ca949..0408b91 100644 --- a/src/T2DLL/LListener.h +++ b/src/T2DLL/LListener.h @@ -2,7 +2,7 @@ #include "common.h" #include "LArray.h" -class AFX_EXT_CLASS LListener { +class AFX_CLASS_EXPORT LListener { public: LListener(); LListener(const LListener& other); diff --git a/src/T2DLL/LPeriodical.h b/src/T2DLL/LPeriodical.h index e686357..7e231a5 100644 --- a/src/T2DLL/LPeriodical.h +++ b/src/T2DLL/LPeriodical.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS LPeriodical { +class AFX_CLASS_EXPORT LPeriodical { public: LPeriodical(); virtual ~LPeriodical(); diff --git a/src/T2DLL/MMIO.h b/src/T2DLL/MMIO.h index b3993fe..dd35683 100644 --- a/src/T2DLL/MMIO.h +++ b/src/T2DLL/MMIO.h @@ -29,7 +29,7 @@ //----------------------------------------------------------------- // CMMChunk Class - Multimedia RIFF Chunk Object //----------------------------------------------------------------- -class AFX_EXT_CLASS CMMChunk : public MMCKINFO +class AFX_CLASS_EXPORT CMMChunk : public MMCKINFO { // Protected Constructor(s)/Destructor protected: @@ -39,7 +39,7 @@ protected: //----------------------------------------------------------------- // CMMIdChunk Class - Multimedia RIFF Id Chunk Object //----------------------------------------------------------------- -class AFX_EXT_CLASS CMMIdChunk : public CMMChunk +class AFX_CLASS_EXPORT CMMIdChunk : public CMMChunk { // Public Constructor(s)/Destructor public: @@ -50,7 +50,7 @@ public: //----------------------------------------------------------------- // CMMTypeChunk Class - Multimedia RIFF Type Chunk Object //----------------------------------------------------------------- -class AFX_EXT_CLASS CMMTypeChunk : public CMMChunk +class AFX_CLASS_EXPORT CMMTypeChunk : public CMMChunk { // Public Constructor(s)/Destructor public: @@ -61,7 +61,7 @@ public: //----------------------------------------------------------------- // CMMIOInfo Class - Multimedia RIFF I/O Info Object //----------------------------------------------------------------- -class AFX_EXT_CLASS CMMIOInfo : public MMIOINFO +class AFX_CLASS_EXPORT CMMIOInfo : public MMIOINFO { // Public Constructor(s)/Destructor public: @@ -71,7 +71,7 @@ public: //----------------------------------------------------------------- // CMMMemoryIOInfo Class - Multimedia RIFF Memory I/O Info Object //----------------------------------------------------------------- -class AFX_EXT_CLASS CMMMemoryIOInfo : public CMMIOInfo +class AFX_CLASS_EXPORT CMMMemoryIOInfo : public CMMIOInfo { // Public Constructor(s)/Destructor public: @@ -83,7 +83,7 @@ public: //----------------------------------------------------------------- // CMMIO Class - Multimedia RIFF I/O Object //----------------------------------------------------------------- -class AFX_EXT_CLASS CMMIO : public CObject +class AFX_CLASS_EXPORT CMMIO : public CObject { // Public Constructor(s)/Destructor public: diff --git a/src/T2DLL/MoverSearchDlg.cpp b/src/T2DLL/MoverSearchDlg.cpp index f6501ed..48dfc31 100644 --- a/src/T2DLL/MoverSearchDlg.cpp +++ b/src/T2DLL/MoverSearchDlg.cpp @@ -9,6 +9,12 @@ #include "T2WorldDef.h" #include "UT2Utils.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + MoverSearchDlg::MoverSearchDlg() { mDeleteOnClose = true; } @@ -29,56 +35,56 @@ void MoverSearchDlg::Create(T2TowerDoc *inDoc, HINSTANCE inInstance, CWnd *inPar } void MoverSearchDlg::DoFind() { - T2DlgItemListBox *theListBox = (T2DlgItemListBox *) GetDlgItem(1000); + T2DlgItemListBox *listBox = (T2DlgItemListBox *) GetDlgItem(1000); - int curSel = theListBox->GetCurSel(); - if (curSel == -1) + int sel = listBox->GetCurSel(); + if (sel == -1) return; - T2Name *theName = (T2Name *) theListBox->GetItemDataPtr(curSel); + T2Name *theName = (T2Name *) listBox->GetItemDataPtr(sel); mDocument->towerDoc_vf238(theName); } void MoverSearchDlg::DoDelete() { - T2DlgItemListBox *theListBox = (T2DlgItemListBox *) GetDlgItem(1000); + T2DlgItemListBox *listBox = (T2DlgItemListBox *) GetDlgItem(1000); - int curSel = theListBox->GetCurSel(); - if (curSel == -1) + int sel = listBox->GetCurSel(); + if (sel == -1) return; - T2Name *theName = (T2Name *) theListBox->GetItemDataPtr(curSel); + T2Name *theName = (T2Name *) listBox->GetItemDataPtr(sel); mDocument->mNameDB->RemoveName(theName); - theListBox->DeleteString(curSel); + listBox->DeleteString(sel); } /*virtual*/ void MoverSearchDlg::OnT2Create() { - T2DlgItemListBox *theListBox = (T2DlgItemListBox *) GetDlgItem(1000); - T2MoverArrayList *theList = mDocument->mFloorInfo->GetMoverArrayList(); + T2DlgItemListBox *listBox = (T2DlgItemListBox *) GetDlgItem(1000); + T2MoverArrayList *theMoverArrayList = mDocument->mFloorInfo->GetMoverArrayList(); - if (!theListBox) + if (!listBox) return; - if (!theList) + if (!theMoverArrayList) return; HFONT theFont = GetFont(); if (theFont) - theListBox->SetFont(theFont); + listBox->SetFont(theFont); - theListBox->ResetContent(); + listBox->ResetContent(); - T2NameList *theNameDB = mDocument->mNameDB; + T2NameList *theNameList = mDocument->mNameDB; T2Name *theName; - LArrayIterator iterator(*theNameDB); + LArrayIterator iter(*theNameList); - while (iterator.Next(&theName)) { + while (iter.Next(&theName)) { int type = theName->GetType(); if (type == kMoverNameType) { - CString nameStr; - unsigned int moverID; - theName->GetName(nameStr, moverID); + CString name; + unsigned int id; + theName->GetName(name, id); - int theIndex = theListBox->AddString(nameStr); - theListBox->SetItemDataPtr(theIndex, theName); + int index = listBox->AddString(name); + listBox->SetItemDataPtr(index, theName); } } } diff --git a/src/T2DLL/PeopleSearchDlg.cpp b/src/T2DLL/PeopleSearchDlg.cpp index 1e73ef2..d7f5277 100644 --- a/src/T2DLL/PeopleSearchDlg.cpp +++ b/src/T2DLL/PeopleSearchDlg.cpp @@ -10,6 +10,12 @@ #include "T2WorldDef.h" #include "UT2Utils.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + PeopleSearchDlg::PeopleSearchDlg() { mDeleteOnClose = true; } @@ -30,72 +36,72 @@ void PeopleSearchDlg::Create(T2TowerDoc *inDoc, HINSTANCE inInstance, CWnd *inPa } void PeopleSearchDlg::DoFind() { - T2DlgItemListBox *theListBox = (T2DlgItemListBox *) GetDlgItem(1000); - if (!theListBox) + T2DlgItemListBox *listBox = (T2DlgItemListBox *) GetDlgItem(1000); + if (!listBox) return; - int curSel = theListBox->GetCurSel(); - if (curSel == -1) + int sel = listBox->GetCurSel(); + if (sel == -1) return; - T2Name *theName = (T2Name *) theListBox->GetItemDataPtr(curSel); + T2Name *theName = (T2Name *) listBox->GetItemDataPtr(sel); mDocument->towerDoc_vf238(theName); } void PeopleSearchDlg::DoDelete() { - T2DlgItemListBox *theListBox = (T2DlgItemListBox *) GetDlgItem(1000); - if (!theListBox) + T2DlgItemListBox *listBox = (T2DlgItemListBox *) GetDlgItem(1000); + if (!listBox) return; - int curSel = theListBox->GetCurSel(); - if (curSel == -1) + int sel = listBox->GetCurSel(); + if (sel == -1) return; - T2Name *theName = (T2Name *) theListBox->GetItemDataPtr(curSel); + T2Name *theName = (T2Name *) listBox->GetItemDataPtr(sel); mDocument->mNameDB->RemoveName(theName); - theListBox->DeleteString(curSel); + listBox->DeleteString(sel); } /*virtual*/ void PeopleSearchDlg::OnT2Create() { - T2DlgItemListBox *theListBox = (T2DlgItemListBox *) GetDlgItem(1000); + T2DlgItemListBox *listBox = (T2DlgItemListBox *) GetDlgItem(1000); - if (!theListBox) + if (!listBox) return; HFONT theFont = GetFont(); if (theFont) - theListBox->SetFont(theFont); + listBox->SetFont(theFont); - theListBox->ResetContent(); + listBox->ResetContent(); - T2NameList *theNameDB = mDocument->mNameDB; + T2NameList *theNameList = mDocument->mNameDB; T2Name *theName; - LArrayIterator iterator(*theNameDB); + LArrayIterator iter(*theNameList); - while (iterator.Next(&theName)) { + while (iter.Next(&theName)) { int type = theName->GetType(); if (type == kPeopleNameType) { - CString nameStr; - unsigned int peopleID; - theName->GetName(nameStr, peopleID); + CString name; + unsigned int id; + theName->GetName(name, id); - T2People *thePeople = mDocument->mPeopleArrayList->FindPeople(peopleID); + T2People *thePeople = mDocument->mPeopleArrayList->FindPeople(id); if (thePeople) { - CString roomNumberStr; - CString str; + CString roomNum; + CString text; if (thePeople->GetWorkTenant() > 1) { T2Tenant *theTenant = mDocument->mFloorInfo->GetTenant(thePeople->GetWorkTenant()); if (theTenant) - UT2Utils::GetRoomNumberString(theTenant->GetRoomNumber(mDocument->mFloorInfo), roomNumberStr); + UT2Utils::GetRoomNumberString(theTenant->GetRoomNumber(mDocument->mFloorInfo), roomNum); } - roomNumberStr += " "; - str = roomNumberStr.Left(7); - str += nameStr; + roomNum += " "; + text = roomNum.Left(7); + text += name; - int theIndex = theListBox->AddString(str); - theListBox->SetItemDataPtr(theIndex, theName); + int ind = listBox->AddString(text); + listBox->SetItemDataPtr(ind, theName); } } } diff --git a/src/T2DLL/SoundDlg.cpp b/src/T2DLL/SoundDlg.cpp index 858f906..20db73d 100644 --- a/src/T2DLL/SoundDlg.cpp +++ b/src/T2DLL/SoundDlg.cpp @@ -8,6 +8,12 @@ #include "T2TowerDoc.h" #include "T2WorldDef.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + SoundDlg::SoundDlg() { mDeleteOnClose = true; } @@ -43,7 +49,7 @@ void SoundDlg::Revert() { } // T2DLL.dll 100DBC20 -static const unsigned int masks[4] = { +static unsigned int masks[4] = { 9, 2, 0x30, 4 }; diff --git a/src/T2DLL/SpeedDlg.cpp b/src/T2DLL/SpeedDlg.cpp index ba623bf..88c0805 100644 --- a/src/T2DLL/SpeedDlg.cpp +++ b/src/T2DLL/SpeedDlg.cpp @@ -6,6 +6,12 @@ #include "T2TowerDoc.h" #include "T2WorldDef.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + SpeedDlg::SpeedDlg() { mDeleteOnClose = true; } @@ -26,7 +32,7 @@ void SpeedDlg::Setup(T2TowerDoc *inDoc, HINSTANCE inInstance, CWnd *inParentWnd, ShowWindow(SW_HIDE); } -static const int speedValues[] = {125, 25, 20, 5, 1}; +static int speedValues[] = {125, 25, 20, 5, 1}; void SpeedDlg::Revert() { T2DlgItem *theRadio; diff --git a/src/T2DLL/T2AdvertisePlugin.h b/src/T2DLL/T2AdvertisePlugin.h index 7775772..f4c3f50 100644 --- a/src/T2DLL/T2AdvertisePlugin.h +++ b/src/T2DLL/T2AdvertisePlugin.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2SubPlugin.h" -class AFX_EXT_CLASS T2AdvertisePlugin : public T2SubPlugin { +class AFX_CLASS_EXPORT T2AdvertisePlugin : public T2SubPlugin { public: T2AdvertisePlugin(DWORD type, T2PluginSpecifier& specifier); virtual ~T2AdvertisePlugin(); diff --git a/src/T2DLL/T2AdvertiseTable.h b/src/T2DLL/T2AdvertiseTable.h index 483df91..ae743b9 100644 --- a/src/T2DLL/T2AdvertiseTable.h +++ b/src/T2DLL/T2AdvertiseTable.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2VerticalTable.h" -class AFX_EXT_CLASS T2AdvertiseTable : public T2VerticalTable { +class AFX_CLASS_EXPORT T2AdvertiseTable : public T2VerticalTable { public: T2AdvertiseTable(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); virtual ~T2AdvertiseTable() {} diff --git a/src/T2DLL/T2Animation.h b/src/T2DLL/T2Animation.h index a7bd371..a397117 100644 --- a/src/T2DLL/T2Animation.h +++ b/src/T2DLL/T2Animation.h @@ -14,7 +14,10 @@ struct SpriteDef { short height; }; -class AFX_EXT_CLASS T2Animation { +class AFX_CLASS_EXPORT T2Animation { +private: + void operator=(const T2Animation &); // no assignment + public: T2Animation(T2TowerDoc* inDoc, short inNumOfFrame, short inNumOfSprite, const SpriteDef* inSpriteDef, const AnimationDef* inAnimationDef, T2Sprite::ELayer inLayer); ~T2Animation(); diff --git a/src/T2DLL/T2Archive.h b/src/T2DLL/T2Archive.h index d387180..cb72f3c 100644 --- a/src/T2DLL/T2Archive.h +++ b/src/T2DLL/T2Archive.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS T2Archive { +class AFX_CLASS_EXPORT T2Archive { public: T2Archive(); virtual ~T2Archive(); diff --git a/src/T2DLL/T2ArrowWnd.cpp b/src/T2DLL/T2ArrowWnd.cpp index 0271881..6c60c08 100644 --- a/src/T2DLL/T2ArrowWnd.cpp +++ b/src/T2DLL/T2ArrowWnd.cpp @@ -3,17 +3,11 @@ #include "T2TowerDoc.h" #include "T2TowerMainView.h" -CObject* PASCAL T2ArrowWnd::CreateObject() { -#line 33 - return DEBUG_NEW T2ArrowWnd; -} -IMPLEMENT_DYNAMIC(T2ArrowWnd, CFrameWnd); - -T2ArrowWnd::T2ArrowWnd() { -} - -/*virtual*/ T2ArrowWnd::~T2ArrowWnd() { -} +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif static POINT rgnPoints[7] = { {20,35}, @@ -25,27 +19,36 @@ static POINT rgnPoints[7] = { {40,15} }; +#line 33 +IMPLEMENT_DYNCREATE(T2ArrowWnd, CFrameWnd); + +T2ArrowWnd::T2ArrowWnd() { +} + +/*virtual*/ T2ArrowWnd::~T2ArrowWnd() { +} + void T2ArrowWnd::Show(int inX, int inY, T2TowerDoc* inDoc) { mWndClass = AfxRegisterWndClass(CS_NOCLOSE, NULL, (HBRUSH) GetStockObject(WHITE_BRUSH)); - CRect rect1(0, 0, 50, 50); - Create(mWndClass, "ArrowWnd", WS_CHILD, rect1, inDoc->GetTowerMainView(), NULL, WS_EX_TOPMOST); + CRect rect(0, 0, 50, 50); + Create(mWndClass, "ArrowWnd", WS_CHILD, rect, inDoc->GetTowerMainView(), NULL, WS_EX_TOPMOST); mRgn.CreatePolygonRgn(rgnPoints, 7, ALTERNATE); - CRect rect2; - GetClientRect(rect2); + CRect clientRect; + GetClientRect(clientRect); - CPoint pt; - pt.x = ((rect1.right - rect1.left) - (rect2.right - rect2.left)) / 2; - pt.y = ((rect1.bottom - rect1.top) - (rect2.bottom - rect2.top)) / 2; + CPoint center; + center.x = ((rect.right - rect.left) - (clientRect.right - clientRect.left)) / 2; + center.y = ((rect.bottom - rect.top) - (clientRect.bottom - clientRect.top)) / 2; - CRgn rgn; - rgn.CreateRectRgn(0, 0, 1, 1); - rgn.CopyRgn(&mRgn); - rgn.OffsetRgn(pt.x, pt.y); - SetWindowRgn(rgn, true); - rgn.Detach(); + CRgn region; + region.CreateRectRgn(0, 0, 1, 1); + region.CopyRgn(&mRgn); + region.OffsetRgn(center.x, center.y); + SetWindowRgn(region, true); + region.Detach(); SetWindowPos(NULL, inX - 20, inY - 45, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); GetCurrentT2TowerDoc()->towerDoc_vf290(true); @@ -67,7 +70,12 @@ afx_msg BOOL T2ArrowWnd::OnEraseBkgnd(CDC* pDC) { CRect rect; GetClientRect(rect); - pDC->FillSolidRect(rect, (mCounter & 1) ? RGB(255, 0, 0) : RGB(255, 255, 0)); + COLORREF bkColor; + if (mCounter & 1) + bkColor = RGB(255, 0, 0); + else + bkColor = RGB(255, 255, 0); + pDC->FillSolidRect(rect, bkColor); CBrush brush; brush.CreateStockObject(BLACK_BRUSH); diff --git a/src/T2DLL/T2ArrowWnd.h b/src/T2DLL/T2ArrowWnd.h index 6c699b6..692d1e0 100644 --- a/src/T2DLL/T2ArrowWnd.h +++ b/src/T2DLL/T2ArrowWnd.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS T2ArrowWnd : public CFrameWnd { +class AFX_CLASS_EXPORT T2ArrowWnd : public CFrameWnd { DECLARE_DYNCREATE(T2ArrowWnd) DECLARE_MESSAGE_MAP() @@ -9,11 +9,12 @@ public: T2ArrowWnd(); virtual ~T2ArrowWnd(); void Show(int inX, int inY, T2TowerDoc* inDoc); - afx_msg BOOL OnEraseBkgnd(CDC* pDC); - afx_msg void OnTimer(UINT nIDEvent); - afx_msg void OnDestroy(); protected: + afx_msg BOOL OnEraseBkgnd(CDC* pDC); + afx_msg void OnTimer(UINT nIDEvent); + afx_msg void OnDestroy(); + CString mWndClass; CRgn mRgn; unsigned short mCounter; diff --git a/src/T2DLL/T2Balloon.cpp b/src/T2DLL/T2Balloon.cpp index d8815da..2fe2ef0 100644 --- a/src/T2DLL/T2Balloon.cpp +++ b/src/T2DLL/T2Balloon.cpp @@ -8,6 +8,12 @@ #include "T2WorldDef.h" #include "UT2Coordinate.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + T2Balloon::T2Balloon() { mImage = NULL; mImageObj = NULL; @@ -191,7 +197,7 @@ void T2Balloon::Show(int inX, int inY, const CString& inText, BOOL inDoPause) { rect8.right = ((rect5.Width() + 3) / 4) * 4; #line 201 - mImage = DEBUG_NEW T2BitImage(rect8); + mImage = new T2BitImage(rect8); mImage->Clear(0); CPalette *thePalette = GetCurrentT2TowerDoc()->towerDoc_vf170()->GetPalette(); @@ -226,7 +232,7 @@ void T2Balloon::Show(int inX, int inY, const CString& inText, BOOL inDoPause) { DeleteObject(dib); #line 233 - mImageObj = DEBUG_NEW T2ImageObj; + mImageObj = new T2ImageObj; mImageObj->AddObject("BAL", 0, *mImage, rect8, true, false); T2Sprite *theSprite = &GetCurrentT2TowerDoc()->mSprite; diff --git a/src/T2DLL/T2Balloon.h b/src/T2DLL/T2Balloon.h index 6b0d17c..2064857 100644 --- a/src/T2DLL/T2Balloon.h +++ b/src/T2DLL/T2Balloon.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS T2Balloon { +class AFX_CLASS_EXPORT T2Balloon { public: T2Balloon(); virtual ~T2Balloon(); diff --git a/src/T2DLL/T2BalloonWnd.cpp b/src/T2DLL/T2BalloonWnd.cpp index df8285f..c995100 100644 --- a/src/T2DLL/T2BalloonWnd.cpp +++ b/src/T2DLL/T2BalloonWnd.cpp @@ -3,11 +3,13 @@ #include "T2TowerDoc.h" #include "T2TowerMainView.h" -CObject* PASCAL T2BalloonWnd::CreateObject() { -#line 16 - return DEBUG_NEW T2BalloonWnd; -} -IMPLEMENT_DYNAMIC(T2BalloonWnd, CFrameWnd); +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +IMPLEMENT_DYNCREATE(T2BalloonWnd, CFrameWnd); T2BalloonWnd::T2BalloonWnd() { mVisible = false; diff --git a/src/T2DLL/T2BalloonWnd.h b/src/T2DLL/T2BalloonWnd.h index b69302e..9389a43 100644 --- a/src/T2DLL/T2BalloonWnd.h +++ b/src/T2DLL/T2BalloonWnd.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS T2BalloonWnd : public CFrameWnd { +class AFX_CLASS_EXPORT T2BalloonWnd : public CFrameWnd { DECLARE_DYNCREATE(T2BalloonWnd) DECLARE_MESSAGE_MAP() diff --git a/src/T2DLL/T2BitImage.cpp b/src/T2DLL/T2BitImage.cpp index ea00253..93bd6f8 100644 --- a/src/T2DLL/T2BitImage.cpp +++ b/src/T2DLL/T2BitImage.cpp @@ -1,6 +1,12 @@ #include "GlobalFunc.h" #include "T2BitImage.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + #define ALIGN_ROW_SIZE(s) ((((s) + 3) / 4) * 4) T2BitImage::T2BitImage(const char* path, unsigned int id, BOOL flip) { @@ -12,15 +18,15 @@ T2BitImage::T2BitImage(const char* path, unsigned int id, BOOL flip) { CString idStr; idStr.Format("%d", id); - CString err = "T2BitImage::T2BitImage ERROR : " + idStr + " @" + path + "\n"; - OutputDebugString(err); + CString error = "T2BitImage::T2BitImage ERROR : " + idStr + " @" + path + "\n"; + OutputDebugString(error); throw 0; } - void *data = malloc(fsEntry.spfse_mC); - file->Read(data, fsEntry.spfse_mC); - SetupBitmap((BITMAPINFO *) data, flip); - free(data); + void *buffer = malloc(fsEntry.spfse_mC); + file->Read(buffer, fsEntry.spfse_mC); + SetupBitmap((BITMAPINFO *) buffer, flip); + free(buffer); file->Close(); delete file; @@ -29,21 +35,21 @@ T2BitImage::T2BitImage(const char* path, unsigned int id, BOOL flip) { T2BitImage::T2BitImage(HINSTANCE instance, unsigned int id, BOOL flip) { mMemHandle = NULL; - HRSRC rsrc = FindResource(instance, MAKEINTRESOURCE(id), MAKEINTRESOURCE(2)); - if (!rsrc) { + HRSRC theRsrc = FindResource(instance, MAKEINTRESOURCE(id), MAKEINTRESOURCE(2)); + if (!theRsrc) { CString idStr; idStr.Format("%d", id); - CString err = "T2BitImage::T2BitImage ERROR : " + idStr + " @" + GetModuleName(instance) + "\n"; - OutputDebugString(err); + CString error = "T2BitImage::T2BitImage ERROR : " + idStr + " @" + GetModuleName(instance) + "\n"; + OutputDebugString(error); throw 0; } - HGLOBAL h = LoadResource(instance, rsrc); - void *data = LockResource(h); - SetupBitmap((BITMAPINFO *) data, flip); - UnlockResource(h); - FreeResource(rsrc); + HGLOBAL theHandle = LoadResource(instance, theRsrc); + void *buffer = LockResource(theHandle); + SetupBitmap((BITMAPINFO *) buffer, flip); + UnlockResource(theHandle); + FreeResource(theHandle); } void T2BitImage::SetupBitmap(BITMAPINFO* info, BOOL flip) { @@ -63,13 +69,13 @@ void T2BitImage::SetupBitmap(BITMAPINFO* info, BOOL flip) { memcpy(mData, info->bmiColors + colorCount, dataSize); if (flip) { - int rowSize = ALIGN_ROW_SIZE(mBitmap.header.biWidth); - void *tmp = malloc(rowSize); + int stride = ALIGN_ROW_SIZE(mBitmap.header.biWidth); + void *tmp = malloc(stride); for (int y = 0; y < mBitmap.header.biHeight / 2; y++) { int otherY = mBitmap.header.biHeight - y - 1; - memcpy(tmp, mData + y * rowSize, rowSize); - memcpy(mData + y * rowSize, mData + otherY * rowSize, rowSize); - memcpy(mData + otherY * rowSize, tmp, rowSize); + memcpy(tmp, mData + y * stride, stride); + memcpy(mData + y * stride, mData + otherY * stride, stride); + memcpy(mData + otherY * stride, tmp, stride); } free(tmp); } @@ -83,16 +89,16 @@ void T2BitImage::SetupBitmap(BITMAPINFO* info, BOOL flip) { } T2BitImage::T2BitImage(const RECT& rect) { - int w = rect.right - rect.left; - int h = rect.bottom - rect.top; + int theRectW = rect.right - rect.left; + int theRectH = rect.bottom - rect.top; memset(&mBitmap.header, 0, sizeof(mBitmap.header)); mBitmap.header.biSize = sizeof(mBitmap.header); - mBitmap.header.biWidth = w; - mBitmap.header.biHeight = h; + mBitmap.header.biWidth = theRectW; + mBitmap.header.biHeight = theRectH; mBitmap.header.biPlanes = 1; mBitmap.header.biBitCount = 8; - mBitmap.header.biSizeImage = ALIGN_ROW_SIZE(w) * h; + mBitmap.header.biSizeImage = ALIGN_ROW_SIZE(theRectW) * theRectH; mBitmap.header.biClrUsed = 256; for (int i = 0; i < 256; i++) @@ -124,6 +130,7 @@ void T2BitImage::EndDrawing() { } void T2BitImage::CopyImage(T2BitImage& destImg, const RECT& inSrc, const RECT& inDest, int, CRgn* rgn) { +#pragma var_order(rect2, backGndColor, yAdjust, foreGndColor, clipDest, width, destY, clipSrc, destX, xAdjust, halftoneMode, height, srcX, dest, destRowSize, srcY, align, srcP, destP, srcRowSize, src) RECT src; src.top = inSrc.top; src.left = inSrc.left; @@ -158,7 +165,9 @@ void T2BitImage::CopyImage(T2BitImage& destImg, const RECT& inSrc, const RECT& i align = 16; // Y scale *4 } else { CString err; - err.Format("•s³‚ÈŠg‘åk¬—¦\nSrc(%d,%d),Dest(%d,%d)", dest.top, dest.bottom, src.top, src.bottom); + // "ä¸æ£ãªæ‹¡å¤§ç¸®å°çŽ‡\nSrc(%d,%d),Dest(%d,%d)" + // Incorrect scaling factor + err.Format("\x95\x73\x90\xB3\x82\xC8\x8A\x67\x91\xE5\x8F\x6B\x8F\xAC\x97\xA6\n\x53\x72\x63\x28\x25\x64\x2C\x25\x64\x29\x2C\x44\x65\x73\x74\x28\x25\x64\x2C\x25\x64\x29", dest.top, dest.bottom, src.top, src.bottom); #line 183 __Rep0(__FILE__, __LINE__, err); } @@ -168,7 +177,9 @@ void T2BitImage::CopyImage(T2BitImage& destImg, const RECT& inSrc, const RECT& i ((src.bottom - src.top) != (((dest.bottom - dest.top) * align) / 4)) ) { CString err; - err.Format("•s³‚ÈŠg‘åk¬—¦\nSrc(%d,%d),Dest(%d,%d)", dest.top, dest.bottom, src.top, src.bottom); + // "ä¸æ£ãªæ‹¡å¤§ç¸®å°çŽ‡\nSrc(%d,%d),Dest(%d,%d)" + // Incorrect scaling factor + err.Format("\x95\x73\x90\xB3\x82\xC8\x8A\x67\x91\xE5\x8F\x6B\x8F\xAC\x97\xA6\n\x53\x72\x63\x28\x25\x64\x2C\x25\x64\x29\x2C\x44\x65\x73\x74\x28\x25\x64\x2C\x25\x64\x29", dest.top, dest.bottom, src.top, src.bottom); #line 190 __Rep0(__FILE__, __LINE__, err); } @@ -402,7 +413,7 @@ void T2BitImage::CopyImage(T2BitImage& destImg, const RECT& inSrc, const RECT& i jle simple8_rowDone mov al, [esi] mov [edi], al - add esi, 4 + add esi, 2 inc edi dec edx jmp simple8_innerLoop @@ -863,6 +874,7 @@ void T2BitImage::CopyImage(T2BitImage& destImg, const RECT& inSrc, const RECT& i } void T2BitImage::CopyImage(CDC* dc, const RECT& inSrc, const RECT& inDest, int, CRgn*) { +#pragma var_order(tmp, bmp, dest, diffY, diffX, src) RECT src; src.top = inSrc.top; src.left = inSrc.left; @@ -886,8 +898,8 @@ void T2BitImage::CopyImage(CDC* dc, const RECT& inSrc, const RECT& inDest, int, RECT tmp; tmp.top = 0; tmp.left = 0; - tmp.right = mBitmap.header.biWidth; tmp.bottom = mBitmap.header.biHeight; + tmp.right = mBitmap.header.biWidth; if (tmp.top > tmp.bottom) { int save = tmp.top; @@ -994,6 +1006,7 @@ void T2BitImage::DrawFocusLine(int x1, int y1, int x2, int y2) { y2 = tmp; } +#pragma var_order(p, rowSize, counter) int rowSize = ALIGN_ROW_SIZE(mBitmap.header.biWidth); int counter = 0; unsigned char *p = mData + y1 * rowSize + x1; @@ -1033,6 +1046,7 @@ void T2BitImage::FillMesh(RECT rect, int c) { IntersectRect(&rect, &rect, &bitmapRect); if (!IsRectEmpty(&rect)) { +#pragma var_order(cByte, width, rowSize, p, height, parity) unsigned char parity = rect.left + rect.top; int rowSize = ALIGN_ROW_SIZE(mBitmap.header.biWidth); unsigned char *p = mData + rect.top * rowSize + rect.left; @@ -1085,6 +1099,7 @@ void T2BitImage::FillRect(RECT rect, int c) { IntersectRect(&rect, &rect, &bitmapRect); if (!IsRectEmpty(&rect)) { +#pragma var_order(cByte, width, rowSize, p, height) int rowSize = ALIGN_ROW_SIZE(mBitmap.header.biWidth); unsigned char *p = mData + rect.top * rowSize + rect.left; int width = rect.right - rect.left; @@ -1136,7 +1151,7 @@ int T2BitImage::GetPixel(const POINT& pt) { void T2BitImage::DrawFrameRect(RECT rect, int c) { OffsetRect(&rect, -mOrigin.x, -mOrigin.y); - RECT bitmapRect; + RECT intersectRect, bitmapRect; SetRect(&bitmapRect, 0, 0, mBitmap.header.biWidth, mBitmap.header.biHeight); if (mHasClipRect) { @@ -1145,17 +1160,16 @@ void T2BitImage::DrawFrameRect(RECT rect, int c) { IntersectRect(&bitmapRect, &bitmapRect, &clipRect); } - RECT frameRect; - IntersectRect(&frameRect, &rect, &bitmapRect); - if (!IsRectEmpty(&frameRect)) { - if (frameRect.top == rect.top) - DrawFrameLine(frameRect.left, frameRect.top, frameRect.right, frameRect.top, c); - if (frameRect.left == rect.left) - DrawFrameLine(frameRect.left, frameRect.top, frameRect.left, frameRect.bottom, c); - if (frameRect.bottom == rect.bottom) - DrawFrameLine(frameRect.left, frameRect.bottom - 1, frameRect.right, frameRect.bottom - 1, c); - if (frameRect.right == rect.right) - DrawFrameLine(frameRect.right - 1, frameRect.top, frameRect.right - 1, frameRect.bottom, c); + IntersectRect(&intersectRect, &rect, &bitmapRect); + if (!IsRectEmpty(&intersectRect)) { + if (intersectRect.top == rect.top) + DrawFrameLine(intersectRect.left, intersectRect.top, intersectRect.right, intersectRect.top, c); + if (intersectRect.left == rect.left) + DrawFrameLine(intersectRect.left, intersectRect.top, intersectRect.left, intersectRect.bottom, c); + if (intersectRect.bottom == rect.bottom) + DrawFrameLine(intersectRect.left, intersectRect.bottom - 1, intersectRect.right, intersectRect.bottom - 1, c); + if (intersectRect.right == rect.right) + DrawFrameLine(intersectRect.right - 1, intersectRect.top, intersectRect.right - 1, intersectRect.bottom, c); } } @@ -1168,6 +1182,7 @@ void T2BitImage::DrawFrameLine(int x1, int y1, int x2, int y2, int c) { y2 = tmp; } +#pragma var_order(cByte, rowSize, p, count) int rowSize = ALIGN_ROW_SIZE(mBitmap.header.biWidth); unsigned char *p = mData + y1 * rowSize + x1; int count = y2 - y1; @@ -1199,6 +1214,7 @@ void T2BitImage::DrawFrameLine(int x1, int y1, int x2, int y2, int c) { x2 = tmp; } +#pragma var_order(cByte, count, rowSize, p) int rowSize = ALIGN_ROW_SIZE(mBitmap.header.biWidth); unsigned char *p = mData + y1 * rowSize + x1; int count = x2 - x1; diff --git a/src/T2DLL/T2BitImage.h b/src/T2DLL/T2BitImage.h index 8486bda..11e143d 100644 --- a/src/T2DLL/T2BitImage.h +++ b/src/T2DLL/T2BitImage.h @@ -7,7 +7,7 @@ struct Bitmap { short palette[256]; }; -class AFX_EXT_CLASS T2BitImage { +class AFX_CLASS_EXPORT T2BitImage { public: T2BitImage(const char* path, unsigned int id, BOOL flip); T2BitImage(HINSTANCE path, unsigned int id, BOOL flip); diff --git a/src/T2DLL/T2BlackOut.cpp b/src/T2DLL/T2BlackOut.cpp index 7194f16..c3b69a8 100644 --- a/src/T2DLL/T2BlackOut.cpp +++ b/src/T2DLL/T2BlackOut.cpp @@ -30,6 +30,8 @@ T2BlackOut::T2BlackOut(T2TowerEvent* inTowerEvent, CResFile* inResFile, int inSu /*virtual*/ T2BlackOut::~T2BlackOut() { } +static int anims[] = {2, 8400, 8401}; + /*virtual*/ BOOL T2BlackOut::Start(T2TowerDoc* inDoc) { mStatus = kBlackOutStatus0; diff --git a/src/T2DLL/T2BlackOut.h b/src/T2DLL/T2BlackOut.h index 14f3709..5879656 100644 --- a/src/T2DLL/T2BlackOut.h +++ b/src/T2DLL/T2BlackOut.h @@ -13,7 +13,7 @@ enum { kBlackOutStatus4 = 4 }; -class AFX_EXT_CLASS T2BlackOut : public T2EventItem { +class AFX_CLASS_EXPORT T2BlackOut : public T2EventItem { public: T2BlackOut(T2TowerEvent* inTowerEvent, CResFile* inResFile, int inSubID); virtual ~T2BlackOut(); diff --git a/src/T2DLL/T2ClassFactory.h b/src/T2DLL/T2ClassFactory.h index bd88d4f..b552853 100644 --- a/src/T2DLL/T2ClassFactory.h +++ b/src/T2DLL/T2ClassFactory.h @@ -7,7 +7,7 @@ struct CLASSFACTORY_CLASSINFO { void *newFunc; }; -class AFX_EXT_CLASS T2ClassFactory { +class AFX_CLASS_EXPORT T2ClassFactory { public: static void Initialize(); static void Discard(); diff --git a/src/T2DLL/T2CrossEquipArray.h b/src/T2DLL/T2CrossEquipArray.h index 870d994..f14aa9e 100644 --- a/src/T2DLL/T2CrossEquipArray.h +++ b/src/T2DLL/T2CrossEquipArray.h @@ -2,7 +2,7 @@ #include "common.h" #include "LArray.h" -class AFX_EXT_CLASS T2CrossEquipArray : public LArray { +class AFX_CLASS_EXPORT T2CrossEquipArray : public LArray { public: T2CrossEquipArray(); virtual ~T2CrossEquipArray(); diff --git a/src/T2DLL/T2CustomerTableIterator.h b/src/T2DLL/T2CustomerTableIterator.h index 57c804e..2d17857 100644 --- a/src/T2DLL/T2CustomerTableIterator.h +++ b/src/T2DLL/T2CustomerTableIterator.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS T2CustomerTableIterator { +class AFX_CLASS_EXPORT T2CustomerTableIterator { public: T2CustomerTableIterator(const T2TenantMemberTableDef* inTable); ~T2CustomerTableIterator(); diff --git a/src/T2DLL/T2DLL.cpp b/src/T2DLL/T2DLL.cpp new file mode 100644 index 0000000..9e270be --- /dev/null +++ b/src/T2DLL/T2DLL.cpp @@ -0,0 +1,31 @@ +#include "T2DLL.h" + +AFX_DATA_EXPORT int kBlackColor = 255; +AFX_DATA_EXPORT int kStressFirstColor = 19; +AFX_DATA_EXPORT int kStressMiddleColor = 22; +AFX_DATA_EXPORT int kStressMuchColor = 27; +AFX_DATA_EXPORT int kWaitBlinkColor = 27; + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +BEGIN_MESSAGE_MAP(T2DLLApp, CWinApp) +END_MESSAGE_MAP() + +T2DLLApp::T2DLLApp() { +} + +T2DLLApp theApp; +T2SoundPlayer *Sounds; +CT2App *gT2App; +int gCommonColor[20]; +BOOL FFEnable = 0; +DWORD FFBaseForce = 0; +IDirectInput *FFgpdi = NULL; +IDirectInputDevice2 *FFJoystick = NULL; +IDirectInputEffect *FFBuild = NULL; +IDirectInputEffect *FFStatic = NULL; +T2TowerDoc *g_TowerDoc = NULL; diff --git a/src/T2DLL/T2DLL.h b/src/T2DLL/T2DLL.h new file mode 100644 index 0000000..c88e1c7 --- /dev/null +++ b/src/T2DLL/T2DLL.h @@ -0,0 +1,20 @@ +#pragma once +#include "common.h" + +class T2DLLApp : public CWinApp { +public: + T2DLLApp(); + + DECLARE_MESSAGE_MAP() +}; + +extern AFX_DATA_EXPORT T2SoundPlayer *Sounds; +extern AFX_DATA_EXPORT CT2App *gT2App; +extern AFX_DATA_EXPORT int gCommonColor[20]; +extern AFX_DATA_EXPORT BOOL FFEnable; +extern AFX_DATA_EXPORT DWORD FFBaseForce; +extern AFX_DATA_EXPORT IDirectInput *FFgpdi; +extern AFX_DATA_EXPORT IDirectInputDevice2 *FFJoystick; +extern AFX_DATA_EXPORT IDirectInputEffect *FFBuild; +extern AFX_DATA_EXPORT IDirectInputEffect *FFStatic; +extern AFX_DATA_EXPORT T2TowerDoc *g_TowerDoc; diff --git a/src/T2DLL/T2DateTime.cpp b/src/T2DLL/T2DateTime.cpp index 023fb98..9938e93 100644 --- a/src/T2DLL/T2DateTime.cpp +++ b/src/T2DLL/T2DateTime.cpp @@ -1,5 +1,7 @@ #include "T2Archive.h" #include "T2DateTime.h" +#include "T2TowerDoc.h" +#include "T2WorldPlugin.h" T2DateTime::T2DateTime() { mYear = 0; @@ -100,20 +102,20 @@ BOOL T2DateTime::WithinHour(int a, int b) const { } BOOL T2DateTime::WithinMinutes(int a, int b) const { - BOOL ret = true; + BOOL isWithin = true; - int minA = AdjustMinutes(a); - int minB = AdjustMinutes(b); + int minL = AdjustMinutes(a); + int minR = AdjustMinutes(b); - if (minA < minB) { - if ((mRawMinutes < minA) || (mRawMinutes >= minB)) - ret = false; - } else if (minA > minB) { - if ((mRawMinutes >= minB) && (mRawMinutes < minA)) - ret = false; + if (minL < minR) { + if ((mRawMinutes < minL) || (mRawMinutes >= minR)) + isWithin = false; + } else if (minL > minR) { + if ((mRawMinutes >= minR) && (mRawMinutes < minL)) + isWithin = false; } - return ret; + return isWithin; } int T2DateTime::AdjustMinutes(int m) const { @@ -137,8 +139,8 @@ int T2DateTime::AdjustMinutes(int m) const { } BOOL T2DateTime::IsHoliday(T2TowerDoc* doc) { - // TODO virt - return false; + T2WorldPlugin *thePlugin = doc->mWorldPlugin; + return thePlugin->IsHoliday(this); } void T2DateTime::Validate() { diff --git a/src/T2DLL/T2DateTime.h b/src/T2DLL/T2DateTime.h index faf02fe..7104fe9 100644 --- a/src/T2DLL/T2DateTime.h +++ b/src/T2DLL/T2DateTime.h @@ -1,11 +1,18 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS T2DateTime { +class AFX_CLASS_EXPORT T2DateTime { public: T2DateTime(); T2DateTime(int year, int month, int hours, int minutes, int seconds); T2DateTime(T2Archive& archive); + T2DateTime(const T2DateTime &other) + : mYear(other.mYear) + , mMonth(other.mMonth) + , mRawMinutes(other.mRawMinutes) + , mSeconds(other.mSeconds) + {} + virtual ~T2DateTime(); virtual void Write(T2Archive& archive); diff --git a/src/T2DLL/T2DayLightFilter.h b/src/T2DLL/T2DayLightFilter.h index d0ca924..d64577a 100644 --- a/src/T2DLL/T2DayLightFilter.h +++ b/src/T2DLL/T2DayLightFilter.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS T2DayLightFilter { +class AFX_CLASS_EXPORT T2DayLightFilter { public: T2DayLightFilter(); ~T2DayLightFilter(); diff --git a/src/T2DLL/T2DayParamDef.cpp b/src/T2DLL/T2DayParamDef.cpp index 889b0c9..656479d 100644 --- a/src/T2DLL/T2DayParamDef.cpp +++ b/src/T2DLL/T2DayParamDef.cpp @@ -2,12 +2,12 @@ #include "T2DayParamDef.h" T2DayParamDef::T2DayParamDef(CResFile& resFile) { - float divisor = 100.0f; + float div = 100.0f; for (unsigned int day = 0; day < kMaxDay; day++) { for (unsigned int whether = 0; whether < kMaxWhether; whether++) { resFile >> mEntries[day][whether].mPercent; - mEntries[day][whether].mRate = mEntries[day][whether].mPercent / divisor; + mEntries[day][whether].mRate = mEntries[day][whether].mPercent / div; } } } diff --git a/src/T2DLL/T2DayParamDef.h b/src/T2DLL/T2DayParamDef.h index 02007cb..6e9b473 100644 --- a/src/T2DLL/T2DayParamDef.h +++ b/src/T2DLL/T2DayParamDef.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS T2DayParamDef { +class AFX_CLASS_EXPORT T2DayParamDef { public: enum EDay { Day_0, @@ -17,12 +17,8 @@ public: T2DayParamDef(CResFile&); virtual ~T2DayParamDef(); - unsigned int GetPercent(EDay day, EWhether whether) const { - return mEntries[day][whether].mPercent; - } - float GetRate(EDay day, EWhether whether) const { - return mEntries[day][whether].mRate; - } + unsigned int GetPercent(EDay day, EWhether whether) const; + float GetRate(EDay day, EWhether whether) const; protected: struct { @@ -30,3 +26,11 @@ protected: float mRate; } mEntries[kMaxDay][kMaxWhether]; }; + +inline unsigned int T2DayParamDef::GetPercent(EDay day, EWhether whether) const { + return mEntries[day][whether].mPercent; +} + +inline float T2DayParamDef::GetRate(EDay day, EWhether whether) const { + return mEntries[day][whether].mRate; +} diff --git a/src/T2DLL/T2Dialog.cpp b/src/T2DLL/T2Dialog.cpp index f990466..d240f07 100644 --- a/src/T2DLL/T2Dialog.cpp +++ b/src/T2DLL/T2Dialog.cpp @@ -1,44 +1,32 @@ -#include "CToggleButtonDisabled.h" -#include "CTokenizer.h" #include "T2AdvertiseTable.h" #include "T2Dialog.h" -#include "T2DlgItem.h" #include "T2DlgItemAnimation.h" #include "T2DlgItemArrows.h" -#include "T2DlgItemBelongGage.h" -#include "T2DlgItemBox.h" -#include "T2DlgItemCANCEL.h" -#include "T2DlgItemCheck.h" -#include "T2DlgItemCustomerGage.h" #include "T2DlgItemEdit.h" -#include "T2DlgItemHScr.h" #include "T2DlgItemIButton.h" #include "T2DlgItemICheck.h" #include "T2DlgItemIRepeater.h" -#include "T2DlgItemImage.h" #include "T2DlgItemListBox.h" #include "T2DlgItemMerchandiseField.h" #include "T2DlgItemMovie.h" -#include "T2DlgItemOK.h" -#include "T2DlgItemPPLEvalGage.h" #include "T2DlgItemPeopleView.h" #include "T2DlgItemPopup.h" -#include "T2DlgItemProfitsGage.h" #include "T2DlgItemProgress.h" #include "T2DlgItemRadioButton.h" #include "T2DlgItemRadioText.h" #include "T2DlgItemSTimeTbl.h" -#include "T2DlgItemStressGage.h" -#include "T2DlgItemTButton.h" -#include "T2DlgItemTable.h" -#include "T2DlgItemText.h" -#include "T2DlgItemVScr.h" -#include "T2MovieTable.h" #include "T2PluginInfoTable.h" #include "T2TowerDoc.h" #include "T2WorldDef.h" -IMPLEMENT_DYNAMIC(T2Dialog, CWnd) +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +#line 19 +IMPLEMENT_DYNCREATE(T2Dialog, CWnd) T2Dialog::T2Dialog() { mInModalLoop = false; @@ -243,7 +231,7 @@ void T2Dialog::CreateDlgItemLoop(T2DialogDef& def, char* data) { if (i == 10) { mFontNums[mFontCount] = fontNum; #line 228 - mFonts[mFontCount] = DEBUG_NEW CFont; + mFonts[mFontCount] = new CFont; CString str; if (mFontName[0] == '!') { @@ -271,7 +259,7 @@ void T2Dialog::CreateDlgItemLoop(T2DialogDef& def, char* data) { rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); #line 263 - T2DlgItemOK *item = DEBUG_NEW T2DlgItemOK(mTowerDoc, mImageObj, mPalette); + T2DlgItemOK *item = new T2DlgItemOK(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags, rect, this, 1); item->CreateSubItem(NULL); if (mCurrentFont >= 0) @@ -281,7 +269,7 @@ void T2Dialog::CreateDlgItemLoop(T2DialogDef& def, char* data) { rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); #line 274 - T2DlgItemCANCEL *item = DEBUG_NEW T2DlgItemCANCEL(mTowerDoc, mImageObj, mPalette); + T2DlgItemCANCEL *item = new T2DlgItemCANCEL(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags, rect, this, 2); item->CreateSubItem(NULL); if (mCurrentFont >= 0) @@ -295,7 +283,7 @@ void T2Dialog::CreateDlgItemLoop(T2DialogDef& def, char* data) { rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 289 - T2DlgItemTButton *item = DEBUG_NEW T2DlgItemTButton(mTowerDoc, mImageObj, mPalette); + T2DlgItemTButton *item = new T2DlgItemTButton(mTowerDoc, mImageObj, mPalette); item->Create(text, inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) @@ -309,7 +297,7 @@ void T2Dialog::CreateDlgItemLoop(T2DialogDef& def, char* data) { rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 304 - T2DlgItemIButton *item = DEBUG_NEW T2DlgItemIButton(mTowerDoc, mImageObj, mPalette); + T2DlgItemIButton *item = new T2DlgItemIButton(mTowerDoc, mImageObj, mPalette); item->Create(text, inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) @@ -320,19 +308,19 @@ void T2Dialog::CreateDlgItemLoop(T2DialogDef& def, char* data) { rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); #line 316 - T2DlgItemCheck *item = DEBUG_NEW T2DlgItemCheck(mTowerDoc, mImageObj, mPalette); + T2DlgItemCheck *item = new T2DlgItemCheck(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) item->SetFont(*mFonts[mCurrentFont]); - } else if (!_stricmp(token, "IBUTTON")) { + } else if (!_stricmp(token, "ICHECK")) { UINT id = inTokenizer.NextInteger(); CString text = inTokenizer.NextString(); RECT rect; rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); #line 329 - T2DlgItemICheck *item = DEBUG_NEW T2DlgItemICheck(mTowerDoc, mImageObj, mPalette); + T2DlgItemICheck *item = new T2DlgItemICheck(mTowerDoc, mImageObj, mPalette); item->Create(text, inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) @@ -346,7 +334,7 @@ void T2Dialog::CreateDlgItemLoop(T2DialogDef& def, char* data) { rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 344 - T2DlgItemIRepeater *item = DEBUG_NEW T2DlgItemIRepeater(mTowerDoc, mImageObj, mPalette); + T2DlgItemIRepeater *item = new T2DlgItemIRepeater(mTowerDoc, mImageObj, mPalette); item->Create(text, inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) @@ -358,7 +346,7 @@ void T2Dialog::CreateDlgItemLoop(T2DialogDef& def, char* data) { rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); #line 357 - T2DlgItemRadioButton *item = DEBUG_NEW T2DlgItemRadioButton(mTowerDoc, mImageObj, mPalette); + T2DlgItemRadioButton *item = new T2DlgItemRadioButton(mTowerDoc, mImageObj, mPalette); item->Create(text, inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) @@ -372,7 +360,7 @@ void T2Dialog::CreateDlgItemLoop(T2DialogDef& def, char* data) { rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 371 - T2DlgItemRadioText *item = DEBUG_NEW T2DlgItemRadioText(mTowerDoc, mImageObj, mPalette); + T2DlgItemRadioText *item = new T2DlgItemRadioText(mTowerDoc, mImageObj, mPalette); item->Create(text, inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) @@ -386,7 +374,7 @@ void T2Dialog::CreateDlgItemLoop(T2DialogDef& def, char* data) { rect.bottom = inTokenizer.NextInteger(); int maxChars = inTokenizer.NextInteger(); #line 386 - T2DlgItemEdit *item = DEBUG_NEW T2DlgItemEdit(mTowerDoc, mImageObj, mPalette); + T2DlgItemEdit *item = new T2DlgItemEdit(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags | WS_CLIPCHILDREN, rect, this, id); item->CreateSubItem(&maxChars); if (mCurrentFont >= 0) @@ -399,7 +387,7 @@ void T2Dialog::CreateDlgItemLoop(T2DialogDef& def, char* data) { rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 400 - T2DlgItemHScr *item = DEBUG_NEW T2DlgItemHScr(mTowerDoc, mImageObj, mPalette); + T2DlgItemHScr *item = new T2DlgItemHScr(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) @@ -412,7 +400,7 @@ void T2Dialog::CreateDlgItemLoop(T2DialogDef& def, char* data) { rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 414 - T2DlgItemVScr *item = DEBUG_NEW T2DlgItemVScr(mTowerDoc, mImageObj, mPalette); + T2DlgItemVScr *item = new T2DlgItemVScr(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) @@ -425,7 +413,7 @@ void T2Dialog::CreateDlgItemLoop(T2DialogDef& def, char* data) { rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 428 - T2DlgItemBox *item = DEBUG_NEW T2DlgItemBox(mTowerDoc, mImageObj, mPalette); + T2DlgItemBox *item = new T2DlgItemBox(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) @@ -439,7 +427,7 @@ void T2Dialog::CreateDlgItemLoop(T2DialogDef& def, char* data) { rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 443 - T2DlgItemText *item = DEBUG_NEW T2DlgItemText(mTowerDoc, mImageObj, mPalette); + T2DlgItemText *item = new T2DlgItemText(mTowerDoc, mImageObj, mPalette); item->Create(text, inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) @@ -452,7 +440,7 @@ void T2Dialog::CreateDlgItemLoop(T2DialogDef& def, char* data) { theTemplate.pt.y = inTokenizer.NextInteger(); theTemplate.moduleHandle = mTemplate.moduleHandle; #line 457 - T2Dialog *theDialog = DEBUG_NEW T2Dialog; + T2Dialog *theDialog = new T2Dialog; theDialog->Realize(this, &theTemplate, mTowerDoc, mImageObj, NULL, false, this, id, true); } else if (!_stricmp(token, "PPVIEW")) { UINT id = inTokenizer.NextInteger(); @@ -462,7 +450,7 @@ void T2Dialog::CreateDlgItemLoop(T2DialogDef& def, char* data) { rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 468 - T2DlgItemPeopleView *item = DEBUG_NEW T2DlgItemPeopleView(mTowerDoc, mImageObj, mPalette); + T2DlgItemPeopleView *item = new T2DlgItemPeopleView(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) @@ -475,7 +463,7 @@ void T2Dialog::CreateDlgItemLoop(T2DialogDef& def, char* data) { rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 482 - T2DlgItemProfitsGage *item = DEBUG_NEW T2DlgItemProfitsGage(mTowerDoc, mImageObj, mPalette); + T2DlgItemProfitsGage *item = new T2DlgItemProfitsGage(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) @@ -488,7 +476,7 @@ void T2Dialog::CreateDlgItemLoop(T2DialogDef& def, char* data) { rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 496 - T2DlgItemCustomerGage *item = DEBUG_NEW T2DlgItemCustomerGage(mTowerDoc, mImageObj, mPalette); + T2DlgItemCustomerGage *item = new T2DlgItemCustomerGage(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) @@ -501,7 +489,7 @@ void T2Dialog::CreateDlgItemLoop(T2DialogDef& def, char* data) { rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 510 - T2DlgItemStressGage *item = DEBUG_NEW T2DlgItemStressGage(mTowerDoc, mImageObj, mPalette); + T2DlgItemStressGage *item = new T2DlgItemStressGage(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) @@ -514,7 +502,7 @@ void T2Dialog::CreateDlgItemLoop(T2DialogDef& def, char* data) { rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 524 - T2DlgItemPPLEvalGage *item = DEBUG_NEW T2DlgItemPPLEvalGage(mTowerDoc, mImageObj, mPalette); + T2DlgItemPPLEvalGage *item = new T2DlgItemPPLEvalGage(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) @@ -527,7 +515,7 @@ void T2Dialog::CreateDlgItemLoop(T2DialogDef& def, char* data) { rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 538 - T2DlgItemBelongGage *item = DEBUG_NEW T2DlgItemBelongGage(mTowerDoc, mImageObj, mPalette); + T2DlgItemBelongGage *item = new T2DlgItemBelongGage(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) @@ -540,7 +528,7 @@ void T2Dialog::CreateDlgItemLoop(T2DialogDef& def, char* data) { rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 552 - T2DlgItemTable *item = DEBUG_NEW T2DlgItemTable(mTowerDoc, mImageObj, mPalette); + T2DlgItemTable *item = new T2DlgItemTable(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) @@ -554,7 +542,7 @@ void T2Dialog::CreateDlgItemLoop(T2DialogDef& def, char* data) { rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 566 - T2DlgItemPopup *item = DEBUG_NEW T2DlgItemPopup(mTowerDoc, mImageObj, mPalette); + T2DlgItemPopup *item = new T2DlgItemPopup(mTowerDoc, mImageObj, mPalette); item->Create(text, inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) @@ -567,7 +555,7 @@ void T2Dialog::CreateDlgItemLoop(T2DialogDef& def, char* data) { rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 580 - T2PluginInfoTable *item = DEBUG_NEW T2PluginInfoTable(mTowerDoc, mImageObj, mPalette); + T2PluginInfoTable *item = new T2PluginInfoTable(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) @@ -581,7 +569,7 @@ void T2Dialog::CreateDlgItemLoop(T2DialogDef& def, char* data) { rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 594 - T2DlgItemImage *item = DEBUG_NEW T2DlgItemImage(mTowerDoc, mImageObj, mPalette); + T2DlgItemImage *item = new T2DlgItemImage(mTowerDoc, mImageObj, mPalette); item->Create(text, inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) @@ -595,7 +583,7 @@ void T2Dialog::CreateDlgItemLoop(T2DialogDef& def, char* data) { rect.bottom = inTokenizer.NextInteger(); int maxChars = inTokenizer.NextInteger(); #line 608 - T2DlgItemMerchandiseField *item = DEBUG_NEW T2DlgItemMerchandiseField(mTowerDoc, mImageObj, mPalette); + T2DlgItemMerchandiseField *item = new T2DlgItemMerchandiseField(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags | WS_CLIPCHILDREN, rect, this, id); item->CreateSubItem(&maxChars); if (mCurrentFont >= 0) @@ -606,7 +594,7 @@ void T2Dialog::CreateDlgItemLoop(T2DialogDef& def, char* data) { rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); #line 619 - T2DlgItemArrows *item = DEBUG_NEW T2DlgItemArrows(mTowerDoc, mImageObj, mPalette); + T2DlgItemArrows *item = new T2DlgItemArrows(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags | WS_CLIPCHILDREN, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) @@ -619,7 +607,7 @@ void T2Dialog::CreateDlgItemLoop(T2DialogDef& def, char* data) { rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 634 - T2DlgItemListBox *item = DEBUG_NEW T2DlgItemListBox(mTowerDoc, mImageObj, mPalette); + T2DlgItemListBox *item = new T2DlgItemListBox(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags | WS_CLIPCHILDREN, rect, this, id); item->CreateSubItem(); if (mCurrentFont >= 0) @@ -633,7 +621,7 @@ void T2Dialog::CreateDlgItemLoop(T2DialogDef& def, char* data) { rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 649 - CToggleButtonDisabled *item = DEBUG_NEW CToggleButtonDisabled(mTowerDoc, mImageObj, mPalette); + CToggleButtonDisabled *item = new CToggleButtonDisabled(mTowerDoc, mImageObj, mPalette); item->Create(text, inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) @@ -646,7 +634,7 @@ void T2Dialog::CreateDlgItemLoop(T2DialogDef& def, char* data) { rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 662 - T2DlgItemSTimeTbl *item = DEBUG_NEW T2DlgItemSTimeTbl(mTowerDoc, mImageObj, mPalette); + T2DlgItemSTimeTbl *item = new T2DlgItemSTimeTbl(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) @@ -659,7 +647,7 @@ void T2Dialog::CreateDlgItemLoop(T2DialogDef& def, char* data) { rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 676 - T2DlgItemMovie *item = DEBUG_NEW T2DlgItemMovie(mTowerDoc, mImageObj, mPalette); + T2DlgItemMovie *item = new T2DlgItemMovie(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags | WS_CLIPCHILDREN, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) @@ -672,7 +660,7 @@ void T2Dialog::CreateDlgItemLoop(T2DialogDef& def, char* data) { rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 690 - T2MovieTable *item = DEBUG_NEW T2MovieTable(mTowerDoc, mImageObj, mPalette); + T2MovieTable *item = new T2MovieTable(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) @@ -685,7 +673,7 @@ void T2Dialog::CreateDlgItemLoop(T2DialogDef& def, char* data) { rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 705 - T2DlgItemAnimation *item = DEBUG_NEW T2DlgItemAnimation(mTowerDoc, mImageObj, mPalette); + T2DlgItemAnimation *item = new T2DlgItemAnimation(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags | WS_CLIPCHILDREN, rect, this, id); if (mCurrentFont >= 0) item->SetFont(*mFonts[mCurrentFont]); @@ -697,7 +685,7 @@ void T2Dialog::CreateDlgItemLoop(T2DialogDef& def, char* data) { rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 719 - T2DlgItemProgress *item = DEBUG_NEW T2DlgItemProgress(mTowerDoc, mImageObj, mPalette); + T2DlgItemProgress *item = new T2DlgItemProgress(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags | WS_CLIPCHILDREN, rect, this, id); item->CreateSubItem(); if (mCurrentFont >= 0) @@ -710,7 +698,7 @@ void T2Dialog::CreateDlgItemLoop(T2DialogDef& def, char* data) { rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 733 - T2AdvertiseTable *item = DEBUG_NEW T2AdvertiseTable(mTowerDoc, mImageObj, mPalette); + T2AdvertiseTable *item = new T2AdvertiseTable(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) @@ -816,12 +804,12 @@ void T2Dialog::DoClose(int nResult) { DestroyWindow(); } -/*virtual*/ int T2Dialog::PreTranslateMessage(MSG* msg) { +/*virtual*/ BOOL T2Dialog::PreTranslateMessage(MSG* msg) { return CWnd::PreTranslateMessage(msg); } -/*virtual*/ int T2Dialog::PreCreateWindow(CREATESTRUCT&) { - return 1; +/*virtual*/ BOOL T2Dialog::PreCreateWindow(CREATESTRUCT&) { + return true; } void T2Dialog::MakeRadioGroup(int inBaseID, int inCount, int inSelected) { diff --git a/src/T2DLL/T2Dialog.h b/src/T2DLL/T2Dialog.h index 952e1b5..4f92ff8 100644 --- a/src/T2DLL/T2Dialog.h +++ b/src/T2DLL/T2Dialog.h @@ -1,6 +1,26 @@ #pragma once #include "common.h" #include "LListener.h" +#include "T2DlgItemOK.h" +#include "T2DlgItemCANCEL.h" +#include "T2DlgItemTButton.h" +#include "T2DlgItemCheck.h" +#include "T2DlgItemHScr.h" +#include "T2DlgItemVScr.h" +#include "T2DlgItemBox.h" +#include "T2DlgItemText.h" +#include "T2DlgItemStressGage.h" +#include "T2DlgItemPPLEvalGage.h" +#include "T2DlgItemBelongGage.h" +#include "T2DlgItemCustomerGage.h" +#include "T2DlgItemProfitsGage.h" +#include "T2DlgItemImageTable.h" +#include "T2DlgItemImage.h" +#include "CToggleButtonDisabled.h" +#include "T2MovieTable.h" +#include "T2GuestroomTable.h" +#include "T2HallEventTable.h" +#include "CTokenizer.h" struct T2DLGTEMPLATE { POINT pt; @@ -8,8 +28,8 @@ struct T2DLGTEMPLATE { int resID; }; -class AFX_EXT_CLASS T2Dialog : public CWnd, public LListener { - DECLARE_DYNAMIC(T2Dialog) +class AFX_CLASS_EXPORT T2Dialog : public CWnd, public LListener { + DECLARE_DYNCREATE(T2Dialog) DECLARE_MESSAGE_MAP() public: @@ -19,7 +39,7 @@ public: int DoModal(); void DoClose(int nResult); - virtual int PreTranslateMessage(MSG*); + virtual BOOL PreTranslateMessage(MSG*); void MakeRadioGroup(int inBaseID, int inCount, int inSelected); void MakeTabPanel(int inBaseID1, int inBaseID2, int inCount, int inSelected); HFONT GetFont(); @@ -31,7 +51,7 @@ public: void SetUserCon(long uc) { mUserCon = uc; } long GetUserCon() { return mUserCon; } - class T2DialogDef { + class AFX_CLASS_EXPORT T2DialogDef { public: T2DialogDef(); virtual ~T2DialogDef(); @@ -71,7 +91,7 @@ protected: BOOL OnQueryNewPalette(); BOOL OnEraseBkgnd(CDC* pDC); - virtual int PreCreateWindow(CREATESTRUCT&); + virtual BOOL PreCreateWindow(CREATESTRUCT&); virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam); virtual void PostNcDestroy(); virtual void AfterBurner(T2DialogDef& def); diff --git a/src/T2DLL/T2DlgItem.cpp b/src/T2DLL/T2DlgItem.cpp index ac4a70b..7f059d5 100644 --- a/src/T2DLL/T2DlgItem.cpp +++ b/src/T2DLL/T2DlgItem.cpp @@ -3,6 +3,12 @@ #include "T2TowerDoc.h" #include "T2WorldDef.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + T2DlgItem::T2DlgItem() { } diff --git a/src/T2DLL/T2DlgItem.h b/src/T2DLL/T2DlgItem.h index 939ae9f..d025cbf 100644 --- a/src/T2DLL/T2DlgItem.h +++ b/src/T2DLL/T2DlgItem.h @@ -2,7 +2,7 @@ #include "common.h" #include "LBroadcaster.h" -class AFX_EXT_CLASS T2DlgItem : public CWnd, public LBroadcaster { +class AFX_CLASS_EXPORT T2DlgItem : public CWnd, public LBroadcaster { protected: T2DlgItem(); public: diff --git a/src/T2DLL/T2DlgItemAPTable.h b/src/T2DLL/T2DlgItemAPTable.h index 9fb6223..3f36ae4 100644 --- a/src/T2DLL/T2DlgItemAPTable.h +++ b/src/T2DLL/T2DlgItemAPTable.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2DlgItemImageTable.h" -class AFX_EXT_CLASS T2DlgItemAPTable : public T2DlgItemImageTable { +class AFX_CLASS_EXPORT T2DlgItemAPTable : public T2DlgItemImageTable { public: T2DlgItemAPTable(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); T2DlgItemAPTable(int inRows, int inCols, int inRowHeight, int inColWidth, int inCellDataSize, T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); diff --git a/src/T2DLL/T2DlgItemAllPurpose.cpp b/src/T2DLL/T2DlgItemAllPurpose.cpp index 9a947f0..371be6e 100644 --- a/src/T2DLL/T2DlgItemAllPurpose.cpp +++ b/src/T2DLL/T2DlgItemAllPurpose.cpp @@ -1,11 +1,17 @@ #include "T2DlgItemAllPurpose.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + T2DlgItemAllPurpose::T2DlgItemAllPurpose(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette) : T2DlgItem(inDoc, inImageObj, inPalette) { #line 16 - mDownPoint = DEBUG_NEW CPoint(-1, -1); - mUpPoint = DEBUG_NEW CPoint(-1, -1); + mDownPoint = new CPoint(-1, -1); + mUpPoint = new CPoint(-1, -1); mButton = -1; } diff --git a/src/T2DLL/T2DlgItemAllPurpose.h b/src/T2DLL/T2DlgItemAllPurpose.h index 6aef4c6..edf1aad 100644 --- a/src/T2DLL/T2DlgItemAllPurpose.h +++ b/src/T2DLL/T2DlgItemAllPurpose.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2DlgItem.h" -class AFX_EXT_CLASS T2DlgItemAllPurpose : public T2DlgItem { +class AFX_CLASS_EXPORT T2DlgItemAllPurpose : public T2DlgItem { public: T2DlgItemAllPurpose(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); virtual ~T2DlgItemAllPurpose(); diff --git a/src/T2DLL/T2DlgItemAnimation.cpp b/src/T2DLL/T2DlgItemAnimation.cpp index b2f8589..905bcf5 100644 --- a/src/T2DLL/T2DlgItemAnimation.cpp +++ b/src/T2DLL/T2DlgItemAnimation.cpp @@ -3,6 +3,12 @@ #include "T2DlgItemAnimation.h" #include "T2ImageObj.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + T2DlgItemAnimation::T2DlgItemAnimation(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette) : T2DlgItem(inDoc, inImageObj, inPalette) { @@ -52,8 +58,8 @@ void T2DlgItemAnimation::SetAnimation(HINSTANCE inModule, int inResID, int unk) delete mImageObj; #line 60 - mBitImage = DEBUG_NEW T2BitImage(GetWorldModuleHandle(), inResID, true); - mImageObj = DEBUG_NEW T2ImageObj; + mBitImage = new T2BitImage(GetWorldModuleHandle(), inResID, true); + mImageObj = new T2ImageObj; mImageObj->AddObject(GetWorldModuleHandle(), inResID, mBitImage); mStartFrame = 0; diff --git a/src/T2DLL/T2DlgItemAnimation.h b/src/T2DLL/T2DlgItemAnimation.h index 613bf65..c541b70 100644 --- a/src/T2DLL/T2DlgItemAnimation.h +++ b/src/T2DLL/T2DlgItemAnimation.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2DlgItem.h" -class AFX_EXT_CLASS T2DlgItemAnimation : public T2DlgItem { +class AFX_CLASS_EXPORT T2DlgItemAnimation : public T2DlgItem { public: T2DlgItemAnimation(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); virtual ~T2DlgItemAnimation(); diff --git a/src/T2DLL/T2DlgItemArrows.cpp b/src/T2DLL/T2DlgItemArrows.cpp index 64c9ae3..06cc7e8 100644 --- a/src/T2DLL/T2DlgItemArrows.cpp +++ b/src/T2DLL/T2DlgItemArrows.cpp @@ -1,6 +1,12 @@ #include "T2BitImage.h" #include "T2DlgItemArrows.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + T2DlgItemArrows::T2DlgItemArrows(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette) : T2DlgItem(inDoc, inImageObj, inPalette) , mMinimum(0) diff --git a/src/T2DLL/T2DlgItemBelongGage.cpp b/src/T2DLL/T2DlgItemBelongGage.cpp index 81dcec7..5320576 100644 --- a/src/T2DLL/T2DlgItemBelongGage.cpp +++ b/src/T2DLL/T2DlgItemBelongGage.cpp @@ -1,6 +1,12 @@ #include "T2DlgItemBelongGage.h" #include "T2Tenant.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + T2DlgItemBelongGage::T2DlgItemBelongGage(T2TowerDoc* towerDoc, T2ImageObj* imageObj, CPalette* palette) : T2DlgItemGageBase(towerDoc, imageObj, palette) , mTenant(NULL) diff --git a/src/T2DLL/T2DlgItemBelongGage.h b/src/T2DLL/T2DlgItemBelongGage.h index 213f724..878be44 100644 --- a/src/T2DLL/T2DlgItemBelongGage.h +++ b/src/T2DLL/T2DlgItemBelongGage.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2DlgItemGageBase.h" -class AFX_EXT_CLASS T2DlgItemBelongGage : public T2DlgItemGageBase { +class AFX_CLASS_EXPORT T2DlgItemBelongGage : public T2DlgItemGageBase { public: T2DlgItemBelongGage(T2TowerDoc* towerDoc, T2ImageObj* imageObj, CPalette* palette); void SetTenant(T2Tenant* tenant); diff --git a/src/T2DLL/T2DlgItemBox.cpp b/src/T2DLL/T2DlgItemBox.cpp index 514b300..fc49267 100644 --- a/src/T2DLL/T2DlgItemBox.cpp +++ b/src/T2DLL/T2DlgItemBox.cpp @@ -1,5 +1,11 @@ #include "T2DlgItemBox.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + T2DlgItemBox::T2DlgItemBox(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette) : T2DlgItem(inDoc, inImageObj, inPalette) { diff --git a/src/T2DLL/T2DlgItemBox.h b/src/T2DLL/T2DlgItemBox.h index 90bcd14..b63b3aa 100644 --- a/src/T2DLL/T2DlgItemBox.h +++ b/src/T2DLL/T2DlgItemBox.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2DlgItem.h" -class AFX_EXT_CLASS T2DlgItemBox : public T2DlgItem { +class AFX_CLASS_EXPORT T2DlgItemBox : public T2DlgItem { public: T2DlgItemBox(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); protected: diff --git a/src/T2DLL/T2DlgItemButtonBase.h b/src/T2DLL/T2DlgItemButtonBase.h index 868340b..aba1e15 100644 --- a/src/T2DLL/T2DlgItemButtonBase.h +++ b/src/T2DLL/T2DlgItemButtonBase.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2DlgItem.h" -class AFX_EXT_CLASS T2DlgItemButtonBase : public T2DlgItem { +class AFX_CLASS_EXPORT T2DlgItemButtonBase : public T2DlgItem { public: T2DlgItemButtonBase(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); protected: diff --git a/src/T2DLL/T2DlgItemCANCEL.h b/src/T2DLL/T2DlgItemCANCEL.h index 42132c7..df762e4 100644 --- a/src/T2DLL/T2DlgItemCANCEL.h +++ b/src/T2DLL/T2DlgItemCANCEL.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2DlgItemIButton.h" -class AFX_EXT_CLASS T2DlgItemCANCEL : public T2DlgItemIButton { +class AFX_CLASS_EXPORT T2DlgItemCANCEL : public T2DlgItemIButton { public: T2DlgItemCANCEL(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); virtual BOOL Create(const char* windowName, DWORD style, const RECT& rect, CWnd* parentWnd, UINT nId); diff --git a/src/T2DLL/T2DlgItemCheck.cpp b/src/T2DLL/T2DlgItemCheck.cpp index 19dd269..5bb0427 100644 --- a/src/T2DLL/T2DlgItemCheck.cpp +++ b/src/T2DLL/T2DlgItemCheck.cpp @@ -1,5 +1,11 @@ #include "T2DlgItemCheck.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + T2DlgItemCheck::T2DlgItemCheck(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette) : T2DlgItemICheck(inDoc, inImageObj, inPalette) { diff --git a/src/T2DLL/T2DlgItemCheck.h b/src/T2DLL/T2DlgItemCheck.h index 4764725..0f0335a 100644 --- a/src/T2DLL/T2DlgItemCheck.h +++ b/src/T2DLL/T2DlgItemCheck.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2DlgItemICheck.h" -class AFX_EXT_CLASS T2DlgItemCheck : public T2DlgItemICheck { +class AFX_CLASS_EXPORT T2DlgItemCheck : public T2DlgItemICheck { public: T2DlgItemCheck(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); virtual BOOL Create(const char* windowName, DWORD style, const RECT& inRect, CWnd* parentWnd, UINT nId); diff --git a/src/T2DLL/T2DlgItemCustomerGage.cpp b/src/T2DLL/T2DlgItemCustomerGage.cpp index 1a829cc..2b395a6 100644 --- a/src/T2DLL/T2DlgItemCustomerGage.cpp +++ b/src/T2DLL/T2DlgItemCustomerGage.cpp @@ -1,6 +1,12 @@ #include "T2DlgItemCustomerGage.h" #include "T2Tenant.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + T2DlgItemCustomerGage::T2DlgItemCustomerGage(T2TowerDoc* towerDoc, T2ImageObj* imageObj, CPalette* palette) : T2DlgItemGageBase(towerDoc, imageObj, palette) , mTenant(NULL) diff --git a/src/T2DLL/T2DlgItemCustomerGage.h b/src/T2DLL/T2DlgItemCustomerGage.h index 2293b71..29d5ea2 100644 --- a/src/T2DLL/T2DlgItemCustomerGage.h +++ b/src/T2DLL/T2DlgItemCustomerGage.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2DlgItemGageBase.h" -class AFX_EXT_CLASS T2DlgItemCustomerGage : public T2DlgItemGageBase { +class AFX_CLASS_EXPORT T2DlgItemCustomerGage : public T2DlgItemGageBase { public: T2DlgItemCustomerGage(T2TowerDoc* towerDoc, T2ImageObj* imageObj, CPalette* palette); void SetTenant(T2Tenant*); diff --git a/src/T2DLL/T2DlgItemEdit.cpp b/src/T2DLL/T2DlgItemEdit.cpp index d614890..0e73a02 100644 --- a/src/T2DLL/T2DlgItemEdit.cpp +++ b/src/T2DLL/T2DlgItemEdit.cpp @@ -1,3 +1,4 @@ +#define ATOI_KLUDGE #include "CEditWFocus.h" #include "T2DlgItemEdit.h" diff --git a/src/T2DLL/T2DlgItemEdit.h b/src/T2DLL/T2DlgItemEdit.h index 8981724..5c95ad2 100644 --- a/src/T2DLL/T2DlgItemEdit.h +++ b/src/T2DLL/T2DlgItemEdit.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2DlgItem.h" -class AFX_EXT_CLASS T2DlgItemEdit : public T2DlgItem { +class AFX_CLASS_EXPORT T2DlgItemEdit : public T2DlgItem { public: T2DlgItemEdit(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); virtual ~T2DlgItemEdit(); diff --git a/src/T2DLL/T2DlgItemGageBase.cpp b/src/T2DLL/T2DlgItemGageBase.cpp index faa140a..fd39101 100644 --- a/src/T2DLL/T2DlgItemGageBase.cpp +++ b/src/T2DLL/T2DlgItemGageBase.cpp @@ -1,5 +1,11 @@ #include "T2DlgItemGageBase.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + T2DlgItemGageBase::T2DlgItemGageBase(T2TowerDoc* towerDoc, T2ImageObj* imageObj, CPalette* palette) : T2DlgItem(towerDoc, imageObj, palette) { diff --git a/src/T2DLL/T2DlgItemGageBase.h b/src/T2DLL/T2DlgItemGageBase.h index d2471a1..375f535 100644 --- a/src/T2DLL/T2DlgItemGageBase.h +++ b/src/T2DLL/T2DlgItemGageBase.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2DlgItem.h" -class AFX_EXT_CLASS T2DlgItemGageBase : public T2DlgItem { +class AFX_CLASS_EXPORT T2DlgItemGageBase : public T2DlgItem { public: T2DlgItemGageBase(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); protected: diff --git a/src/T2DLL/T2DlgItemHScr.cpp b/src/T2DLL/T2DlgItemHScr.cpp index add3d0c..98100c1 100644 --- a/src/T2DLL/T2DlgItemHScr.cpp +++ b/src/T2DLL/T2DlgItemHScr.cpp @@ -1,6 +1,12 @@ #include "T2BitImage.h" #include "T2DlgItemHScr.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + T2DlgItemHScr::T2DlgItemHScr(T2TowerDoc* towerDoc, T2ImageObj* imageObj, CPalette* palette) : T2DlgItemScr(towerDoc, imageObj, palette) { diff --git a/src/T2DLL/T2DlgItemHScr.h b/src/T2DLL/T2DlgItemHScr.h index 67f56a4..34fd5c9 100644 --- a/src/T2DLL/T2DlgItemHScr.h +++ b/src/T2DLL/T2DlgItemHScr.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2DlgItemScr.h" -class AFX_EXT_CLASS T2DlgItemHScr : public T2DlgItemScr { +class AFX_CLASS_EXPORT T2DlgItemHScr : public T2DlgItemScr { public: T2DlgItemHScr(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); protected: diff --git a/src/T2DLL/T2DlgItemIButton.cpp b/src/T2DLL/T2DlgItemIButton.cpp index 3aa923a..4d39112 100644 --- a/src/T2DLL/T2DlgItemIButton.cpp +++ b/src/T2DLL/T2DlgItemIButton.cpp @@ -2,12 +2,19 @@ #include "T2BitImage.h" #include "T2DlgItemIButton.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + T2DlgItemIButton::T2DlgItemIButton(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette) : T2DlgItemButtonBase(inDoc, inImageObj, inPalette) { } /*virtual*/ BOOL T2DlgItemIButton::OnT2DlgItemEraseBkgnd(CDC* pDC) { +#pragma var_order(imageRect, rect30, clientRect, newDC, image, save3, save2, text, save, rect74, brush, bitmap, hbitmap) CRect clientRect; GetClientRect(clientRect); @@ -26,11 +33,11 @@ T2DlgItemIButton::T2DlgItemIButton(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CP rect30.left = (clientRect.Width() - imageRect.Width()) / 2; rect30.top = (clientRect.Height() - imageRect.Height()) / 2; rect30.right = rect30.left + imageRect.Width(); - rect30.bottom = rect30.bottom + imageRect.Height(); + rect30.bottom = rect30.top + imageRect.Height(); int save2 = pDC->SaveDC(); CRect rect74 = imageRect; - OffsetRect(&rect74, -imageRect.left, -imageRect.top); + OffsetRect(&rect74, -rect74.left, -rect74.top); CDC newDC; newDC.CreateCompatibleDC(pDC); diff --git a/src/T2DLL/T2DlgItemIButton.h b/src/T2DLL/T2DlgItemIButton.h index 46a4391..d0085d1 100644 --- a/src/T2DLL/T2DlgItemIButton.h +++ b/src/T2DLL/T2DlgItemIButton.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2DlgItemButtonBase.h" -class AFX_EXT_CLASS T2DlgItemIButton : public T2DlgItemButtonBase { +class AFX_CLASS_EXPORT T2DlgItemIButton : public T2DlgItemButtonBase { public: T2DlgItemIButton(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); protected: diff --git a/src/T2DLL/T2DlgItemICheck.cpp b/src/T2DLL/T2DlgItemICheck.cpp index e4c4900..bbe6b24 100644 --- a/src/T2DLL/T2DlgItemICheck.cpp +++ b/src/T2DLL/T2DlgItemICheck.cpp @@ -1,6 +1,12 @@ #include "T2BitImage.h" #include "T2DlgItemICheck.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + T2DlgItemICheck::T2DlgItemICheck(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette) : T2DlgItem(inDoc, inImageObj, inPalette) { diff --git a/src/T2DLL/T2DlgItemICheck.h b/src/T2DLL/T2DlgItemICheck.h index ec0302b..f04e411 100644 --- a/src/T2DLL/T2DlgItemICheck.h +++ b/src/T2DLL/T2DlgItemICheck.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2DlgItem.h" -class AFX_EXT_CLASS T2DlgItemICheck : public T2DlgItem { +class AFX_CLASS_EXPORT T2DlgItemICheck : public T2DlgItem { public: T2DlgItemICheck(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); virtual BOOL Create(const char* windowName, DWORD style, const RECT& inRect, CWnd* parentWnd, UINT nId); diff --git a/src/T2DLL/T2DlgItemIRepeater.cpp b/src/T2DLL/T2DlgItemIRepeater.cpp index 40c8a2a..b671ca7 100644 --- a/src/T2DLL/T2DlgItemIRepeater.cpp +++ b/src/T2DLL/T2DlgItemIRepeater.cpp @@ -1,5 +1,11 @@ #include "T2DlgItemIRepeater.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + T2DlgItemIRepeater::T2DlgItemIRepeater(T2TowerDoc *inDoc, T2ImageObj *inImageObj, CPalette *inPalette) : T2DlgItemIButton(inDoc, inImageObj, inPalette) { diff --git a/src/T2DLL/T2DlgItemImage.cpp b/src/T2DLL/T2DlgItemImage.cpp index 23db042..e567135 100644 --- a/src/T2DLL/T2DlgItemImage.cpp +++ b/src/T2DLL/T2DlgItemImage.cpp @@ -1,6 +1,12 @@ #include "T2BitImage.h" #include "T2DlgItemImage.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + T2DlgItemImage::T2DlgItemImage(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette) : T2DlgItem(inDoc, inImageObj, inPalette) { diff --git a/src/T2DLL/T2DlgItemImage.h b/src/T2DLL/T2DlgItemImage.h index c07c21d..20e93fd 100644 --- a/src/T2DLL/T2DlgItemImage.h +++ b/src/T2DLL/T2DlgItemImage.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2DlgItem.h" -class AFX_EXT_CLASS T2DlgItemImage : public T2DlgItem { +class AFX_CLASS_EXPORT T2DlgItemImage : public T2DlgItem { public: T2DlgItemImage(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); virtual int Create(const char* inName, DWORD inStyle, const RECT& inRect, CWnd* inParentWnd, UINT inID); diff --git a/src/T2DLL/T2DlgItemImageTable.h b/src/T2DLL/T2DlgItemImageTable.h index 78c2966..82f0aa6 100644 --- a/src/T2DLL/T2DlgItemImageTable.h +++ b/src/T2DLL/T2DlgItemImageTable.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2DlgItemTable.h" -class AFX_EXT_CLASS T2DlgItemImageTable : public T2DlgItemTable { +class AFX_CLASS_EXPORT T2DlgItemImageTable : public T2DlgItemTable { public: T2DlgItemImageTable(T2TowerDoc* towerDoc, T2ImageObj* imageObj, CPalette* palette); T2DlgItemImageTable(int rows, int cols, int rowHeight, int colWidth, int cellDataSize, T2TowerDoc* towerDoc, T2ImageObj* imageObj, CPalette* palette); diff --git a/src/T2DLL/T2DlgItemListBox.h b/src/T2DLL/T2DlgItemListBox.h index 5c1bf48..e506c2b 100644 --- a/src/T2DLL/T2DlgItemListBox.h +++ b/src/T2DLL/T2DlgItemListBox.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2DlgItem.h" -class AFX_EXT_CLASS T2DlgItemListBox : public T2DlgItem { +class AFX_CLASS_EXPORT T2DlgItemListBox : public T2DlgItem { public: T2DlgItemListBox(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); virtual ~T2DlgItemListBox(); diff --git a/src/T2DLL/T2DlgItemMerchandiseField.cpp b/src/T2DLL/T2DlgItemMerchandiseField.cpp index 11247d1..bc02ee0 100644 --- a/src/T2DLL/T2DlgItemMerchandiseField.cpp +++ b/src/T2DLL/T2DlgItemMerchandiseField.cpp @@ -2,6 +2,12 @@ #include "T2Dialog.h" #include "T2DlgItemMerchandiseField.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + T2DlgItemMerchandiseField::T2DlgItemMerchandiseField(T2TowerDoc *inDoc, T2ImageObj *inImageObj, CPalette *inPalette) : T2DlgItemEdit(inDoc, inImageObj, inPalette) { diff --git a/src/T2DLL/T2DlgItemMovie.cpp b/src/T2DLL/T2DlgItemMovie.cpp index 2a66e80..8e6e324 100644 --- a/src/T2DLL/T2DlgItemMovie.cpp +++ b/src/T2DLL/T2DlgItemMovie.cpp @@ -3,6 +3,12 @@ #include "T2DlgItemMovie.h" #include "T2ImageObj.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + // love how this is obviously based off player/playfile/playfile.cpp // from the DirectX SDK @@ -65,8 +71,8 @@ void T2DlgItemMovie::SetStillScreenID(const char* inName, int inResID) { InvalidateRect(NULL); #line 76 - mImage = DEBUG_NEW T2BitImage(inName, inResID, true); - mImageObj = DEBUG_NEW T2ImageObj; + mImage = new T2BitImage(inName, inResID, true); + mImageObj = new T2ImageObj; mImageObj->AddObject("STIL", -1, *mImage, NULL, false, false); } diff --git a/src/T2DLL/T2DlgItemMovie.h b/src/T2DLL/T2DlgItemMovie.h index 3d2c2dc..cd80027 100644 --- a/src/T2DLL/T2DlgItemMovie.h +++ b/src/T2DLL/T2DlgItemMovie.h @@ -7,7 +7,7 @@ #include <uuids.h> #include <evcode.h> -class AFX_EXT_CLASS T2DlgItemMovie : public T2DlgItem { +class AFX_CLASS_EXPORT T2DlgItemMovie : public T2DlgItem { public: T2DlgItemMovie(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); virtual ~T2DlgItemMovie(); diff --git a/src/T2DLL/T2DlgItemOK.h b/src/T2DLL/T2DlgItemOK.h index 37a1712..bce44ab 100644 --- a/src/T2DLL/T2DlgItemOK.h +++ b/src/T2DLL/T2DlgItemOK.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2DlgItemIButton.h" -class AFX_EXT_CLASS T2DlgItemOK : public T2DlgItemIButton { +class AFX_CLASS_EXPORT T2DlgItemOK : public T2DlgItemIButton { public: T2DlgItemOK(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); virtual BOOL Create(const char* windowName, DWORD style, const RECT& rect, CWnd* parentWnd, UINT nId); diff --git a/src/T2DLL/T2DlgItemPPLEvalGage.cpp b/src/T2DLL/T2DlgItemPPLEvalGage.cpp index 164a3ab..41b289b 100644 --- a/src/T2DLL/T2DlgItemPPLEvalGage.cpp +++ b/src/T2DLL/T2DlgItemPPLEvalGage.cpp @@ -2,6 +2,12 @@ #include "T2People.h" #include "T2PeopleDef.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + T2DlgItemPPLEvalGage::T2DlgItemPPLEvalGage(T2TowerDoc* towerDoc, T2ImageObj* imageObj, CPalette* palette) : T2DlgItemGageBase(towerDoc, imageObj, palette) , mPeople(NULL) diff --git a/src/T2DLL/T2DlgItemPPLEvalGage.h b/src/T2DLL/T2DlgItemPPLEvalGage.h index 4252a22..8156c8a 100644 --- a/src/T2DLL/T2DlgItemPPLEvalGage.h +++ b/src/T2DLL/T2DlgItemPPLEvalGage.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2DlgItemGageBase.h" -class AFX_EXT_CLASS T2DlgItemPPLEvalGage : public T2DlgItemGageBase { +class AFX_CLASS_EXPORT T2DlgItemPPLEvalGage : public T2DlgItemGageBase { public: T2DlgItemPPLEvalGage(T2TowerDoc* towerDoc, T2ImageObj* imageObj, CPalette* palette); void SetPeople(T2People* people); diff --git a/src/T2DLL/T2DlgItemPeopleView.cpp b/src/T2DLL/T2DlgItemPeopleView.cpp index d0689a5..c205a2a 100644 --- a/src/T2DLL/T2DlgItemPeopleView.cpp +++ b/src/T2DLL/T2DlgItemPeopleView.cpp @@ -7,11 +7,17 @@ #include "T2PeopleLinkIterator.h" #include "UT2Coordinate.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + T2DlgItemPeopleView::T2DlgItemPeopleView(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette) : T2DlgItem(inDoc, inImageObj, inPalette) { #line 20 - mArray = DEBUG_NEW LArray(sizeof(T2People *)); + mArray = new LArray(sizeof(T2People *)); mImage = NULL; } @@ -36,7 +42,7 @@ T2DlgItemPeopleView::T2DlgItemPeopleView(T2TowerDoc* inDoc, T2ImageObj* inImageO scrollerRect.top = scrollerRect.bottom - 16; #line 47 - T2DlgItemHScr *theScroller = DEBUG_NEW T2DlgItemHScr(mTowerDoc, mImageObj, mPalette); + T2DlgItemHScr *theScroller = new T2DlgItemHScr(mTowerDoc, mImageObj, mPalette); theScroller->Create("", WS_VISIBLE | WS_CHILD, scrollerRect, this, 100); } @@ -188,7 +194,7 @@ void T2DlgItemPeopleView::FinishAdd() { CRect imageRect(0, 0, width, 36); #line 214 - mImage = DEBUG_NEW T2BitImage(imageRect); + mImage = new T2BitImage(imageRect); mImage->Clear(0); int h = 0; diff --git a/src/T2DLL/T2DlgItemPeopleView.h b/src/T2DLL/T2DlgItemPeopleView.h index 1f60517..7d1fb29 100644 --- a/src/T2DLL/T2DlgItemPeopleView.h +++ b/src/T2DLL/T2DlgItemPeopleView.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2DlgItem.h" -class AFX_EXT_CLASS T2DlgItemPeopleView : public T2DlgItem { +class AFX_CLASS_EXPORT T2DlgItemPeopleView : public T2DlgItem { public: T2DlgItemPeopleView(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); virtual ~T2DlgItemPeopleView(); diff --git a/src/T2DLL/T2DlgItemPopup.cpp b/src/T2DLL/T2DlgItemPopup.cpp index 0ace311..dc268c1 100644 --- a/src/T2DLL/T2DlgItemPopup.cpp +++ b/src/T2DLL/T2DlgItemPopup.cpp @@ -1,13 +1,19 @@ #include "CTokenizer.h" #include "T2DlgItemPopup.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + T2DlgItemPopup::T2DlgItemPopup(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette) : T2DlgItem(inDoc, inImageObj, inPalette) , mMenu(NULL) , mMenuClicked(false) { #line 21 - mMenu = DEBUG_NEW CMenu; + mMenu = new CMenu; mMenu->CreatePopupMenu(); } diff --git a/src/T2DLL/T2DlgItemPopup.h b/src/T2DLL/T2DlgItemPopup.h index f7d3247..ae1cf73 100644 --- a/src/T2DLL/T2DlgItemPopup.h +++ b/src/T2DLL/T2DlgItemPopup.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2DlgItem.h" -class AFX_EXT_CLASS T2DlgItemPopup : public T2DlgItem { +class AFX_CLASS_EXPORT T2DlgItemPopup : public T2DlgItem { public: T2DlgItemPopup(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); virtual ~T2DlgItemPopup(); diff --git a/src/T2DLL/T2DlgItemProfitsGage.cpp b/src/T2DLL/T2DlgItemProfitsGage.cpp index b5181f1..27e7ffa 100644 --- a/src/T2DLL/T2DlgItemProfitsGage.cpp +++ b/src/T2DLL/T2DlgItemProfitsGage.cpp @@ -1,6 +1,12 @@ #include "T2DlgItemProfitsGage.h" #include "T2Tenant.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + T2DlgItemProfitsGage::T2DlgItemProfitsGage(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette) : T2DlgItemGageBase(inDoc, inImageObj, inPalette) , mTenant(NULL) diff --git a/src/T2DLL/T2DlgItemProfitsGage.h b/src/T2DLL/T2DlgItemProfitsGage.h index f07cb95..4c6ca24 100644 --- a/src/T2DLL/T2DlgItemProfitsGage.h +++ b/src/T2DLL/T2DlgItemProfitsGage.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2DlgItemGageBase.h" -class AFX_EXT_CLASS T2DlgItemProfitsGage : public T2DlgItemGageBase { +class AFX_CLASS_EXPORT T2DlgItemProfitsGage : public T2DlgItemGageBase { public: T2DlgItemProfitsGage(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); void SetTenant(T2Tenant* inTenant); diff --git a/src/T2DLL/T2DlgItemProgress.h b/src/T2DLL/T2DlgItemProgress.h index 1ced46c..5c2b41e 100644 --- a/src/T2DLL/T2DlgItemProgress.h +++ b/src/T2DLL/T2DlgItemProgress.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2DlgItem.h" -class AFX_EXT_CLASS T2DlgItemProgress : public T2DlgItem { +class AFX_CLASS_EXPORT T2DlgItemProgress : public T2DlgItem { public: T2DlgItemProgress(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); virtual ~T2DlgItemProgress(); diff --git a/src/T2DLL/T2DlgItemRadioButton.cpp b/src/T2DLL/T2DlgItemRadioButton.cpp index 6213f43..ca7af43 100644 --- a/src/T2DLL/T2DlgItemRadioButton.cpp +++ b/src/T2DLL/T2DlgItemRadioButton.cpp @@ -1,5 +1,11 @@ #include "T2DlgItemRadioButton.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + T2DlgItemRadioButton::T2DlgItemRadioButton(T2TowerDoc *inDoc, T2ImageObj *inImageObj, CPalette *inPalette) : T2DlgItemICheck(inDoc, inImageObj, inPalette) { diff --git a/src/T2DLL/T2DlgItemRadioText.cpp b/src/T2DLL/T2DlgItemRadioText.cpp index bba4937..84614f9 100644 --- a/src/T2DLL/T2DlgItemRadioText.cpp +++ b/src/T2DLL/T2DlgItemRadioText.cpp @@ -1,6 +1,12 @@ #include "T2BitImage.h" #include "T2DlgItemRadioText.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + /*virtual*/ BOOL T2DlgItemRadioText::Create(const char *inWindowName, DWORD inStyle, const RECT &inRect, CWnd *inParentWnd, UINT inID) { CRect rect = inRect; CRect imageRect; diff --git a/src/T2DLL/T2DlgItemSTimeTbl.cpp b/src/T2DLL/T2DlgItemSTimeTbl.cpp index e82ab91..985459d 100644 --- a/src/T2DLL/T2DlgItemSTimeTbl.cpp +++ b/src/T2DLL/T2DlgItemSTimeTbl.cpp @@ -3,6 +3,12 @@ #include "T2TowerDoc.h" #include "T2WorldDef.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + T2DlgItemSTimeTbl::T2DlgItemSTimeTbl(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette) : T2DlgItem(inDoc, inImageObj, inPalette) { @@ -18,7 +24,7 @@ T2DlgItemSTimeTbl::T2DlgItemSTimeTbl(T2TowerDoc* inDoc, T2ImageObj* inImageObj, if (result) { #line 34 - mCFont = DEBUG_NEW CFont; + mCFont = new CFont; mCFont->CreateFont(-abs(9), 0, 0, 0, FW_NORMAL, false, false, false, SHIFTJIS_CHARSET, OUT_TT_PRECIS, CLIP_TT_ALWAYS, PROOF_QUALITY, DEFAULT_PITCH, "\x82\x6C\x82\x72 \x82\x6F\x83\x53\x83\x56\x83\x62\x83\x4E"); SetFont(*mCFont); } diff --git a/src/T2DLL/T2DlgItemSTimeTbl.h b/src/T2DLL/T2DlgItemSTimeTbl.h index ebfaff1..733015d 100644 --- a/src/T2DLL/T2DlgItemSTimeTbl.h +++ b/src/T2DLL/T2DlgItemSTimeTbl.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2DlgItem.h" -class AFX_EXT_CLASS T2DlgItemSTimeTbl : public T2DlgItem { +class AFX_CLASS_EXPORT T2DlgItemSTimeTbl : public T2DlgItem { public: T2DlgItemSTimeTbl(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); virtual ~T2DlgItemSTimeTbl(); diff --git a/src/T2DLL/T2DlgItemScr.cpp b/src/T2DLL/T2DlgItemScr.cpp index 9f4cb21..46b034f 100644 --- a/src/T2DLL/T2DlgItemScr.cpp +++ b/src/T2DLL/T2DlgItemScr.cpp @@ -83,11 +83,11 @@ T2DlgItemScr::T2DlgItemScr(T2TowerDoc* towerDoc, T2ImageObj* imageObj, CPalette* switch (mClickedArea) { case Area_Thumb: { - int thumbPosition, thumbSize; + int theThumbPosition, theThumbSize; clientRect.DeflateRect(0, 16); - CalcScrollBarThumb(&thumbPosition, &thumbSize); + CalcScrollBarThumb(&theThumbPosition, &theThumbSize); - int val = PositionToValue(clientRect) - thumbSize; + int val = PositionToValue(clientRect) - theThumbSize; if (val == 0) val = 1; @@ -98,24 +98,24 @@ T2DlgItemScr::T2DlgItemScr(T2TowerDoc* towerDoc, T2ImageObj* imageObj, CPalette* break; } case Area_Up: { - CRect upButtonRect; - GetUpButtonRect(clientRect, upButtonRect); - BOOL inUpButton = upButtonRect.PtInRect(pt); - if (inUpButton != m74) { - m74 = inUpButton; + CRect buttonArea; + GetUpButtonRect(clientRect, buttonArea); + BOOL mouseInRect = buttonArea.PtInRect(pt); + if (mouseInRect != m74) { + m74 = mouseInRect; mUpImage = m74 ? 100 : 0; - InvalidateRect(upButtonRect); + InvalidateRect(buttonArea); } break; } case Area_Down: { - CRect downButtonRect; - GetDnButtonRect(clientRect, downButtonRect); - BOOL inDownButton = downButtonRect.PtInRect(pt); - if (inDownButton != m74) { - m74 = inDownButton; + CRect buttonArea; + GetDnButtonRect(clientRect, buttonArea); + BOOL mouseInRect = buttonArea.PtInRect(pt); + if (mouseInRect != m74) { + m74 = mouseInRect; mDownImage = m74 ? 100 : 0; - InvalidateRect(downButtonRect); + InvalidateRect(buttonArea); } break; } @@ -165,12 +165,12 @@ void T2DlgItemScr::ScrollBarAction(int area, int arg) { if (mValue < 0) mValue = 0; - if (mValue > (mRange - mPage)) + if ((mRange - mPage) <= mValue) mValue = mRange - mPage; } + Invalidate(); Notify(GetDlgCtrlID(), 0, &mValue); - Invalidate(); } BOOL T2DlgItemScr::IsScrollable() const { diff --git a/src/T2DLL/T2DlgItemScr.h b/src/T2DLL/T2DlgItemScr.h index 0337b46..39a120a 100644 --- a/src/T2DLL/T2DlgItemScr.h +++ b/src/T2DLL/T2DlgItemScr.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2DlgItem.h" -class AFX_EXT_CLASS T2DlgItemScr : public T2DlgItem { +class AFX_CLASS_EXPORT T2DlgItemScr : public T2DlgItem { public: T2DlgItemScr(T2TowerDoc* towerDoc, T2ImageObj* imageObj, CPalette* palette); virtual void SetValue(int); diff --git a/src/T2DLL/T2DlgItemStressGage.cpp b/src/T2DLL/T2DlgItemStressGage.cpp index f685e31..0f6f106 100644 --- a/src/T2DLL/T2DlgItemStressGage.cpp +++ b/src/T2DLL/T2DlgItemStressGage.cpp @@ -2,6 +2,12 @@ #include "T2People.h" #include "T2PeopleDef.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + T2DlgItemStressGage::T2DlgItemStressGage(T2TowerDoc* towerDoc, T2ImageObj* imageObj, CPalette* palette) : T2DlgItemGageBase(towerDoc, imageObj, palette) , mPeople(NULL) diff --git a/src/T2DLL/T2DlgItemStressGage.h b/src/T2DLL/T2DlgItemStressGage.h index 9240f30..66120a6 100644 --- a/src/T2DLL/T2DlgItemStressGage.h +++ b/src/T2DLL/T2DlgItemStressGage.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2DlgItemGageBase.h" -class AFX_EXT_CLASS T2DlgItemStressGage : public T2DlgItemGageBase { +class AFX_CLASS_EXPORT T2DlgItemStressGage : public T2DlgItemGageBase { public: T2DlgItemStressGage(T2TowerDoc* towerDoc, T2ImageObj* imageObj, CPalette* palette); void SetPeople(T2People*); diff --git a/src/T2DLL/T2DlgItemTButton.cpp b/src/T2DLL/T2DlgItemTButton.cpp index 11818a6..d6b4293 100644 --- a/src/T2DLL/T2DlgItemTButton.cpp +++ b/src/T2DLL/T2DlgItemTButton.cpp @@ -1,5 +1,11 @@ #include "T2DlgItemTButton.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + T2DlgItemTButton::T2DlgItemTButton(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette) : T2DlgItemButtonBase(inDoc, inImageObj, inPalette) { diff --git a/src/T2DLL/T2DlgItemTButton.h b/src/T2DLL/T2DlgItemTButton.h index 7ab2852..6a1287b 100644 --- a/src/T2DLL/T2DlgItemTButton.h +++ b/src/T2DLL/T2DlgItemTButton.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2DlgItemButtonBase.h" -class AFX_EXT_CLASS T2DlgItemTButton : public T2DlgItemButtonBase { +class AFX_CLASS_EXPORT T2DlgItemTButton : public T2DlgItemButtonBase { public: T2DlgItemTButton(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); protected: diff --git a/src/T2DLL/T2DlgItemTab.h b/src/T2DLL/T2DlgItemTab.h index f728837..e3978f2 100644 --- a/src/T2DLL/T2DlgItemTab.h +++ b/src/T2DLL/T2DlgItemTab.h @@ -4,7 +4,7 @@ class CustomTabControl; -class AFX_EXT_CLASS T2DlgItemTab : public T2DlgItem { +class AFX_CLASS_EXPORT T2DlgItemTab : public T2DlgItem { public: T2DlgItemTab(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); virtual ~T2DlgItemTab(); diff --git a/src/T2DLL/T2DlgItemTable.h b/src/T2DLL/T2DlgItemTable.h index 5b294cf..f62fd63 100644 --- a/src/T2DLL/T2DlgItemTable.h +++ b/src/T2DLL/T2DlgItemTable.h @@ -3,7 +3,7 @@ #include "LListener.h" #include "T2DlgItem.h" -class AFX_EXT_CLASS T2DlgItemTable : public T2DlgItem, public LListener { +class AFX_CLASS_EXPORT T2DlgItemTable : public T2DlgItem, public LListener { public: enum ScrollerStyle { ShowIfNeeded, @@ -95,7 +95,7 @@ private: BOOL Resized(); }; -class AFX_EXT_CLASS TableCellIterator { +class AFX_CLASS_EXPORT TableCellIterator { public: TableCellIterator(const TableCellT& start, const TableCellT& end); BOOL Next(TableCellT& newCurrent); diff --git a/src/T2DLL/T2DlgItemText.cpp b/src/T2DLL/T2DlgItemText.cpp index e8bd018..6466376 100644 --- a/src/T2DLL/T2DlgItemText.cpp +++ b/src/T2DLL/T2DlgItemText.cpp @@ -1,5 +1,11 @@ #include "T2DlgItemText.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + T2DlgItemText::T2DlgItemText(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette) : T2DlgItem(inDoc, inImageObj, inPalette) , mHasTextColor(false) diff --git a/src/T2DLL/T2DlgItemText.h b/src/T2DLL/T2DlgItemText.h index 687e5a8..6c85cfa 100644 --- a/src/T2DLL/T2DlgItemText.h +++ b/src/T2DLL/T2DlgItemText.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2DlgItem.h" -class AFX_EXT_CLASS T2DlgItemText : public T2DlgItem { +class AFX_CLASS_EXPORT T2DlgItemText : public T2DlgItem { public: T2DlgItemText(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); virtual void GetDescriptor(CString&) const; diff --git a/src/T2DLL/T2DlgItemVScr.cpp b/src/T2DLL/T2DlgItemVScr.cpp index e852793..2dcf999 100644 --- a/src/T2DLL/T2DlgItemVScr.cpp +++ b/src/T2DLL/T2DlgItemVScr.cpp @@ -1,12 +1,19 @@ #include "T2BitImage.h" #include "T2DlgItemVScr.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + T2DlgItemVScr::T2DlgItemVScr(T2TowerDoc* towerDoc, T2ImageObj* imageObj, CPalette* palette) : T2DlgItemScr(towerDoc, imageObj, palette) { } /*virtual*/ BOOL T2DlgItemVScr::OnT2DlgItemEraseBkgnd(CDC* dc) { +#pragma var_order(imgRect, thumbSize, brush, rect, image, destRect, pen1, pen2, savedDC, pen3, thumbPosition) CRect rect; GetClientRect(rect); @@ -40,14 +47,12 @@ T2DlgItemVScr::T2DlgItemVScr(T2TowerDoc* towerDoc, T2ImageObj* imageObj, CPalett int thumbPosition, thumbSize; CalcScrollBarThumb(&thumbPosition, &thumbSize); - int upImg; - if (!IsScrollable()) - upImg = 200; - else - upImg = (mUpImage == 100) ? 100 : 0; - RECT imgRect; - T2BitImage *image = GetObjectImage(imgRect, "DLGITEM:UArrow", upImg); + T2BitImage *image = GetObjectImage( + imgRect, + "DLGITEM:UArrow", + !IsScrollable() ? 200 : (mUpImage == 100) ? 100 : 0 + ); RECT destRect = rect; destRect.top = 0; @@ -55,13 +60,11 @@ T2DlgItemVScr::T2DlgItemVScr(T2TowerDoc* towerDoc, T2ImageObj* imageObj, CPalett dc->Rectangle(&destRect); image->CopyImage(dc, imgRect, destRect, 0, NULL); - int dnImg; - if (!IsScrollable()) - dnImg = 200; - else - dnImg = (mDownImage == 100) ? 100 : 0; - - image = GetObjectImage(imgRect, "DLGITEM:UArrow", dnImg); + image = GetObjectImage( + imgRect, + "DLGITEM:DArrow", + !IsScrollable() ? 200 : (mDownImage == 100) ? 100 : 0 + ); destRect = rect; destRect.top = destRect.bottom - (imgRect.bottom - imgRect.top); diff --git a/src/T2DLL/T2DlgItemVScr.h b/src/T2DLL/T2DlgItemVScr.h index 564aec6..9d98c15 100644 --- a/src/T2DLL/T2DlgItemVScr.h +++ b/src/T2DLL/T2DlgItemVScr.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2DlgItemScr.h" -class AFX_EXT_CLASS T2DlgItemVScr : public T2DlgItemScr { +class AFX_CLASS_EXPORT T2DlgItemVScr : public T2DlgItemScr { public: T2DlgItemVScr(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); protected: diff --git a/src/T2DLL/T2DrawableObject.h b/src/T2DLL/T2DrawableObject.h index 06a2ac8..42bdca3 100644 --- a/src/T2DLL/T2DrawableObject.h +++ b/src/T2DLL/T2DrawableObject.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2Object.h" -class AFX_EXT_CLASS T2DrawableObject : public T2Object { +class AFX_CLASS_EXPORT T2DrawableObject : public T2Object { public: T2DrawableObject(); virtual ~T2DrawableObject(); diff --git a/src/T2DLL/T2ElevatorModule.h b/src/T2DLL/T2ElevatorModule.h index 78b737d..c1151fe 100644 --- a/src/T2DLL/T2ElevatorModule.h +++ b/src/T2DLL/T2ElevatorModule.h @@ -20,7 +20,7 @@ enum { kElevatorDirection2 }; -class AFX_EXT_CLASS T2ElevatorModule : public T2MoverModule { +class AFX_CLASS_EXPORT T2ElevatorModule : public T2MoverModule { public: T2ElevatorModule(int index); virtual ~T2ElevatorModule(); @@ -50,6 +50,7 @@ public: T2People* LeaveToDstFloor(int y); int GetIndex() const { return mIndex; } + int GetHomePosition() const; void SetHomePosition(int v) { mHomePosition = v; } int GetOffsetPos() { return mOffsetPos; } void SetOffsetPos(int v) { mOffsetPos = v; } @@ -57,12 +58,6 @@ public: int GetNextStop() const { return mNextStop; } int GetTopTurn() const { return mTopTurn; } int GetBottomTurn() const { return mBottomTurn; } - int GetHomePosition() const { - int result = -1; - if (mUsed) - result = mHomePosition; - return result; - } protected: virtual void LoadSelf(T2Archive&, T2TowerDoc*); @@ -84,3 +79,10 @@ protected: int mBottomTurn; T2StopInfoArray *mStopInfoArray; }; + +inline int T2ElevatorModule::GetHomePosition() const { + int result = -1; + if (mUsed) + result = mHomePosition; + return result; +} diff --git a/src/T2DLL/T2ElvModuleList.h b/src/T2DLL/T2ElvModuleList.h index 122b335..1547a0f 100644 --- a/src/T2DLL/T2ElvModuleList.h +++ b/src/T2DLL/T2ElvModuleList.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2MoverModuleList.h" -class AFX_EXT_CLASS T2ElvModuleList : public T2MoverModuleList { +class AFX_CLASS_EXPORT T2ElvModuleList : public T2MoverModuleList { public: T2ElvModuleList(); virtual ~T2ElvModuleList(); diff --git a/src/T2DLL/T2Equip.cpp b/src/T2DLL/T2Equip.cpp index 4d43a2b..ebebcda 100644 --- a/src/T2DLL/T2Equip.cpp +++ b/src/T2DLL/T2Equip.cpp @@ -1,8 +1,8 @@ #include "GlobalFunc.h" #include "T2Archive.h" -#include "T2CrossEquipArray.h" #include "T2DateTime.h" #include "T2Equip.h" +#include "T2RouteCEArray.h" #include "T2SoundPlayer.h" #include "T2TowerDoc.h" @@ -54,12 +54,12 @@ int T2Equip::InitEquip(T2EquipDef* def, const RECT& area, unsigned int valiation return true; } -/*virtual*/ void T2Equip::SetUsed(int used) { - if (!used && mCEArray) { +/*virtual*/ void T2Equip::SetUsed(BOOL inUsed) { + if (!inUsed && mCEArray) { delete mCEArray; mCEArray = NULL; } - T2HaveOutViewObject::SetUsed(used); + T2HaveOutViewObject::SetUsed(inUsed); } int T2Equip::DaysSinceBuilt(const T2TowerDoc* towerDoc) const { @@ -94,7 +94,7 @@ void T2Equip::SetEquipArea(const RECT& rect) { void T2Equip::InsertCEID(int a, int b) { if (mCEArray) - mCEArray->Insert(a, b); + ((T2RouteCEArray *) mCEArray)->Insert(a, b); } void T2Equip::RemoveCEID(int id) { @@ -210,6 +210,6 @@ void T2Equip::ReplaceCEID(unsigned int oldID, unsigned int newID) { m58 = false; } -void T2Equip::GetTypicalName(CString& outStr) const { +inline void T2Equip::GetTypicalName(CString& outStr) const { GetEquipDef()->GetName(outStr, GetValiation()); } diff --git a/src/T2DLL/T2Equip.h b/src/T2DLL/T2Equip.h index 1ed1c00..2c0aa2e 100644 --- a/src/T2DLL/T2Equip.h +++ b/src/T2DLL/T2Equip.h @@ -2,63 +2,61 @@ #include "common.h" #include "T2EquipDef.h" #include "T2HaveOutViewObject.h" -#include "T2RouteCEArray.h" -class AFX_EXT_CLASS T2Equip : public T2HaveOutViewObject { +class AFX_CLASS_EXPORT T2Equip : public T2HaveOutViewObject { public: T2Equip(); virtual ~T2Equip(); - virtual void SetUsed(int); + unsigned int GetAttribute() const { return mAttribute; } + int IsSetAttribute(unsigned int a) const { return (mAttribute & a) != 0; } + int IsMover() const { return IsSetAttribute(kToolAttrIsMover); } + int IsNormalMenteCost() const { return IsSetAttribute(kToolAttrNormalMenteCost); } + virtual void SetUsed(BOOL inUsed); virtual T2InfoDialog* ShowInfoDialog(T2TowerDoc*); virtual void DrawHitMask(T2TowerDoc*); virtual int IsNeedDraw() const { return true; } virtual int GetOutMoney() const; virtual int GetInMoney() const; + + unsigned int GetEquipID() const { return mEquipID; } + void SetEquipDef(T2EquipDef* equipDef) { + SetToolDef(equipDef); + } + void GetEquipArea(RECT& rect) const { + rect = mArea; + } + int GetAreaWidth() const { return mArea.right - mArea.left; } + int GetAreaHeight() const { return mArea.bottom - mArea.top; } + int GetEquipType() const { return mEquipType; } + int GetCapacity() const { return mCapacity; } + int GetInMoneyIndex() const { return mInMoneyIndex; } + virtual void BuildStart(T2TowerDoc*) {} virtual int IsBuildFinish() { return true; } + int GetBuildDay() const { return mBuildDay; } + virtual PARTCODE GetPartFromPoint(T2TowerDoc*, POINT, int*); virtual PARTCODE GetClickPart(T2TowerDoc*, CPoint, int*); virtual PROCCODE DoDestruct(T2TowerDoc*, POINT, RECT&); - virtual void SetDrawMode(int drawMode) { - if (mDrawMode != drawMode) - mDrawMode = drawMode; - } - virtual void ClearDrawMode() { - mDrawMode = DrawMode0; - } + virtual void SetDrawMode(int drawMode); + virtual void ClearDrawMode(); + int GetDrawMode() const; virtual void PlaySound(T2TowerDoc*, int, unsigned int, unsigned int) const; int InitEquip(T2EquipDef* def, const RECT& area, unsigned int valiation); int DaysSinceBuilt(const T2TowerDoc*) const; void SetEquipArea(const RECT&); + + T2CrossEquipArray* GetCEArray() const; void InsertCEID(int, int); void RemoveCEID(int); void ReplaceCEID(unsigned int, unsigned int); void GetTypicalName(CString&) const; - unsigned int GetAttribute() const { return mAttribute; } - int IsSetAttribute(unsigned int a) const { return (mAttribute & a) != 0; } - int IsMover() const { return IsSetAttribute(kToolAttrIsMover); } - int IsNormalMenteCost() const { return IsSetAttribute(kToolAttrNormalMenteCost); } - unsigned int GetEquipID() const { return mEquipID; } - void SetEquipDef(T2EquipDef* equipDef) { - SetToolDef(equipDef); - } - void GetEquipArea(RECT& rect) const { - rect = mArea; - } - int GetAreaWidth() const { return mArea.right - mArea.left; } - int GetAreaHeight() const { return mArea.bottom - mArea.top; } - int GetEquipType() const { return mEquipType; } - int GetCapacity() const { return mCapacity; } - int GetInMoneyIndex() const { return mInMoneyIndex; } - int GetBuildDay() const { return mBuildDay; } - int GetDrawMode() const { return mDrawMode; } - T2CrossEquipArray* GetCEArray() const { return mCEArray; } - T2EquipDef* GetEquipDef() const { return (T2EquipDef *) mToolDef; } - void SetInMoneyIndex(int i) { mInMoneyIndex = i; } - int GetPatIndex() const { return mPatIndex; } - void SetPatIndex(int i) { mPatIndex = i; } + T2EquipDef* GetEquipDef() const; + void SetInMoneyIndex(int i); + int GetPatIndex() const; + void SetPatIndex(int i); unsigned int mEquipID; RECT mArea; @@ -78,3 +76,36 @@ protected: virtual void LoadSelf(T2Archive&, T2TowerDoc*); virtual void SaveSelf(T2Archive&); }; + +inline /*virtual*/ void T2Equip::SetDrawMode(int drawMode) { + if (mDrawMode != drawMode) + mDrawMode = drawMode; +} + +inline /*virtual*/ void T2Equip::ClearDrawMode() { + mDrawMode = DrawMode0; +} + +inline int T2Equip::GetDrawMode() const { + return mDrawMode; +} + +inline T2CrossEquipArray* T2Equip::GetCEArray() const { + return mCEArray; +} + +inline T2EquipDef* T2Equip::GetEquipDef() const { + return (T2EquipDef *) mToolDef; +} + +inline void T2Equip::SetInMoneyIndex(int i) { + mInMoneyIndex = i; +} + +inline int T2Equip::GetPatIndex() const { + return mPatIndex; +} + +inline void T2Equip::SetPatIndex(int i) { + mPatIndex = i; +} diff --git a/src/T2DLL/T2EquipDef.h b/src/T2DLL/T2EquipDef.h index aed9a66..fe6fe3e 100644 --- a/src/T2DLL/T2EquipDef.h +++ b/src/T2DLL/T2EquipDef.h @@ -2,53 +2,52 @@ #include "common.h" #include "T2ToolDef.h" -class AFX_EXT_CLASS T2EquipDef : public T2ToolDef { +class AFX_CLASS_EXPORT T2EquipDef : public T2ToolDef { public: T2EquipDef(DWORD type, T2PluginSpecifier& specifier, CResFile* resFile, T2WorldDef* worldDef, T2EquipPlugin* plugin); virtual ~T2EquipDef(); virtual BOOL InitObject(T2Object*); - virtual BOOL IsMover() { return IsSetAttribute(kToolAttrIsMover); } + + BOOL IsSetAttribute(unsigned int a) { + return (mAttribute & a) != 0; + } + virtual BOOL IsMover() { return IsSetAttribute(kToolAttrIsMover); } + BOOL IsAbleDragMaking() { return IsSetAttribute(kEquipAttrIsAbleDragMaking); } + int GetNumOfInMoney() const { return mNumOfInMoney; } + virtual void LoadExtraData(T2Archive& inArchive, T2TowerDoc*, T2HaveOutViewObject*); virtual void SaveExtraData(T2Archive& inArchive, T2HaveOutViewObject*); virtual AREACHECKCODE AreaCheck(T2TowerDoc*, RECT&, unsigned int, int); virtual int ClickProc(T2TowerDoc*, RECT*, unsigned int&); virtual int GetDestructPartProc(int, POINT, POINT, T2Equip*); virtual PARTCODE GetPartFromPoint(T2TowerDoc*, T2Equip*, POINT, int*); - virtual PROCCODE DoBuildProc(T2TowerDoc*, RECT&, unsigned int) { - return ProcCode_0; - } - virtual int FingerToolProc(T2TowerDoc*, T2Equip*, const POINT&, MOUSEEVENT); + virtual PROCCODE DoBuildProc(T2TowerDoc*, RECT&, unsigned int) { + return ProcCode_0; + } + virtual int FingerToolProc(T2TowerDoc*, T2Equip*, const POINT&, MOUSEEVENT); virtual void BuildFinish(T2TowerDoc*, T2Equip*); virtual unsigned long OptionProc(T2TowerDoc*, T2Equip*, void*); virtual void DrawPeople(T2TowerDoc* inDoc, T2Equip* inEquip); virtual int GetInfoDialogID(T2TowerDoc*, const T2Equip*) const; virtual T2InfoDialog* ShowInfoDialog(T2TowerDoc*, T2Equip*); virtual T2InfoDialog* ConstructInfoDialog(T2Equip*); - virtual int EmergencyProc(T2TowerDoc*, T2Equip*) { - return 0; - } - virtual int BurntDownProc(T2TowerDoc*, T2Equip*) { - return 0; - } - virtual void DebugInfo(CWnd&, CListCtrl&, T2Equip*); + + virtual int EmergencyProc(T2TowerDoc*, T2Equip*) { + return DrawMode0; + } + virtual int BurntDownProc(T2TowerDoc*, T2Equip*) { + return 0; + } + + virtual void DebugInfo(CWnd&, CListCtrl&, T2Equip*); int GetInMoney(int); void GetWords(T2People*, CString&) const; - BOOL IsSetAttribute(unsigned int a) { - return (mAttribute & a) != 0; - } - BOOL IsAbleDragMaking() { return IsSetAttribute(kEquipAttrIsAbleDragMaking); } - int GetNumOfInMoney() const { return mNumOfInMoney; } - int GetEquipType() const { return mToolType; } - void CalcEquipRect(RECT& rect) const { - rect.top = 0; - rect.left = 0; - rect.bottom = mHeight; - rect.right = mWidth; - } - int GetCapacity() const { return mCapacity; } - unsigned int GetAttribute() const { return mAttribute; } + int GetEquipType() const; + void CalcEquipRect(RECT& rect) const; + int GetCapacity() const; + unsigned int GetAttribute() const; protected: T2WordDefArray* MakeWordDefArray(); @@ -68,3 +67,13 @@ protected: int mInMoney[4]; int m154; }; + +inline int T2EquipDef::GetEquipType() const { return mToolType; } +inline void T2EquipDef::CalcEquipRect(RECT& rect) const { + rect.top = 0; + rect.left = 0; + rect.bottom = mHeight; + rect.right = mWidth; +} +inline int T2EquipDef::GetCapacity() const { return mCapacity; } +inline unsigned int T2EquipDef::GetAttribute() const { return mAttribute; } diff --git a/src/T2DLL/T2EquipInfoDialog.cpp b/src/T2DLL/T2EquipInfoDialog.cpp index 7476149..024a06c 100644 --- a/src/T2DLL/T2EquipInfoDialog.cpp +++ b/src/T2DLL/T2EquipInfoDialog.cpp @@ -1,3 +1,4 @@ +#include "T2Equip.h" #include "T2EquipDef.h" #include "T2EquipInfoDialog.h" diff --git a/src/T2DLL/T2EquipInfoDialog.h b/src/T2DLL/T2EquipInfoDialog.h index 751e222..915aa7c 100644 --- a/src/T2DLL/T2EquipInfoDialog.h +++ b/src/T2DLL/T2EquipInfoDialog.h @@ -1,9 +1,8 @@ #pragma once #include "common.h" -#include "T2Equip.h" #include "T2InfoDialog.h" -class AFX_EXT_CLASS T2EquipInfoDialog : public T2InfoDialog { +class AFX_CLASS_EXPORT T2EquipInfoDialog : public T2InfoDialog { public: T2EquipInfoDialog(T2Equip* inEquip); virtual ~T2EquipInfoDialog(); diff --git a/src/T2DLL/T2EquipPlugin.h b/src/T2DLL/T2EquipPlugin.h index 24b13af..5c20d36 100644 --- a/src/T2DLL/T2EquipPlugin.h +++ b/src/T2DLL/T2EquipPlugin.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2ToolPlugin.h" -class AFX_EXT_CLASS T2EquipPlugin : public T2ToolPlugin { +class AFX_CLASS_EXPORT T2EquipPlugin : public T2ToolPlugin { public: T2EquipPlugin(DWORD type, T2PluginSpecifier& specifier); virtual ~T2EquipPlugin(); diff --git a/src/T2DLL/T2EquipPtrList.h b/src/T2DLL/T2EquipPtrList.h index 2c1edc9..5404425 100644 --- a/src/T2DLL/T2EquipPtrList.h +++ b/src/T2DLL/T2EquipPtrList.h @@ -2,7 +2,7 @@ #include "common.h" #include "LArray.h" -class AFX_EXT_CLASS T2EquipPtrList : public LArray { +class AFX_CLASS_EXPORT T2EquipPtrList : public LArray { public: T2EquipPtrList(unsigned int attribute = 0); virtual ~T2EquipPtrList(); diff --git a/src/T2DLL/T2EventItem.h b/src/T2DLL/T2EventItem.h index f4db346..844186a 100644 --- a/src/T2DLL/T2EventItem.h +++ b/src/T2DLL/T2EventItem.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS T2EventItem { +class AFX_CLASS_EXPORT T2EventItem { public: T2EventItem(T2TowerEvent* inTowerEvent, CResFile* inResFile, int inSubID); T2EventItem(T2TowerEvent* inTowerEvent, int inSubID, int inLevelBit, BOOL inExclusive, int inCycleDay, int inBeginTime, int inEndTime); diff --git a/src/T2DLL/T2FInfoAreaIterator.cpp b/src/T2DLL/T2FInfoAreaIterator.cpp index 5d81af0..d95ae82 100644 --- a/src/T2DLL/T2FInfoAreaIterator.cpp +++ b/src/T2DLL/T2FInfoAreaIterator.cpp @@ -103,10 +103,10 @@ BOOL T2FInfoAreaIterator::Next(T2UnitInfo*& outUnitInfo) { } BOOL T2FInfoAreaIterator::NextTenant(T2Tenant*& outTenant) { - BOOL result; + BOOL found; T2UnitInfo *unitInfo; - for (result = Next(unitInfo); result; result = Next(unitInfo)) { + for (found = Next(unitInfo); found; found = Next(unitInfo)) { unsigned int tenantID = unitInfo->GetTenantID(); if (tenantID != mLastIDSeen) { mLastIDSeen = tenantID; @@ -117,7 +117,7 @@ BOOL T2FInfoAreaIterator::NextTenant(T2Tenant*& outTenant) { } } - return result; + return found; } void T2FInfoAreaIterator::GetTenantRect(RECT& outRect) { @@ -127,7 +127,7 @@ void T2FInfoAreaIterator::GetTenantRect(RECT& outRect) { if (IsValidPosition()) { outRect.right++; T2UnitInfo *unitInfo = mCurrUnitInfo + 1; - while (unitInfo->GetTenantID() == mLastIDSeen) { + while (mLastIDSeen == unitInfo->GetTenantID()) { outRect.right++; unitInfo++; } @@ -135,10 +135,10 @@ void T2FInfoAreaIterator::GetTenantRect(RECT& outRect) { } BOOL T2FInfoAreaIterator::NextRequest(T2Request*& outRequest) { - BOOL result; + BOOL found; T2UnitInfo *unitInfo; - for (result = Next(unitInfo); result; result = Next(unitInfo)) { + for (found = Next(unitInfo); found; found = Next(unitInfo)) { unsigned int requestID = unitInfo->GetRequestID(); if (requestID != mLastIDSeen) { mLastIDSeen = requestID; @@ -149,14 +149,14 @@ BOOL T2FInfoAreaIterator::NextRequest(T2Request*& outRequest) { } } - return result; + return found; } BOOL T2FInfoAreaIterator::NextMover(T2Mover*& outMover) { - BOOL result; + BOOL found; T2UnitInfo *unitInfo; - for (result = Next(unitInfo); result; result = Next(unitInfo)) { + for (found = Next(unitInfo); found; found = Next(unitInfo)) { unsigned int moverID = unitInfo->GetMoverID(); if (moverID != mLastIDSeen) { mLastIDSeen = moverID; @@ -167,147 +167,5 @@ BOOL T2FInfoAreaIterator::NextMover(T2Mover*& outMover) { } } - return result; -} - - - -T2FInfoPtIterator::T2FInfoPtIterator(const T2FloorInfo& inFloorInfo, POINT inPt) - : mFloorInfo(inFloorInfo) - , mLeftBound(mFloorInfo.mBuildArea.left) - , mRightBound(mFloorInfo.mBuildArea.right - 1) -{ - if (PtInRect(&mFloorInfo.mBuildArea, inPt)) { - mCurrH = inPt.x; - mCurrUnitInfo = mFloorInfo.GetUnitInfo(inPt.y, mCurrH); - mLastIDSeen = 0; - } else { - mCurrH = -2; - } -} - -/*virtual*/ T2FInfoPtIterator::~T2FInfoPtIterator() { -} - -BOOL T2FInfoPtIterator::CurrentH(int& outH) const { - BOOL result = true; - - if (IsValidPosition()) - outH = mCurrH; - else - result = false; - - return result; -} - -BOOL T2FInfoPtIterator::CalcRightUnitInfo() { - BOOL result = true; - - if (mCurrH != -2) { - if (mCurrH != -1) { - if (mCurrH < mRightBound) { - mCurrH++; - mCurrUnitInfo++; - } else { - mCurrH = -2; - result = false; - } - } else { - mCurrH = mLeftBound; - } - } else { - result = false; - } - - return result; -} - -BOOL T2FInfoPtIterator::CalcLeftUnitInfo() { - BOOL result = true; - - if (mCurrH != -2) { - if (mCurrH != -1) { - if (mCurrH > mLeftBound) { - mCurrH--; - mCurrUnitInfo--; - } else { - result = false; - } - } else { - mCurrH = mRightBound; - } - } else { - result = false; - } - - return result; -} - -BOOL T2FInfoPtIterator::Current(T2UnitInfo*& outUnitInfo) { - BOOL result = true; - - if (IsValidPosition()) - outUnitInfo = mCurrUnitInfo; - else - result = false; - - return result; -} - -BOOL T2FInfoPtIterator::Right(T2UnitInfo*& outUnitInfo) { - BOOL result = true; - - if (CalcRightUnitInfo()) - outUnitInfo = mCurrUnitInfo; - else - result = false; - - return result; -} - -BOOL T2FInfoPtIterator::Left(T2UnitInfo*& outUnitInfo) { - BOOL result = true; - - if (CalcLeftUnitInfo()) - outUnitInfo = mCurrUnitInfo; - else - result = false; - - return result; -} - -BOOL T2FInfoPtIterator::RightTenant(T2Tenant*& outTenant) { - BOOL result; - T2UnitInfo *unitInfo; - - for (result = Right(unitInfo); result; result = Right(unitInfo)) { - unsigned int tenantID = unitInfo->GetTenantID(); - if (tenantID != mLastIDSeen) { - mLastIDSeen = tenantID; - if (tenantID != 0) { - outTenant = mFloorInfo.mTenantArrayList->GetTenantByID(tenantID); - break; - } - } - } - - return result; -} - -BOOL T2FInfoPtIterator::LeftTenant(T2Tenant*& outTenant) { - BOOL result; - T2UnitInfo *unitInfo; - - for (result = Left(unitInfo); result; result = Left(unitInfo)) { - unsigned int tenantID = unitInfo->GetTenantID(); - if (tenantID != mLastIDSeen) { - mLastIDSeen = tenantID; - if (tenantID != 0) { - outTenant = mFloorInfo.mTenantArrayList->GetTenantByID(tenantID); - break; - } - } - } - - return result; + return found; } diff --git a/src/T2DLL/T2FInfoAreaIterator.h b/src/T2DLL/T2FInfoAreaIterator.h index fcd389a..1a35d42 100644 --- a/src/T2DLL/T2FInfoAreaIterator.h +++ b/src/T2DLL/T2FInfoAreaIterator.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS T2FInfoAreaIterator { +class AFX_CLASS_EXPORT T2FInfoAreaIterator { public: T2FInfoAreaIterator(const T2FloorInfo& inFloorInfo, const RECT&); virtual ~T2FInfoAreaIterator(); @@ -17,9 +17,7 @@ public: protected: BOOL CalcNextUnitInfo(); - BOOL IsValidPosition() const { - return (mCurrH > -1); - } + BOOL IsValidPosition() const; const T2FloorInfo &mFloorInfo; RECT mRect; @@ -30,29 +28,6 @@ protected: unsigned int mLastIDSeen; }; -class AFX_EXT_CLASS T2FInfoPtIterator { -public: - T2FInfoPtIterator(const T2FloorInfo& inFloorInfo, POINT inPt); - virtual ~T2FInfoPtIterator(); - - BOOL CurrentH(int& outH) const; - BOOL Current(T2UnitInfo*& outUnitInfo); - BOOL Right(T2UnitInfo*& outUnitInfo); - BOOL Left(T2UnitInfo*& outUnitInfo); - BOOL RightTenant(T2Tenant*& outTenant); - BOOL LeftTenant(T2Tenant*& outTenant); - -protected: - BOOL CalcRightUnitInfo(); - BOOL CalcLeftUnitInfo(); - BOOL IsValidPosition() const { - return (mCurrH > -1); - } - - const T2FloorInfo &mFloorInfo; - int mLeftBound; - int mRightBound; - int mCurrH; - T2UnitInfo *mCurrUnitInfo; - unsigned int mLastIDSeen; -}; +inline BOOL T2FInfoAreaIterator::IsValidPosition() const { + return (mCurrH > -1); +} diff --git a/src/T2DLL/T2FInfoPtIterator.cpp b/src/T2DLL/T2FInfoPtIterator.cpp new file mode 100644 index 0000000..f3f2872 --- /dev/null +++ b/src/T2DLL/T2FInfoPtIterator.cpp @@ -0,0 +1,147 @@ +#include "GlobalFunc.h" +#include "T2FInfoPtIterator.h" +#include "T2FloorInfo.h" +#include "T2MoverArrayList.h" +#include "T2RequestArrayList.h" +#include "T2TenantArrayList.h" +#include "T2UnitInfo.h" + +T2FInfoPtIterator::T2FInfoPtIterator(const T2FloorInfo& inFloorInfo, POINT inPt) + : mFloorInfo(inFloorInfo) + , mLeftBound(mFloorInfo.mBuildArea.left) + , mRightBound(mFloorInfo.mBuildArea.right - 1) +{ + if (PtInRect(&mFloorInfo.mBuildArea, inPt)) { + mCurrH = inPt.x; + mCurrUnitInfo = mFloorInfo.GetUnitInfo(inPt.y, mCurrH); + mLastIDSeen = 0; + } else { + mCurrH = -2; + } +} + +/*virtual*/ T2FInfoPtIterator::~T2FInfoPtIterator() { +} + +BOOL T2FInfoPtIterator::CurrentH(int& outH) const { + BOOL result = true; + + if (IsValidPosition()) + outH = mCurrH; + else + result = false; + + return result; +} + +BOOL T2FInfoPtIterator::CalcRightUnitInfo() { + BOOL result = true; + + if (mCurrH != -2) { + if (mCurrH != -1) { + if (mCurrH < mRightBound) { + mCurrH++; + mCurrUnitInfo++; + } else { + mCurrH = -2; + result = false; + } + } else { + mCurrH = mLeftBound; + } + } else { + result = false; + } + + return result; +} + +BOOL T2FInfoPtIterator::CalcLeftUnitInfo() { + BOOL result = true; + + if (mCurrH != -2) { + if (mCurrH != -1) { + if (mCurrH > mLeftBound) { + mCurrH--; + mCurrUnitInfo--; + } else { + result = false; + } + } else { + mCurrH = mRightBound; + } + } else { + result = false; + } + + return result; +} + +BOOL T2FInfoPtIterator::Current(T2UnitInfo*& outUnitInfo) { + BOOL result = true; + + if (IsValidPosition()) + outUnitInfo = mCurrUnitInfo; + else + result = false; + + return result; +} + +BOOL T2FInfoPtIterator::Right(T2UnitInfo*& outUnitInfo) { + BOOL result = true; + + if (CalcRightUnitInfo()) + outUnitInfo = mCurrUnitInfo; + else + result = false; + + return result; +} + +BOOL T2FInfoPtIterator::Left(T2UnitInfo*& outUnitInfo) { + BOOL result = true; + + if (CalcLeftUnitInfo()) + outUnitInfo = mCurrUnitInfo; + else + result = false; + + return result; +} + +BOOL T2FInfoPtIterator::RightTenant(T2Tenant*& outTenant) { + BOOL found; + T2UnitInfo *unitInfo; + + for (found = Right(unitInfo); found; found = Right(unitInfo)) { + unsigned int tenantID = unitInfo->GetTenantID(); + if (tenantID != mLastIDSeen) { + mLastIDSeen = tenantID; + if (tenantID != 0) { + outTenant = mFloorInfo.mTenantArrayList->GetTenantByID(tenantID); + break; + } + } + } + + return found; +} + +BOOL T2FInfoPtIterator::LeftTenant(T2Tenant*& outTenant) { + BOOL found; + T2UnitInfo *unitInfo; + + for (found = Left(unitInfo); found; found = Left(unitInfo)) { + unsigned int tenantID = unitInfo->GetTenantID(); + if (tenantID != mLastIDSeen) { + mLastIDSeen = tenantID; + if (tenantID != 0) { + outTenant = mFloorInfo.mTenantArrayList->GetTenantByID(tenantID); + break; + } + } + } + + return found; +} diff --git a/src/T2DLL/T2FInfoPtIterator.h b/src/T2DLL/T2FInfoPtIterator.h new file mode 100644 index 0000000..95c0660 --- /dev/null +++ b/src/T2DLL/T2FInfoPtIterator.h @@ -0,0 +1,31 @@ +#pragma once +#include "common.h" + +class AFX_CLASS_EXPORT T2FInfoPtIterator { +public: + T2FInfoPtIterator(const T2FloorInfo& inFloorInfo, POINT inPt); + virtual ~T2FInfoPtIterator(); + + BOOL CurrentH(int& outH) const; + BOOL Current(T2UnitInfo*& outUnitInfo); + BOOL Right(T2UnitInfo*& outUnitInfo); + BOOL Left(T2UnitInfo*& outUnitInfo); + BOOL RightTenant(T2Tenant*& outTenant); + BOOL LeftTenant(T2Tenant*& outTenant); + +protected: + BOOL CalcRightUnitInfo(); + BOOL CalcLeftUnitInfo(); + BOOL IsValidPosition() const; + + const T2FloorInfo &mFloorInfo; + int mLeftBound; + int mRightBound; + int mCurrH; + T2UnitInfo *mCurrUnitInfo; + unsigned int mLastIDSeen; +}; + +inline BOOL T2FInfoPtIterator::IsValidPosition() const { + return (mCurrH > -1); +} diff --git a/src/T2DLL/T2FireBurning.cpp b/src/T2DLL/T2FireBurning.cpp index b8cc60d..3ec86e0 100644 --- a/src/T2DLL/T2FireBurning.cpp +++ b/src/T2DLL/T2FireBurning.cpp @@ -5,6 +5,7 @@ #include "T2DateTime.h" #include "T2Dialog.h" #include "T2DlgItem.h" +#include "T2DLL.h" #include "T2EquipPtrList.h" #include "T2FireBurning.h" #include "T2FloorInfo.h" @@ -743,7 +744,7 @@ void T2Helicopter::Move(T2TowerDoc* inDoc) { mSpeed += (mSpeed < 8); float ratio = dst / mSpeed; - if (ratio > 1.0f) { + if (ratio > 1.0) { p.x += (int) (h / ratio); p.y += (int) (v / ratio); } else { diff --git a/src/T2DLL/T2FireBurning.h b/src/T2DLL/T2FireBurning.h index 6e5f3da..6aca35c 100644 --- a/src/T2DLL/T2FireBurning.h +++ b/src/T2DLL/T2FireBurning.h @@ -16,7 +16,7 @@ enum { kFireFightDoNothing = 3, }; -class AFX_EXT_CLASS T2FireBurning : public T2EventItem { +class AFX_CLASS_EXPORT T2FireBurning : public T2EventItem { public: T2FireBurning(T2TowerEvent* inTowerEvent, CResFile* inResFile, int inSubID); virtual ~T2FireBurning(); @@ -53,7 +53,7 @@ protected: T2PeoplePtrList *mPeopleList; }; -class AFX_EXT_CLASS T2Fire { +class AFX_CLASS_EXPORT T2Fire { public: T2Fire(POINT& inPt, T2TowerDoc* inDoc, int inVar, T2ImageObj* inImageObj); ~T2Fire(); @@ -80,7 +80,7 @@ protected: T2People *mFireman; }; -class AFX_EXT_CLASS T2Helicopter { +class AFX_CLASS_EXPORT T2Helicopter { public: T2Helicopter(T2TowerDoc* inDoc, const T2Tenant* inTenant); ~T2Helicopter(); @@ -97,7 +97,7 @@ public: BOOL mWaterVisible; }; -class AFX_EXT_CLASS T2FireAttach : public LAttachment { +class AFX_CLASS_EXPORT T2FireAttach : public LAttachment { public: T2FireAttach(T2EventItem* inOwner, unsigned int inMessage, BOOL inExecuteHost); virtual ~T2FireAttach(); diff --git a/src/T2DLL/T2FireWork.cpp b/src/T2DLL/T2FireWork.cpp index 38a27a5..0929af8 100644 --- a/src/T2DLL/T2FireWork.cpp +++ b/src/T2DLL/T2FireWork.cpp @@ -1,5 +1,5 @@ -#include "GlobalFunc.h" #include "T2BitImage.h" +#include "T2DLL.h" #include "T2FireWork.h" #include "T2SoundPlayer.h" diff --git a/src/T2DLL/T2FireWork.h b/src/T2DLL/T2FireWork.h index 37b3fc0..4c912e3 100644 --- a/src/T2DLL/T2FireWork.h +++ b/src/T2DLL/T2FireWork.h @@ -14,7 +14,7 @@ struct FIREWORK_STARINFO { float m24; }; -class AFX_EXT_CLASS T2FireWork { +class AFX_CLASS_EXPORT T2FireWork { public: T2FireWork(int inWidth, int inHeight, CPalette* inPalette); ~T2FireWork(); diff --git a/src/T2DLL/T2FloorCEArray.h b/src/T2DLL/T2FloorCEArray.h index da267a7..adbda2b 100644 --- a/src/T2DLL/T2FloorCEArray.h +++ b/src/T2DLL/T2FloorCEArray.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2RouteCEArray.h" -class AFX_EXT_CLASS T2FloorCEArray : public T2RouteCEArray { +class AFX_CLASS_EXPORT T2FloorCEArray : public T2RouteCEArray { public: T2FloorCEArray(); virtual ~T2FloorCEArray(); diff --git a/src/T2DLL/T2FloorInfo.cpp b/src/T2DLL/T2FloorInfo.cpp index 7ab47a6..0bd508c 100644 --- a/src/T2DLL/T2FloorInfo.cpp +++ b/src/T2DLL/T2FloorInfo.cpp @@ -2,6 +2,7 @@ #include "GlobalFunc.h" #include "T2Archive.h" #include "T2FInfoAreaIterator.h" +#include "T2FInfoPtIterator.h" #include "T2FloorInfo.h" #include "T2Mover.h" #include "T2MoverArray.h" @@ -74,7 +75,12 @@ T2FloorInfo::T2FloorInfo(const T2WorldDef* inWorldDef) { } int T2FloorInfo::UnitToFloor(int unit) const { - return (unit < mGroundLine) ? (mGroundLine - unit) : ((mGroundLine - unit) - 1); + int result; + if (unit < mGroundLine) + result = mGroundLine - unit; + else + result = mGroundLine - unit - 1; + return result; } void T2FloorInfo::InitMask(CResFile& inResFile) { @@ -86,10 +92,10 @@ void T2FloorInfo::InitMask(CResFile& inResFile) { #line 211 _ASSERT((vcheck == mVRange) && (hcheck == mHRange)); - int tmp; - RECT tmpRect; - inResFile >> tmp; - inResFile >> tmpRect; + int someUnkVal; + RECT someUnkRect; + inResFile >> someUnkVal; + inResFile >> someUnkRect; for (int i = 0; i < (mVRange * mHRange); i++) mUnitInfo[i].InitMask(inResFile); @@ -107,35 +113,35 @@ void T2FloorInfo::Read(T2Archive& inArchive, T2TowerDoc* inDoc) { #line 234 _ASSERT((vcheck == mVRange) && (hcheck == mHRange)); - DWORD code; - inArchive >> code; + DWORD classID; + inArchive >> classID; #line 239 - _ASSERT(code == 'UntI'); + _ASSERT(classID == 'UntI'); - for (int i = 0; i < (mVRange * mHRange); i++) + for (int i = 0; i < (mHRange * mVRange); i++) mUnitInfo[i].Read(inArchive, inDoc); - inArchive >> code; - if (code == 'TntA') { + inArchive >> classID; + if (classID == 'TntA') { mTenantArrayList->Read(inArchive, inDoc); T2RegistedTenantDB *theDB = inDoc->towerDoc_vf174(); theDB->Init(mTenantArrayList); mTenantArrayList->RecoverRelatedTenantList(theDB); - inArchive >> code; + inArchive >> classID; } - if (code == 'MvrA') { + if (classID == 'MvrA') { mMoverArrayList->Read(inArchive, inDoc); - inArchive >> code; + inArchive >> classID; } - if (code == 'ReqA') { + if (classID == 'ReqA') { mRequestArrayList->Read(inArchive, inDoc); - inArchive >> code; + inArchive >> classID; } - if (code == 'OObA') { + if (classID == 'OObA') { mOutObjArrayList->Read(inArchive, inDoc); - inArchive >> code; + inArchive >> classID; } - if (code == 'OutI') + if (classID == 'OutI') mOutsideInfo->Read(inArchive); } @@ -143,29 +149,29 @@ void T2FloorInfo::Write(T2Archive& inArchive) { inArchive << mVRange; inArchive << mHRange; - DWORD code = 'UntI'; - inArchive << code; - for (int i = 0; i < (mVRange * mHRange); i++) + DWORD classID = 'UntI'; + inArchive << classID; + for (int i = 0; i < (mHRange * mVRange); i++) mUnitInfo[i].Write(inArchive); - code = 'TntA'; - inArchive << code; + classID = 'TntA'; + inArchive << classID; mTenantArrayList->Write(inArchive); - code = 'MvrA'; - inArchive << code; + classID = 'MvrA'; + inArchive << classID; mMoverArrayList->Write(inArchive); - code = 'ReqA'; - inArchive << code; + classID = 'ReqA'; + inArchive << classID; mRequestArrayList->Write(inArchive); - code = 'OObA'; - inArchive << code; + classID = 'OObA'; + inArchive << classID; mOutObjArrayList->Write(inArchive); - code = 'OutI'; - inArchive << code; + classID = 'OutI'; + inArchive << classID; mOutsideInfo->Write(inArchive); } @@ -198,10 +204,10 @@ BOOL T2FloorInfo::IsAllTenant(const RECT& inRect) { BOOL result = true; T2FInfoAreaIterator iterator(*this, inRect); - T2UnitInfo *unitInfo; + T2UnitInfo *theUnitInfo; - while (iterator.Next(unitInfo)) { - if (unitInfo->GetTenantID() < 1000) { + while (iterator.Next(theUnitInfo)) { + if (theUnitInfo->GetTenantID() < 1000) { result = false; break; } @@ -227,58 +233,58 @@ BOOL T2FloorInfo::IsThereNoFloorTenant(const RECT& inRect) { } BOOL T2FloorInfo::IsThereMover(const RECT& inRect) { - BOOL result = false; + BOOL found = false; T2FInfoAreaIterator iterator(*this, inRect); T2UnitInfo *theUnitInfo; while (iterator.Next(theUnitInfo)) { if (theUnitInfo->GetMoverID()) { - result = true; + found = true; break; } } - return result; + return found; } BOOL T2FloorInfo::IsThereOtherKindMover(const RECT& inRect, int inType) { - BOOL result = false; - unsigned int zero = 0; + BOOL found = false; + unsigned int noMoverID = 0; T2FInfoAreaIterator iterator(*this, inRect); T2UnitInfo *theUnitInfo; while (iterator.Next(theUnitInfo)) { unsigned int moverID = theUnitInfo->GetMoverID(); - if (moverID != 0 && moverID != zero) { + if (moverID != 0 && moverID != noMoverID) { T2Mover *theMover = GetMover(moverID); if (theMover && theMover->GetEquipType() != inType) { - result = true; + found = true; break; } } } - return result; + return found; } BOOL T2FloorInfo::IsEnoughSideSpace(const RECT& inRect) { - BOOL result = true; + BOOL isEnough = true; RECT rect = inRect; rect.right = rect.left; rect.left -= T2MoverDef::GetRequiredRequestSpace() * 2; - result = !IsThereMover(rect); + isEnough = !IsThereMover(rect); - if (result) { + if (isEnough) { rect = inRect; - rect.right = rect.left; - rect.left += T2MoverDef::GetRequiredRequestSpace() * 2; - result = !IsThereMover(rect); + rect.left = rect.right; + rect.right += T2MoverDef::GetRequiredRequestSpace() * 2; + isEnough = !IsThereMover(rect); } - return result; + return isEnough; } T2Tenant* T2FloorInfo::GetTenant(unsigned int inTenantID) const { @@ -305,19 +311,19 @@ T2Tenant* T2FloorInfo::GetPoolTenant() const { } T2Tenant* T2FloorInfo::GetFloor(int inV, int inH) const { - T2Tenant *result = NULL; + T2Tenant *floor = NULL; T2Tenant *theTenant = GetTenant(inV, inH); if (theTenant) { if (theTenant->IsFloor()) { - result = theTenant; + floor = theTenant; } else { unsigned int floorID = theTenant->GetFloorID(inV); - result = GetTenant(floorID); + floor = GetTenant(floorID); } } - return result; + return floor; } T2Mover* T2FloorInfo::GetMover(unsigned int inMoverID) { @@ -426,13 +432,13 @@ unsigned int T2FloorInfo::GetTenantID(int inV, int inH) const { } unsigned int T2FloorInfo::GetFloorID(int inV, int inH) { - unsigned int result = 0; + unsigned int theID = 0; T2Tenant *theTenant = GetTenant(inV, inH); if (theTenant) - result = theTenant->GetFloorID(inV); + theID = theTenant->GetFloorID(inV); - return result; + return theID; } unsigned int T2FloorInfo::GetEntranceFloorID(unsigned int inTenantID) { @@ -555,57 +561,57 @@ void T2FloorInfo::FillRequestID(const RECT& inRect, unsigned int inRequestID) { } int T2FloorInfo::FillRequestID(POINT inPt, ERequestUpDown inUpDown, unsigned int inRequestID) { - int result = 0; + int theWidth = 0; POINT pt = inPt; if (inUpDown == ERequestUpDown_1) { pt.x += 2; - T2Request *theRequest = GetRequest(pt.y, pt.x); - if (theRequest) { - POINT head = theRequest->GetHeadPosition(); - result = ((head.x - inPt.x) / 2) - 2; - int width = result + ((head.x - inPt.x) % 2); - theRequest->SetDrawWidth(width); + T2Request *theRightReq = GetRequest(pt.y, pt.x); + if (theRightReq) { + POINT headPtR = theRightReq->GetHeadPosition(); + theWidth = ((headPtR.x - inPt.x) / 2) - 2; + int theRemain = theWidth + ((headPtR.x - inPt.x) % 2); + theRightReq->SetDrawWidth(theRemain); } else { T2Tenant *theFloor = GetFloor(pt.y, pt.x); if (theFloor) { RECT floorArea; theFloor->GetEquipArea(floorArea); - result = CalcRequestRightEnd(pt, floorArea.right) - inPt.x - 2; + theWidth = CalcRequestRightEnd(pt, floorArea.right) - inPt.x - 2; } } } else { pt.x -= 3; - T2Request *theRequest = GetRequest(pt.y, pt.x); - if (theRequest) { - POINT head = theRequest->GetHeadPosition(); - int width = ((inPt.x - head.x) / 2) - 2; - theRequest->SetDrawWidth(width); - result = width + ((inPt.x - head.x) % 2); + T2Request *theLeftReq = GetRequest(pt.y, pt.x); + if (theLeftReq) { + POINT headPtL = theLeftReq->GetHeadPosition(); + int theRemain = ((inPt.x - headPtL.x) / 2) - 2; + theLeftReq->SetDrawWidth(theRemain); + theWidth = theRemain + ((inPt.x - headPtL.x) % 2); } else { T2Tenant *theFloor = GetFloor(pt.y, pt.x); if (theFloor) { RECT floorArea; theFloor->GetEquipArea(floorArea); - result = inPt.x - CalcRequestLeftEnd(pt, floorArea.left) - 2; + theWidth = inPt.x - CalcRequestLeftEnd(pt, floorArea.left) - 2; } } } - RECT area; - area.top = inPt.y; - area.bottom = inPt.y + 1; - area.left = area.right = inPt.x; + RECT theFillArea; + theFillArea.top = inPt.y; + theFillArea.bottom = inPt.y + 1; + theFillArea.left = theFillArea.right = inPt.x; if (inUpDown == ERequestUpDown_1) - area.right = inPt.x + result + 2; + theFillArea.right = inPt.x + theWidth + 2; else - area.left = inPt.x - result - 2; + theFillArea.left = inPt.x - theWidth - 2; - FillRequestID(area, inRequestID); - return result; + FillRequestID(theFillArea, inRequestID); + return theWidth; } void T2FloorInfo::RemoveRequestID(ERequestUpDown inUpDown, const RECT& inRect) { @@ -636,126 +642,126 @@ void T2FloorInfo::FillOutObjID(const RECT& inRect, unsigned int inOutObjID) { } unsigned int T2FloorInfo::FindTenantID(int inV, int inH, BOOL inRight, int inMaxDistance, unsigned int inExclTenantID) { - unsigned int result = 0; + unsigned int id = 0; - POINT pt; - SetPt(&pt, inH, inV); - T2FInfoPtIterator iterator(*this, pt); + POINT ptStart; + SetPt(&ptStart, inH, inV); + T2FInfoPtIterator iterator(*this, ptStart); - int distance = 0; + int count = 0; T2UnitInfo *theUnitInfo; - unsigned int checkID; + unsigned int theUnitID; if (!inRight) { - while (iterator.Left(theUnitInfo) && distance < inMaxDistance) { - checkID = theUnitInfo->GetTenantID(); - if (checkID != 0 && checkID != inExclTenantID) { - result = checkID; + while (iterator.Left(theUnitInfo) && count < inMaxDistance) { + theUnitID = theUnitInfo->GetTenantID(); + if (theUnitID != 0 && theUnitID != inExclTenantID) { + id = theUnitID; break; } - distance++; + count++; } } else { - while (iterator.Right(theUnitInfo) && distance < inMaxDistance) { - checkID = theUnitInfo->GetTenantID(); - if (checkID != 0 && checkID != inExclTenantID) { - result = checkID; + while (iterator.Right(theUnitInfo) && count < inMaxDistance) { + theUnitID = theUnitInfo->GetTenantID(); + if (theUnitID != 0 && theUnitID != inExclTenantID) { + id = theUnitID; break; } - distance++; + count++; } } - return result; + return id; } int T2FloorInfo::CalcRequestRightEnd(POINT inPt, int inMaxH) { - int h = inPt.x + 1; + int currH = inPt.x + 1; T2FInfoPtIterator iterator(*this, inPt); - T2UnitInfo *theUnitInfo; + T2UnitInfo *theInfo; - while (iterator.Right(theUnitInfo) && h < inMaxH) { - if (theUnitInfo->GetMoverID() != 0) { - h -= 2; + while (iterator.Right(theInfo) && currH < inMaxH) { + if (theInfo->GetMoverID() != 0) { + currH -= 2; break; } - h++; + currH++; } - return h; + return currH; } int T2FloorInfo::CalcRequestLeftEnd(POINT inPt, int inMinH) { - int h = inPt.x; + int currH = inPt.x; T2FInfoPtIterator iterator(*this, inPt); - T2UnitInfo *theUnitInfo; + T2UnitInfo *theInfo; - while (iterator.Left(theUnitInfo) && h > inMinH) { - if (theUnitInfo->GetMoverID() != 0) { - h += 2; + while (iterator.Left(theInfo) && currH > inMinH) { + if (theInfo->GetMoverID() != 0) { + currH += 2; break; } - h--; + currH--; } - return h; + return currH; } int T2FloorInfo::GetLeftMoverID(POINT inPt, int inMinH) const { - int result = 0; - int h = inPt.x; + int moverID = 0; + int currH = inPt.x; T2FInfoPtIterator iterator(*this, inPt); - T2UnitInfo *theUnitInfo; + T2UnitInfo *theInfo; - while (iterator.Left(theUnitInfo) && h > inMinH && result == 0) { - result = theUnitInfo->GetMoverID(); - h--; + while (iterator.Left(theInfo) && currH > inMinH && moverID == 0) { + moverID = theInfo->GetMoverID(); + currH--; } - return result; + return moverID; } void T2FloorInfo::UpdeteRequestByUnionFloor(T2Tenant* inTenant, POINT inPt) { - POINT rightPt = inPt; - rightPt.x++; + POINT ptR = inPt; + ptR.x++; - T2Request *theLeftRequest = GetRequest(inPt.y, inPt.x); - T2Request *theRightRequest = GetRequest(rightPt.y, rightPt.x); + T2Request *theLeftReq = GetRequest(inPt.y, inPt.x); + T2Request *theRightReq = GetRequest(ptR.y, ptR.x); - if (theLeftRequest) { - POINT leftHeadPt = theLeftRequest->GetHeadPosition(); - if (theRightRequest) { - POINT rightHeadPt = theRightRequest->GetHeadPosition(); + if (theLeftReq) { + POINT headPtLeft = theLeftReq->GetHeadPosition(); + if (theRightReq) { + POINT headPtRight = theRightReq->GetHeadPosition(); - int width = ((rightHeadPt.x - leftHeadPt.x) / 2) - 2; - theLeftRequest->SetDrawWidth(width); - theRightRequest->SetDrawWidth(width + ((rightHeadPt.x - leftHeadPt.x) % 2)); + int theWidth = ((headPtRight.x - headPtLeft.x) / 2) - 2; + theLeftReq->SetDrawWidth(theWidth); + theRightReq->SetDrawWidth(theWidth + ((headPtRight.x - headPtLeft.x) % 2)); RECT rightArea; - theRightRequest->CalcArea(rightArea); - FillRequestID(rightArea, theRightRequest->GetRequestID()); + theRightReq->CalcArea(rightArea); + FillRequestID(rightArea, theRightReq->GetRequestID()); } else { - RECT floorArea; - inTenant->GetEquipArea(floorArea); - theLeftRequest->SetDrawWidth(CalcRequestRightEnd(inPt, floorArea.right) - leftHeadPt.x - 2); + RECT rightArea; + inTenant->GetEquipArea(rightArea); + theLeftReq->SetDrawWidth(CalcRequestRightEnd(inPt, rightArea.right) - headPtLeft.x - 2); } RECT leftArea; - theLeftRequest->CalcArea(leftArea); - FillRequestID(leftArea, theLeftRequest->GetRequestID()); - } else if (theRightRequest) { - POINT rightHeadPt = theRightRequest->GetHeadPosition(); + theLeftReq->CalcArea(leftArea); + FillRequestID(leftArea, theLeftReq->GetRequestID()); + } else if (theRightReq) { + POINT headPtRight = theRightReq->GetHeadPosition(); - RECT floorArea; - inTenant->GetEquipArea(floorArea); - theRightRequest->SetDrawWidth(rightHeadPt.x - CalcRequestLeftEnd(rightPt, floorArea.left) - 2); + RECT leftArea; + inTenant->GetEquipArea(leftArea); + theRightReq->SetDrawWidth(headPtRight.x - CalcRequestLeftEnd(ptR, leftArea.left) - 2); RECT rightArea; - theRightRequest->CalcArea(rightArea); - FillRequestID(rightArea, theRightRequest->GetRequestID()); + theRightReq->CalcArea(rightArea); + FillRequestID(rightArea, theRightReq->GetRequestID()); } } @@ -770,12 +776,12 @@ void T2FloorInfo::MoverAreaRemoved(const RECT& inRect) { } void T2FloorInfo::UpdeteRequestByBuildMover(const RECT& inRect) { - POINT pt; - pt.x = inRect.left; - pt.y = inRect.top; + POINT ptStart; + ptStart.x = inRect.left; + ptStart.y = inRect.top; - for (int v = inRect.top; v < inRect.bottom; v++, pt.y++) { - T2Request *theRequest = GetRequest(pt.y, pt.x); + for (int v = inRect.top; v < inRect.bottom; v++, ptStart.y++) { + T2Request *theRequest = GetRequest(ptStart.y, ptStart.x); if (theRequest) { POINT headPt = theRequest->GetHeadPosition(); int width = theRequest->GetDrawWidth() + 2; @@ -785,45 +791,45 @@ void T2FloorInfo::UpdeteRequestByBuildMover(const RECT& inRect) { area.bottom = v + 1; if (theRequest->GetUpDown() == ERequestUpDown_1) { - POINT pt2 = pt; + POINT ptEnd = ptStart; area.left = inRect.left - 2; area.right = headPt.x + width; theRequest->SetDrawWidth(area.left - headPt.x - 2); FillRequestID(area, 0); - pt2.x = area.right; - T2Request *theOtherRequest = GetRequest(pt2.y, pt2.x); - if (theOtherRequest) { - POINT headPt2 = theOtherRequest->GetHeadPosition(); - if (pt2.x < (inRect.right + 2)) { - area.left = pt2.x; + ptEnd.x = area.right; + T2Request *theOtherReq = GetRequest(ptEnd.y, ptEnd.x); + if (theOtherReq) { + POINT headPt2 = theOtherReq->GetHeadPosition(); + if (ptEnd.x < (inRect.right + 2)) { + area.left = ptEnd.x; area.right = inRect.right + 2; - theOtherRequest->SetDrawWidth(headPt2.x - area.right - 2); + theOtherReq->SetDrawWidth(headPt2.x - area.right - 2); FillRequestID(area, 0); - } else if (pt2.x > (inRect.right + 2)) { + } else if (ptEnd.x > (inRect.right + 2)) { area.left = inRect.right + 2; - area.right = pt2.x; - theOtherRequest->SetDrawWidth(headPt.x - area.left - 2); - FillRequestID(area, theOtherRequest->GetRequestID()); + area.right = ptEnd.x; + theOtherReq->SetDrawWidth(headPt2.x - area.left - 2); + FillRequestID(area, theOtherReq->GetRequestID()); } } } else { - POINT pt2 = pt; + POINT ptEnd = ptStart; area.left = headPt.x - width; area.right = inRect.right + 2; theRequest->SetDrawWidth(headPt.x - area.right - 2); FillRequestID(area, 0); - pt2.x = area.left - 1; - T2Request *theOtherRequest = GetRequest(pt2.y, pt2.x); - if (theOtherRequest) { - POINT headPt2 = theOtherRequest->GetHeadPosition(); - area.left = pt2.x + 1; + ptEnd.x = area.left - 1; + T2Request *theOtherReq = GetRequest(ptEnd.y, ptEnd.x); + if (theOtherReq) { + POINT headPt2 = theOtherReq->GetHeadPosition(); + area.left = ptEnd.x + 1; area.right = inRect.left - 2; - theOtherRequest->SetDrawWidth(area.right - headPt2.x - 2); - FillRequestID(area, theOtherRequest->GetRequestID()); + theOtherReq->SetDrawWidth(area.right - headPt2.x - 2); + FillRequestID(area, theOtherReq->GetRequestID()); } } } @@ -831,55 +837,55 @@ void T2FloorInfo::UpdeteRequestByBuildMover(const RECT& inRect) { } void T2FloorInfo::UpdeteRequestByRemoveMover(const RECT& inRect) { - POINT pt1; - POINT pt2; + POINT ptL; + POINT ptR; - pt2.y = pt1.y = inRect.top; + ptR.y = ptL.y = inRect.top; - pt1.x = inRect.left - 3; - pt2.x = inRect.right + 2; + ptL.x = inRect.left - 3; + ptR.x = inRect.right + 2; - for (; pt1.y < inRect.bottom; pt1.y++, pt2.y++) { - T2Request *theRequest1 = GetRequest(pt1.y, pt1.x); - T2Request *theRequest2 = GetRequest(pt2.y, pt2.x); + for (; ptL.y < inRect.bottom; ptL.y++, ptR.y++) { + T2Request *theLeftReq = GetRequest(ptL.y, ptL.x); + T2Request *theRightReq = GetRequest(ptR.y, ptR.x); - if (theRequest1) { - POINT headPt1 = theRequest1->GetHeadPosition(); - if (theRequest2) { - POINT headPt2 = theRequest2->GetHeadPosition(); + if (theLeftReq) { + POINT headPtLeft = theLeftReq->GetHeadPosition(); + if (theRightReq) { + POINT headPtRight = theRightReq->GetHeadPosition(); - int width = ((headPt2.x - headPt1.x) / 2) - 2; - theRequest1->SetDrawWidth(width); - theRequest2->SetDrawWidth(width + ((headPt2.x - headPt1.x) % 2)); + int theWidth = ((headPtRight.x - headPtLeft.x) / 2) - 2; + theLeftReq->SetDrawWidth(theWidth); + theRightReq->SetDrawWidth(theWidth + ((headPtRight.x - headPtLeft.x) % 2)); - RECT area2; - theRequest2->CalcArea(area2); - FillRequestID(area2, theRequest2->GetRequestID()); + RECT rightArea; + theRightReq->CalcArea(rightArea); + FillRequestID(rightArea, theRightReq->GetRequestID()); } else { - T2Tenant *theFloor = GetFloor(pt1.y, pt1.x); - if (theFloor) { + T2Tenant *theLeftFloor = GetFloor(ptL.y, ptL.x); + if (theLeftFloor) { RECT floorArea; - theFloor->GetEquipArea(floorArea); - theRequest1->SetDrawWidth(CalcRequestRightEnd(pt1, floorArea.right) - headPt1.x - 2); + theLeftFloor->GetEquipArea(floorArea); + theLeftReq->SetDrawWidth(CalcRequestRightEnd(ptL, floorArea.right) - headPtLeft.x - 2); } } - RECT area1; - theRequest1->CalcArea(area1); - FillRequestID(area1, theRequest1->GetRequestID()); - } else if (theRequest2) { - POINT headPt2 = theRequest2->GetHeadPosition(); + RECT leftArea; + theLeftReq->CalcArea(leftArea); + FillRequestID(leftArea, theLeftReq->GetRequestID()); + } else if (theRightReq) { + POINT headPtRight = theRightReq->GetHeadPosition(); - T2Tenant *theFloor = GetFloor(pt1.y, pt1.x); - if (theFloor) { + T2Tenant *theRightFloor = GetFloor(ptR.y, ptR.x); + if (theRightFloor) { RECT floorArea; - theFloor->GetEquipArea(floorArea); - theRequest2->SetDrawWidth(headPt2.x - CalcRequestLeftEnd(pt2, floorArea.left) - 2); + theRightFloor->GetEquipArea(floorArea); + theRightReq->SetDrawWidth(headPtRight.x - CalcRequestLeftEnd(ptR, floorArea.left) - 2); } - RECT area2; - theRequest2->CalcArea(area2); - FillRequestID(area2, theRequest2->GetRequestID()); + RECT rightArea; + theRightReq->CalcArea(rightArea); + FillRequestID(rightArea, theRightReq->GetRequestID()); } } } @@ -910,10 +916,10 @@ T2Tenant* T2FloorInfo::FindNumberredTenant(int inV, unsigned int inTenantNumber) #line 1399 _ASSERT((inV >= 0) && (inV < mVRange)); - POINT pt; - SetPt(&pt, mBuildArea.left, inV); + POINT leftPt; + SetPt(&leftPt, mBuildArea.left, inV); - T2FInfoPtIterator iterator(*this, pt); + T2FInfoPtIterator iterator(*this, leftPt); T2Tenant *theTenant = NULL; while (iterator.RightTenant(theTenant)) { @@ -937,7 +943,7 @@ void T2FloorInfo::FinishBuildFloor(T2TowerDoc* inDoc, const RECT& inRect) { } void T2FloorInfo::SetTenantDrawModeByRect(const RECT& inRect, int inDrawMode) { - RECT rect = inRect; + RECT theRect = inRect; int actualMode; switch (inDrawMode) { @@ -952,7 +958,7 @@ void T2FloorInfo::SetTenantDrawModeByRect(const RECT& inRect, int inDrawMode) { while (iterator.NextTenant(theTenant)) theTenant->SetDrawMode(inDrawMode); - rect.top++; + theRect.top++; actualMode = DrawMode2; break; } @@ -964,7 +970,7 @@ void T2FloorInfo::SetTenantDrawModeByRect(const RECT& inRect, int inDrawMode) { break; } - T2FInfoAreaIterator iterator(*this, rect); + T2FInfoAreaIterator iterator(*this, theRect); T2Tenant *theTenant; while (iterator.NextTenant(theTenant)) @@ -1006,20 +1012,21 @@ T2Tenant* T2FloorInfo::GetTenantByPID(DWORD inPluginID) { } BOOL T2FloorInfo::BuildFinishForce(const RECT& inRect) { - BOOL result = false; + BOOL finished = false; POINT pt; + T2Tenant *theTenant; for (pt.y = inRect.top; pt.y < inRect.bottom; pt.y++) { for (pt.x = inRect.left; pt.x < inRect.right; pt.x++) { - T2Tenant *theTenant = GetTenant(pt.y, pt.x); + theTenant = GetTenant(pt.y, pt.x); if (theTenant && theTenant->GetStatus() < kTenantStatus10) { theTenant->SetStatus(kTenantStatus9); theTenant->Idle(GetCurrentT2TowerDoc()); GetCurrentT2TowerDoc()->mTowerMainView->tmv_vf128(theTenant->mArea); - result = true; + finished = true; } } } - return result; + return finished; } diff --git a/src/T2DLL/T2FloorInfo.h b/src/T2DLL/T2FloorInfo.h index d76eac9..bcb6165 100644 --- a/src/T2DLL/T2FloorInfo.h +++ b/src/T2DLL/T2FloorInfo.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS T2FloorInfo { +class AFX_CLASS_EXPORT T2FloorInfo { public: T2FloorInfo(const T2WorldDef* inWorldDef); virtual ~T2FloorInfo(); @@ -63,19 +63,19 @@ public: T2Tenant* GetTenantByPID(DWORD inPluginID); BOOL BuildFinishForce(const RECT& inRect); - int GetVRange() const { return mVRange; } - int GetHRange() const { return mHRange; } - int GetGroundLine() const { return mGroundLine; } - int GetTopFloorLine() const { return mTopFloorLine; } - int GetBottomFloorLine() const { return mBottomFloorLine; } - int GetEntranceWidth() const { return mEntranceWidth; } - void GetBuildArea(RECT& outRect) const { outRect = mBuildArea; } - void GetFloorArea(RECT& outRect) const { outRect = mFloorArea; } - T2TenantArrayList* GetTenantArrayList() const { return mTenantArrayList; } - T2MoverArrayList* GetMoverArrayList() const { return mMoverArrayList; } - T2RequestArrayList* GetRequestArrayList() const { return mRequestArrayList; } - T2OutObjArrayList* GetOutObjArrayList() const { return mOutObjArrayList; } - T2OutsideInfo* GetOutsideInfo() const { return mOutsideInfo; } + int GetVRange() const; + int GetHRange() const; + int GetGroundLine() const; + int GetTopFloorLine() const; + int GetBottomFloorLine() const; + int GetEntranceWidth() const; + void GetBuildArea(RECT& outRect) const; + void GetFloorArea(RECT& outRect) const; + T2TenantArrayList* GetTenantArrayList() const; + T2MoverArrayList* GetMoverArrayList() const; + T2RequestArrayList* GetRequestArrayList() const; + T2OutObjArrayList* GetOutObjArrayList() const; + T2OutsideInfo* GetOutsideInfo() const; int mVRange; int mHRange; @@ -98,3 +98,17 @@ protected: int CalcRequestRightEnd(POINT inPt, int inMaxH); int CalcRequestLeftEnd(POINT inPt, int inMinH); }; + +inline int T2FloorInfo::GetVRange() const { return mVRange; } +inline int T2FloorInfo::GetHRange() const { return mHRange; } +inline int T2FloorInfo::GetGroundLine() const { return mGroundLine; } +inline int T2FloorInfo::GetTopFloorLine() const { return mTopFloorLine; } +inline int T2FloorInfo::GetBottomFloorLine() const { return mBottomFloorLine; } +inline int T2FloorInfo::GetEntranceWidth() const { return mEntranceWidth; } +inline void T2FloorInfo::GetBuildArea(RECT& outRect) const { outRect = mBuildArea; } +inline void T2FloorInfo::GetFloorArea(RECT& outRect) const { outRect = mFloorArea; } +inline T2TenantArrayList* T2FloorInfo::GetTenantArrayList() const { return mTenantArrayList; } +inline T2MoverArrayList* T2FloorInfo::GetMoverArrayList() const { return mMoverArrayList; } +inline T2RequestArrayList* T2FloorInfo::GetRequestArrayList() const { return mRequestArrayList; } +inline T2OutObjArrayList* T2FloorInfo::GetOutObjArrayList() const { return mOutObjArrayList; } +inline T2OutsideInfo* T2FloorInfo::GetOutsideInfo() const { return mOutsideInfo; } diff --git a/src/T2DLL/T2FloorNumberTable.h b/src/T2DLL/T2FloorNumberTable.h index d1a3059..b767f93 100644 --- a/src/T2DLL/T2FloorNumberTable.h +++ b/src/T2DLL/T2FloorNumberTable.h @@ -7,7 +7,7 @@ struct StflNotification { T2FloorNumberTable *theTable; }; -class AFX_EXT_CLASS T2FloorNumberTable : public T2DlgItemImageTable { +class AFX_CLASS_EXPORT T2FloorNumberTable : public T2DlgItemImageTable { public: T2FloorNumberTable(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); virtual ~T2FloorNumberTable(); diff --git a/src/T2DLL/T2FloorPtrList.h b/src/T2DLL/T2FloorPtrList.h index 4dd02a5..dbfc24c 100644 --- a/src/T2DLL/T2FloorPtrList.h +++ b/src/T2DLL/T2FloorPtrList.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2EquipPtrList.h" -class AFX_EXT_CLASS T2FloorPtrList : public T2EquipPtrList { +class AFX_CLASS_EXPORT T2FloorPtrList : public T2EquipPtrList { public: T2FloorPtrList(T2TenantArrayList* inList); virtual ~T2FloorPtrList(); diff --git a/src/T2DLL/T2GlobalData.cpp b/src/T2DLL/T2GlobalData.cpp index 2f8c15a..3b0c100 100644 --- a/src/T2DLL/T2GlobalData.cpp +++ b/src/T2DLL/T2GlobalData.cpp @@ -1,3 +1,4 @@ +#define ATOI_KLUDGE #include "GlobalFunc.h" #include "T2Archive.h" #include "T2GlobalData.h" @@ -11,19 +12,19 @@ T2GlobalData::T2GlobalData() { for (int i = 0; i < 20; i++) mSerial[i] = 0; - T2Archive archive; + T2Archive file; CString filename = GetTowerDirectory() + "T2Pref.dat"; - if (archive.OpenAsReadMode(filename)) { - Read(archive); - archive.Close(); + if (file.OpenAsReadMode(filename)) { + Read(file); + file.Close(); } else { T2SerialDialog *theSerialDialog = new T2SerialDialog(NULL); if (theSerialDialog->DoModal() == 1) { theSerialDialog->GetSerial(mSerial); if (IsCheckSerial()) { - archive.OpenAsWriteMode(filename); - Write(archive); - archive.Close(); + file.OpenAsWriteMode(filename); + Write(file); + file.Close(); } } delete theSerialDialog; @@ -32,11 +33,11 @@ T2GlobalData::T2GlobalData() { /*virtual*/ T2GlobalData::~T2GlobalData() { if (mChanged) { - T2Archive archive; + T2Archive file; CString filename = GetTowerDirectory() + "T2Pref.dat"; - archive.OpenAsWriteMode(filename); - Write(archive); - archive.Close(); + file.OpenAsWriteMode(filename); + Write(file); + file.Close(); } } @@ -85,281 +86,281 @@ BOOL T2GlobalData::IsCheckSerial() { } BOOL T2GlobalData::Check_Serial(char* inSerial) { - unsigned short table[256]; - table[0] = 0; - table[1] = 0x1189; - table[2] = 0x2312; - table[3] = 0x329b; - table[4] = 0x4624; - table[5] = 0x57ad; - table[6] = 0x6536; - table[7] = 0x74bf; - table[8] = 0x8c48; - table[9] = 0x9dc1; - table[10] = 0xaf5a; - table[11] = 0xbed3; - table[12] = 0xca6c; - table[13] = 0xdbe5; - table[14] = 0xe97e; - table[15] = 0xf8f7; - table[16] = 0x1081; - table[17] = 0x0108; - table[18] = 0x3393; - table[19] = 0x221a; - table[20] = 0x56a5; - table[21] = 0x472c; - table[22] = 0x75b7; - table[23] = 0x643e; - table[24] = 0x9cc9; - table[25] = 0x8d40; - table[26] = 0xbfdb; - table[27] = 0xae52; - table[28] = 0xdaed; - table[29] = 0xcb64; - table[30] = 0xf9ff; - table[31] = 0xe876; - table[32] = 0x2102; - table[33] = 0x308b; - table[34] = 0x0210; - table[35] = 0x1399; - table[36] = 0x6726; - table[37] = 0x76af; - table[38] = 0x4434; - table[39] = 0x55bd; - table[40] = 0xad4a; - table[41] = 0xbcc3; - table[42] = 0x8e58; - table[43] = 0x9fd1; - table[44] = 0xeb6e; - table[45] = 0xfae7; - table[46] = 0xc87c; - table[47] = 0xd9f5; - table[48] = 0x3183; - table[49] = 0x200a; - table[50] = 0x1291; - table[51] = 0x0318; - table[52] = 0x77a7; - table[53] = 0x662e; - table[54] = 0x54b5; - table[55] = 0x453c; - table[56] = 0xbdcb; - table[57] = 0xac42; - table[58] = 0x9ed9; - table[59] = 0x8f50; - table[60] = 0xfbef; - table[61] = 0xea66; - table[62] = 0xd8fd; - table[63] = 0xc974; - table[64] = 0x4204; - table[65] = 0x538d; - table[66] = 0x6116; - table[67] = 0x709f; - table[68] = 0x0420; - table[69] = 0x15a9; - table[70] = 0x2732; - table[71] = 0x36bb; - table[72] = 0xce4c; - table[73] = 0xdfc5; - table[74] = 0xed5e; - table[75] = 0xfcd7; - table[76] = 0x8868; - table[77] = 0x99e1; - table[78] = 0xab7a; - table[79] = 0xbaf3; - table[80] = 0x5285; - table[81] = 0x430c; - table[82] = 0x7197; - table[83] = 0x601e; - table[84] = 0x14a1; - table[85] = 0x0528; - table[86] = 0x37b3; - table[87] = 0x263a; - table[88] = 0xdecd; - table[89] = 0xcf44; - table[90] = 0xfddf; - table[91] = 0xec56; - table[92] = 0x98e9; - table[93] = 0x8960; - table[94] = 0xbbfb; - table[95] = 0xaa72; - table[96] = 0x6306; - table[97] = 0x728f; - table[98] = 0x4014; - table[99] = 0x519d; - table[100] = 0x2522; - table[101] = 0x34ab; - table[102] = 0x0630; - table[103] = 0x17b9; - table[104] = 0xef4e; - table[105] = 0xfec7; - table[106] = 0xcc5c; - table[107] = 0xddd5; - table[108] = 0xa96a; - table[109] = 0xb8e3; - table[110] = 0x8a78; - table[111] = 0x9bf1; - table[112] = 0x7387; - table[113] = 0x620e; - table[114] = 0x5095; - table[115] = 0x411c; - table[116] = 0x35a3; - table[117] = 0x242a; - table[118] = 0x16b1; - table[119] = 0x0738; - table[120] = 0xffcf; - table[121] = 0xee46; - table[122] = 0xdcdd; - table[123] = 0xcd54; - table[124] = 0xb9eb; - table[125] = 0xa862; - table[126] = 0x9af9; - table[127] = 0x8b70; - table[128] = 0x8408; - table[129] = 0x9581; - table[130] = 0xa71a; - table[131] = 0xb693; - table[132] = 0xc22c; - table[133] = 0xd3a5; - table[134] = 0xe13e; - table[135] = 0xf0b7; - table[136] = 0x0840; - table[137] = 0x19c9; - table[138] = 0x2b52; - table[139] = 0x3adb; - table[140] = 0x4e64; - table[141] = 0x5fed; - table[142] = 0x6d76; - table[143] = 0x7cff; - table[144] = 0x9489; - table[145] = 0x8500; - table[146] = 0xb79b; - table[147] = 0xa612; - table[148] = 0xd2ad; - table[149] = 0xc324; - table[150] = 0xf1bf; - table[151] = 0xe036; - table[152] = 0x18c1; - table[153] = 0x0948; - table[154] = 0x3bd3; - table[155] = 0x2a5a; - table[156] = 0x5ee5; - table[157] = 0x4f6c; - table[158] = 0x7df7; - table[159] = 0x6c7e; - table[160] = 0xa50a; - table[161] = 0xb483; - table[162] = 0x8618; - table[163] = 0x9791; - table[164] = 0xe32e; - table[165] = 0xf2a7; - table[166] = 0xc03c; - table[167] = 0xd1b5; - table[168] = 0x2942; - table[169] = 0x38cb; - table[170] = 0x0a50; - table[171] = 0x1bd9; - table[172] = 0x6f66; - table[173] = 0x7eef; - table[174] = 0x4c74; - table[175] = 0x5dfd; - table[176] = 0xb58b; - table[177] = 0xa402; - table[178] = 0x9699; - table[179] = 0x8710; - table[180] = 0xf3af; - table[181] = 0xe226; - table[182] = 0xd0bd; - table[183] = 0xc134; - table[184] = 0x39c3; - table[185] = 0x284a; - table[186] = 0x1ad1; - table[187] = 0x0b58; - table[188] = 0x7fe7; - table[189] = 0x6e6e; - table[190] = 0x5cf5; - table[191] = 0x4d7c; - table[192] = 0xc60c; - table[193] = 0xd785; - table[194] = 0xe51e; - table[195] = 0xf497; - table[196] = 0x8028; - table[197] = 0x91a1; - table[198] = 0xa33a; - table[199] = 0xb2b3; - table[200] = 0x4a44; - table[201] = 0x5bcd; - table[202] = 0x6956; - table[203] = 0x78df; - table[204] = 0x0c60; - table[205] = 0x1de9; - table[206] = 0x2f72; - table[207] = 0x3efb; - table[208] = 0xd68d; - table[209] = 0xc704; - table[210] = 0xf59f; - table[211] = 0xe416; - table[212] = 0x90a9; - table[213] = 0x8120; - table[214] = 0xb3bb; - table[215] = 0xa232; - table[216] = 0x5ac5; - table[217] = 0x4b4c; - table[218] = 0x79d7; - table[219] = 0x685e; - table[220] = 0x1ce1; - table[221] = 0x0d68; - table[222] = 0x3ff3; - table[223] = 0x2e7a; - table[224] = 0xe70e; - table[225] = 0xf687; - table[226] = 0xc41c; - table[227] = 0xd595; - table[228] = 0xa12a; - table[229] = 0xb0a3; - table[230] = 0x8238; - table[231] = 0x93b1; - table[232] = 0x6b46; - table[233] = 0x7acf; - table[234] = 0x4854; - table[235] = 0x59dd; - table[236] = 0x2d62; - table[237] = 0x3ceb; - table[238] = 0x0e70; - table[239] = 0x1ff9; - table[240] = 0xf78f; - table[241] = 0xe606; - table[242] = 0xd49d; - table[243] = 0xc514; - table[244] = 0xb1ab; - table[245] = 0xa022; - table[246] = 0x92b9; - table[247] = 0x8330; - table[248] = 0x7bc7; - table[249] = 0x6a4e; - table[250] = 0x58d5; - table[251] = 0x495c; - table[252] = 0x3de3; - table[253] = 0x2c6a; - table[254] = 0x1ef1; - table[255] = 0x0f78; + unsigned short array[256]; + array[0] = 0; + array[1] = 0x1189; + array[2] = 0x2312; + array[3] = 0x329b; + array[4] = 0x4624; + array[5] = 0x57ad; + array[6] = 0x6536; + array[7] = 0x74bf; + array[8] = 0x8c48; + array[9] = 0x9dc1; + array[10] = 0xaf5a; + array[11] = 0xbed3; + array[12] = 0xca6c; + array[13] = 0xdbe5; + array[14] = 0xe97e; + array[15] = 0xf8f7; + array[16] = 0x1081; + array[17] = 0x0108; + array[18] = 0x3393; + array[19] = 0x221a; + array[20] = 0x56a5; + array[21] = 0x472c; + array[22] = 0x75b7; + array[23] = 0x643e; + array[24] = 0x9cc9; + array[25] = 0x8d40; + array[26] = 0xbfdb; + array[27] = 0xae52; + array[28] = 0xdaed; + array[29] = 0xcb64; + array[30] = 0xf9ff; + array[31] = 0xe876; + array[32] = 0x2102; + array[33] = 0x308b; + array[34] = 0x0210; + array[35] = 0x1399; + array[36] = 0x6726; + array[37] = 0x76af; + array[38] = 0x4434; + array[39] = 0x55bd; + array[40] = 0xad4a; + array[41] = 0xbcc3; + array[42] = 0x8e58; + array[43] = 0x9fd1; + array[44] = 0xeb6e; + array[45] = 0xfae7; + array[46] = 0xc87c; + array[47] = 0xd9f5; + array[48] = 0x3183; + array[49] = 0x200a; + array[50] = 0x1291; + array[51] = 0x0318; + array[52] = 0x77a7; + array[53] = 0x662e; + array[54] = 0x54b5; + array[55] = 0x453c; + array[56] = 0xbdcb; + array[57] = 0xac42; + array[58] = 0x9ed9; + array[59] = 0x8f50; + array[60] = 0xfbef; + array[61] = 0xea66; + array[62] = 0xd8fd; + array[63] = 0xc974; + array[64] = 0x4204; + array[65] = 0x538d; + array[66] = 0x6116; + array[67] = 0x709f; + array[68] = 0x0420; + array[69] = 0x15a9; + array[70] = 0x2732; + array[71] = 0x36bb; + array[72] = 0xce4c; + array[73] = 0xdfc5; + array[74] = 0xed5e; + array[75] = 0xfcd7; + array[76] = 0x8868; + array[77] = 0x99e1; + array[78] = 0xab7a; + array[79] = 0xbaf3; + array[80] = 0x5285; + array[81] = 0x430c; + array[82] = 0x7197; + array[83] = 0x601e; + array[84] = 0x14a1; + array[85] = 0x0528; + array[86] = 0x37b3; + array[87] = 0x263a; + array[88] = 0xdecd; + array[89] = 0xcf44; + array[90] = 0xfddf; + array[91] = 0xec56; + array[92] = 0x98e9; + array[93] = 0x8960; + array[94] = 0xbbfb; + array[95] = 0xaa72; + array[96] = 0x6306; + array[97] = 0x728f; + array[98] = 0x4014; + array[99] = 0x519d; + array[100] = 0x2522; + array[101] = 0x34ab; + array[102] = 0x0630; + array[103] = 0x17b9; + array[104] = 0xef4e; + array[105] = 0xfec7; + array[106] = 0xcc5c; + array[107] = 0xddd5; + array[108] = 0xa96a; + array[109] = 0xb8e3; + array[110] = 0x8a78; + array[111] = 0x9bf1; + array[112] = 0x7387; + array[113] = 0x620e; + array[114] = 0x5095; + array[115] = 0x411c; + array[116] = 0x35a3; + array[117] = 0x242a; + array[118] = 0x16b1; + array[119] = 0x0738; + array[120] = 0xffcf; + array[121] = 0xee46; + array[122] = 0xdcdd; + array[123] = 0xcd54; + array[124] = 0xb9eb; + array[125] = 0xa862; + array[126] = 0x9af9; + array[127] = 0x8b70; + array[128] = 0x8408; + array[129] = 0x9581; + array[130] = 0xa71a; + array[131] = 0xb693; + array[132] = 0xc22c; + array[133] = 0xd3a5; + array[134] = 0xe13e; + array[135] = 0xf0b7; + array[136] = 0x0840; + array[137] = 0x19c9; + array[138] = 0x2b52; + array[139] = 0x3adb; + array[140] = 0x4e64; + array[141] = 0x5fed; + array[142] = 0x6d76; + array[143] = 0x7cff; + array[144] = 0x9489; + array[145] = 0x8500; + array[146] = 0xb79b; + array[147] = 0xa612; + array[148] = 0xd2ad; + array[149] = 0xc324; + array[150] = 0xf1bf; + array[151] = 0xe036; + array[152] = 0x18c1; + array[153] = 0x0948; + array[154] = 0x3bd3; + array[155] = 0x2a5a; + array[156] = 0x5ee5; + array[157] = 0x4f6c; + array[158] = 0x7df7; + array[159] = 0x6c7e; + array[160] = 0xa50a; + array[161] = 0xb483; + array[162] = 0x8618; + array[163] = 0x9791; + array[164] = 0xe32e; + array[165] = 0xf2a7; + array[166] = 0xc03c; + array[167] = 0xd1b5; + array[168] = 0x2942; + array[169] = 0x38cb; + array[170] = 0x0a50; + array[171] = 0x1bd9; + array[172] = 0x6f66; + array[173] = 0x7eef; + array[174] = 0x4c74; + array[175] = 0x5dfd; + array[176] = 0xb58b; + array[177] = 0xa402; + array[178] = 0x9699; + array[179] = 0x8710; + array[180] = 0xf3af; + array[181] = 0xe226; + array[182] = 0xd0bd; + array[183] = 0xc134; + array[184] = 0x39c3; + array[185] = 0x284a; + array[186] = 0x1ad1; + array[187] = 0x0b58; + array[188] = 0x7fe7; + array[189] = 0x6e6e; + array[190] = 0x5cf5; + array[191] = 0x4d7c; + array[192] = 0xc60c; + array[193] = 0xd785; + array[194] = 0xe51e; + array[195] = 0xf497; + array[196] = 0x8028; + array[197] = 0x91a1; + array[198] = 0xa33a; + array[199] = 0xb2b3; + array[200] = 0x4a44; + array[201] = 0x5bcd; + array[202] = 0x6956; + array[203] = 0x78df; + array[204] = 0x0c60; + array[205] = 0x1de9; + array[206] = 0x2f72; + array[207] = 0x3efb; + array[208] = 0xd68d; + array[209] = 0xc704; + array[210] = 0xf59f; + array[211] = 0xe416; + array[212] = 0x90a9; + array[213] = 0x8120; + array[214] = 0xb3bb; + array[215] = 0xa232; + array[216] = 0x5ac5; + array[217] = 0x4b4c; + array[218] = 0x79d7; + array[219] = 0x685e; + array[220] = 0x1ce1; + array[221] = 0x0d68; + array[222] = 0x3ff3; + array[223] = 0x2e7a; + array[224] = 0xe70e; + array[225] = 0xf687; + array[226] = 0xc41c; + array[227] = 0xd595; + array[228] = 0xa12a; + array[229] = 0xb0a3; + array[230] = 0x8238; + array[231] = 0x93b1; + array[232] = 0x6b46; + array[233] = 0x7acf; + array[234] = 0x4854; + array[235] = 0x59dd; + array[236] = 0x2d62; + array[237] = 0x3ceb; + array[238] = 0x0e70; + array[239] = 0x1ff9; + array[240] = 0xf78f; + array[241] = 0xe606; + array[242] = 0xd49d; + array[243] = 0xc514; + array[244] = 0xb1ab; + array[245] = 0xa022; + array[246] = 0x92b9; + array[247] = 0x8330; + array[248] = 0x7bc7; + array[249] = 0x6a4e; + array[250] = 0x58d5; + array[251] = 0x495c; + array[252] = 0x3de3; + array[253] = 0x2c6a; + array[254] = 0x1ef1; + array[255] = 0x0f78; BOOL isValid = false; - char *start = inSerial; - if (strlen(inSerial) != 16) + char *serial = inSerial; + if (strlen(serial) != 16) return false; - if (memcmp(inSerial, "1320", 4) != 0) + if (memcmp(serial, "1320", 4) != 0) return false; - int i = strlen(inSerial) - 4; + int i = strlen(serial) - 4; unsigned short work = 0xFFFF; while (--i >= 0) { - work = (work >> 8) ^ table[((unsigned char) work & 0xFF) ^ *inSerial]; + work = (work >> 8) ^ array[((unsigned char) work & 0xFF) ^ *inSerial]; inSerial++; } - if (((work ^ 0xFFFF) % 10000) == atoi(&start[12])) + if (((work ^ 0xFFFF) % 10000) == atoi(&serial[12])) isValid = true; else isValid = false; diff --git a/src/T2DLL/T2GlobalData.h b/src/T2DLL/T2GlobalData.h index ae6edce..f7b3da9 100644 --- a/src/T2DLL/T2GlobalData.h +++ b/src/T2DLL/T2GlobalData.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS T2GlobalData { +class AFX_CLASS_EXPORT T2GlobalData { public: T2GlobalData(); virtual ~T2GlobalData(); diff --git a/src/T2DLL/T2GuestroomTable.h b/src/T2DLL/T2GuestroomTable.h index 621cf9d..045cd92 100644 --- a/src/T2DLL/T2GuestroomTable.h +++ b/src/T2DLL/T2GuestroomTable.h @@ -3,7 +3,7 @@ #include "LArray.h" #include "T2VerticalTable.h" -class AFX_EXT_CLASS T2GuestroomTable : T2VerticalTable { +class AFX_CLASS_EXPORT T2GuestroomTable : T2VerticalTable { public: T2GuestroomTable(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); virtual ~T2GuestroomTable(); @@ -33,7 +33,7 @@ protected: DWORD mClickTime; }; -class AFX_EXT_CLASS T2GuestroomItem { +class AFX_CLASS_EXPORT T2GuestroomItem { public: T2GuestroomItem(T2Tenant* inTenant, int inSaveTenantID, long inRoomNumber); int GetRoomNumber(); diff --git a/src/T2DLL/T2HallEventPlugin.h b/src/T2DLL/T2HallEventPlugin.h index 29e6859..2ed457c 100644 --- a/src/T2DLL/T2HallEventPlugin.h +++ b/src/T2DLL/T2HallEventPlugin.h @@ -2,22 +2,7 @@ #include "common.h" #include "T2SubPlugin.h" -class AFX_EXT_CLASS T2HallEventItem { -public: - T2HallEventItem(T2HallEventPlugin *inPlugin, const char *inStr) { - mPlugin = inPlugin; - if (inStr) - strcpy(mStr, inStr); - else - mStr[0] = 0; - } - virtual ~T2HallEventItem() {} - - T2HallEventPlugin *mPlugin; - char mStr[64]; -}; - -class AFX_EXT_CLASS T2HallEventPlugin : public T2SubPlugin { +class AFX_CLASS_EXPORT T2HallEventPlugin : public T2SubPlugin { public: T2HallEventPlugin(DWORD inType, T2PluginSpecifier& inSpecifier); virtual ~T2HallEventPlugin(); diff --git a/src/T2DLL/T2HallEventTable.h b/src/T2DLL/T2HallEventTable.h index 99ec0bf..ea82315 100644 --- a/src/T2DLL/T2HallEventTable.h +++ b/src/T2DLL/T2HallEventTable.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2VerticalTable.h" -class AFX_EXT_CLASS T2HallEventTable : public T2VerticalTable { +class AFX_CLASS_EXPORT T2HallEventTable : public T2VerticalTable { public: T2HallEventTable(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); virtual ~T2HallEventTable(); @@ -23,7 +23,22 @@ protected: int mUserCon; }; -class AFX_EXT_CLASS T2MonthlyTable : public T2VerticalTable { +class AFX_CLASS_EXPORT T2HallEventItem { +public: + T2HallEventItem(T2HallEventPlugin *inPlugin, const char *inStr) { + mPlugin = inPlugin; + if (inStr) + strcpy(mStr, inStr); + else + mStr[0] = 0; + } + virtual ~T2HallEventItem() {} + + T2HallEventPlugin *mPlugin; + char mStr[64]; +}; + +class AFX_CLASS_EXPORT T2MonthlyTable : public T2VerticalTable { public: T2MonthlyTable(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); virtual ~T2MonthlyTable(); diff --git a/src/T2DLL/T2HaveOutViewObject.h b/src/T2DLL/T2HaveOutViewObject.h index a035fa1..73081ed 100644 --- a/src/T2DLL/T2HaveOutViewObject.h +++ b/src/T2DLL/T2HaveOutViewObject.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2DrawableObject.h" -class AFX_EXT_CLASS T2HaveOutViewObject : public T2DrawableObject { +class AFX_CLASS_EXPORT T2HaveOutViewObject : public T2DrawableObject { public: T2HaveOutViewObject(); virtual ~T2HaveOutViewObject(); @@ -15,8 +15,7 @@ public: T2ToolDef* GetToolDef() const; void SetToolDef(T2ToolDef*); int CalcMentenanceCost(T2TowerDoc*) const; - - unsigned int GetValiation() const { return mValiation; } + unsigned int GetValiation() const; T2ToolDef *mToolDef; int mRefCon; @@ -27,3 +26,7 @@ protected: virtual void SetUsed(BOOL inUsed); virtual void InitLoaded(); }; + +inline unsigned int T2HaveOutViewObject::GetValiation() const { + return mValiation; +} diff --git a/src/T2DLL/T2ImageObj.cpp b/src/T2DLL/T2ImageObj.cpp index 08ae773..a770e6a 100644 --- a/src/T2DLL/T2ImageObj.cpp +++ b/src/T2DLL/T2ImageObj.cpp @@ -1,7 +1,14 @@ +#define ATOI_KLUDGE #include "GlobalFunc.h" #include "T2BitImage.h" #include "T2ImageObj.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + T2ImageObj::T2ImageObj() { mCount = 0; mHandle = GlobalAlloc(GHND, 1); @@ -22,30 +29,30 @@ void T2ImageObj::AddObject(HINSTANCE instance, unsigned int resourceID, T2BitIma CString nameStr; nameStr.Format("%d", resourceID); - CString err = "T2ImageObj::AddObject ERROR : " + nameStr + " @" + GetModuleName(instance) + "\n"; - OutputDebugString(err); + CString error = "T2ImageObj::AddObject ERROR : " + nameStr + " @" + GetModuleName(instance) + "\n"; + OutputDebugString(error); } #line 45 _ASSERT(rsrc); - HGLOBAL h = LoadResource(instance, rsrc); + HGLOBAL theHandle = LoadResource(instance, rsrc); #line 47 - _ASSERT(h); - - void *resData = LockResource(h); - DWORD size = SizeofResource(instance, rsrc); - char *buffer = (char *) malloc(size); - memcpy(buffer, resData, size); - UnlockResource(h); - FreeResource(h); - - char *token = strtok(buffer, " \t\r\n\x1A"); - while (token) { - if (!_stricmp(token, "End")) + _ASSERT(theHandle); + + void *theRes = LockResource(theHandle); + DWORD theResSize = SizeofResource(instance, rsrc); + char *theData = (char *) malloc(theResSize); + memcpy(theData, theRes, theResSize); + UnlockResource(theHandle); + FreeResource(theHandle); + + char *theCmd = strtok(theData, " \t\r\n\x1A"); + while (theCmd) { + if (!_stricmp(theCmd, "End")) break; - if (!_stricmp(token, "DefParts")) { + if (!_stricmp(theCmd, "DefParts")) { mCount++; mHandle = GlobalReAlloc(mHandle, mCount * sizeof(ObjectData), GHND); mData = (ObjectData *) GlobalLock(mHandle); @@ -58,46 +65,46 @@ void T2ImageObj::AddObject(HINSTANCE instance, unsigned int resourceID, T2BitIma mData[mCount - 1].grade = 0; mData[mCount - 1].span = 0; mData[mCount - 1].offset = -1; - } else if (!_stricmp(token, "Name")) { + } else if (!_stricmp(theCmd, "Name")) { strcpy(mData[mCount - 1].name, strtok(NULL, "\t\r\n\x1A")); - } else if (!_stricmp(token, "ID")) { + } else if (!_stricmp(theCmd, "ID")) { mData[mCount - 1].id = atoi(strtok(NULL, " \t\r\n\x1A")); - } else if (!_stricmp(token, "Pattern")) { + } else if (!_stricmp(theCmd, "Pattern")) { mData[mCount - 1].pattern = atoi(strtok(NULL, " \t\r\n\x1A")); - } else if (!_stricmp(token, "Grade")) { + } else if (!_stricmp(theCmd, "Grade")) { mData[mCount - 1].grade = atoi(strtok(NULL, " \t\r\n\x1A")); - } else if (!_stricmp(token, "Span")) { + } else if (!_stricmp(theCmd, "Span")) { mData[mCount - 1].span = atoi(strtok(NULL, " \t\r\n\x1A")); - } else if (!_stricmp(token, "Offset")) { + } else if (!_stricmp(theCmd, "Offset")) { mData[mCount - 1].offset = atoi(strtok(NULL, " \t\r\n\x1A")); - } else if (!_stricmp(token, "Roof")) { + } else if (!_stricmp(theCmd, "Roof")) { if (!_stricmp(strtok(NULL, " \t\r\n\x1A"), "Yes")) mData[mCount - 1].roof = true; - } else if (!_stricmp(token, "Floor")) { + } else if (!_stricmp(theCmd, "Floor")) { if (!_stricmp(strtok(NULL, " \t\r\n\x1A"), "Yes")) mData[mCount - 1].floor = true; - } else if (!_stricmp(token, "List")) { + } else if (!_stricmp(theCmd, "List")) { // nothing - } else if (!_stricmp(token, "Loop")) { + } else if (!_stricmp(theCmd, "Loop")) { mData[mCount - 1].subParts[mData[mCount - 1].subPartCount - 1].flags |= SPD_LOOP; - } else if (!_stricmp(token, "Transparent")) { + } else if (!_stricmp(theCmd, "Transparent")) { mData[mCount - 1].subParts[mData[mCount - 1].subPartCount - 1].flags |= SPD_TRANSPARENT; - } else if (!_stricmp(token, "Halftone")) { + } else if (!_stricmp(theCmd, "Halftone")) { mData[mCount - 1].subParts[mData[mCount - 1].subPartCount - 1].flags |= SPD_HALFTONE; - } else if (!_stricmp(token, "Rect")) { + } else if (!_stricmp(theCmd, "Rect")) { mData[mCount - 1].subPartCount++; mData[mCount - 1].subParts[mData[mCount - 1].subPartCount - 1].flags = SPD_RECT; - char *argToken = strtok(NULL, " \t\r\n\x1A"); - char *arg = (char *) malloc(strlen(argToken) + 1); - strcpy(arg, argToken); + char *arg = strtok(NULL, " \t\r\n\x1A"); + char *argCopy = (char *) malloc(strlen(arg) + 1); + strcpy(argCopy, arg); char *p; - while ((p = strchr(arg, ','))) + while ((p = strchr(argCopy, ','))) *p = ' '; sscanf( - arg, + argCopy, "%hd %hd %hd %hd", &mData[mCount - 1].subParts[mData[mCount - 1].subPartCount - 1].left, &mData[mCount - 1].subParts[mData[mCount - 1].subPartCount - 1].top, @@ -105,13 +112,13 @@ void T2ImageObj::AddObject(HINSTANCE instance, unsigned int resourceID, T2BitIma &mData[mCount - 1].subParts[mData[mCount - 1].subPartCount - 1].bottom ); - free(arg); - } else if (!_stricmp(token, "Parts")) { - char *argToken = strtok(NULL, " \t\r\n\x1A"); - if (argToken[0] != '#') { + free(argCopy); + } else if (!_stricmp(theCmd, "Parts")) { + char *arg = strtok(NULL, " \t\r\n\x1A"); + if (arg[0] != '#') { int i; for (i = 0; i < (mCount - 1); i++) { - if (!strcmp(mData[i].name, argToken)) { + if (!strcmp(mData[i].name, arg)) { mData[mCount - 1].subPartCount++; mData[mCount - 1].subParts[mData[mCount - 1].subPartCount - 1].flags = SPD_PARTS_BY_NAME; mData[mCount - 1].subParts[mData[mCount - 1].subPartCount - 1].partIndex = i; @@ -121,26 +128,26 @@ void T2ImageObj::AddObject(HINSTANCE instance, unsigned int resourceID, T2BitIma if (i == (mCount - 1)) { char buf[256]; - wsprintf(buf, "Undefined parts [%s]", argToken); + wsprintf(buf, "Undefined parts [%s]", arg); MessageBox(NULL, buf, "ERROR", MB_OK | MB_ICONWARNING | MB_TASKMODAL); } } else { mData[mCount - 1].subPartCount++; mData[mCount - 1].subParts[mData[mCount - 1].subPartCount - 1].flags = SPD_PARTS_BY_ID; - mData[mCount - 1].subParts[mData[mCount - 1].subPartCount - 1].objectID = atoi(&argToken[1]); + mData[mCount - 1].subParts[mData[mCount - 1].subPartCount - 1].objectID = atoi(&arg[1]); } - } else if (token[0] == '#') { + } else if (theCmd[0] == '#') { // nothing } else { char buf[256]; - wsprintf(buf, "Undefined token [%s]", token); + wsprintf(buf, "Undefined theCmd [%s]", theCmd); MessageBox(NULL, buf, "ERROR", MB_OK | MB_ICONWARNING | MB_TASKMODAL); } - token = strtok(NULL, " \t\r\n\x1A"); + theCmd = strtok(NULL, " \t\r\n\x1A"); } - free(buffer); + free(theData); } void T2ImageObj::AddObject(const char* name, int pattern, T2BitImage& image, const RECT* rect, BOOL transparent, BOOL halftoneMode) { @@ -317,48 +324,49 @@ void T2ImageObj::DrawObject(void* target, int index, RECT rect, int factor, BOOL _ASSERT(index >= 0); static PARTSLIST parts[500]; - int width = rect.right - rect.left; - int num = 0; - EnumParts(index, width, parts, &num); + RECT srcRect, dstRect; + int theSize = rect.right - rect.left; + int numOfParts = 0; + EnumParts(index, theSize, parts, &numOfParts); - if (num >= 500) + if (numOfParts >= 500) MessageBox(NULL, "Too many parts", "T2ImageObj::DrawObject", MB_OK | MB_ICONERROR | MB_TASKMODAL); - for (int i = 0; i < num; i++) { - RECT srcRect = parts[i].rect; - RECT destRect = srcRect; + for (int n = 0; n < numOfParts; n++) { + srcRect = parts[n].rect; + dstRect = rect; - if ((srcRect.right - srcRect.left) > ((destRect.right - destRect.left) << factor)) - srcRect.right = srcRect.left + ((destRect.right - destRect.left) << factor); + if ((srcRect.right - srcRect.left) > ((dstRect.right - dstRect.left) << factor)) + srcRect.right = srcRect.left + ((dstRect.right - dstRect.left) << factor); - if ((destRect.right - destRect.left) > ((srcRect.right - srcRect.left) >> factor)) - destRect.right = destRect.left + ((srcRect.right - srcRect.left) >> factor); + if ((dstRect.right - dstRect.left) > ((srcRect.right - srcRect.left) >> factor)) + dstRect.right = dstRect.left + ((srcRect.right - srcRect.left) >> factor); - if ((srcRect.bottom - srcRect.top) > ((destRect.bottom - destRect.top) << factor)) - srcRect.bottom = srcRect.top + ((destRect.bottom - destRect.top) << factor); + if ((srcRect.bottom - srcRect.top) > ((dstRect.bottom - dstRect.top) << factor)) + srcRect.bottom = srcRect.top + ((dstRect.bottom - dstRect.top) << factor); - if ((destRect.bottom - destRect.top) > ((srcRect.bottom - srcRect.top) >> factor)) - destRect.bottom = destRect.top + ((srcRect.bottom - srcRect.top) >> factor); + if ((dstRect.bottom - dstRect.top) > ((srcRect.bottom - srcRect.top) >> factor)) + dstRect.bottom = dstRect.top + ((srcRect.bottom - srcRect.top) >> factor); - if (parts[i].transparent) - parts[i].image->SetBackGndColor(0); + if (parts[n].transparent) + parts[n].image->SetBackGndColor(0); else - parts[i].image->SetBackGndColor(-1); + parts[n].image->SetBackGndColor(-1); - if (parts[i].halftoneMode) - parts[i].image->SetHalftoneMode(true); + if (parts[n].halftoneMode) + parts[n].image->SetHalftoneMode(true); else - parts[i].image->SetHalftoneMode(false); + parts[n].image->SetHalftoneMode(false); - parts[i].image->SetForeGndColor(foreGndColor); + parts[n].image->SetForeGndColor(foreGndColor); if (targetIsDC) { - parts[i].image->CopyImage((CDC *) target, srcRect, destRect, false, NULL); + parts[n].image->CopyImage((CDC *) target, srcRect, dstRect, false, NULL); } else { - parts[i].image->CopyImage(*((T2BitImage *) target), srcRect, destRect, false, NULL); + parts[n].image->CopyImage(*((T2BitImage *) target), srcRect, dstRect, false, NULL); } - parts[i].image->SetHalftoneMode(false); + parts[n].image->SetHalftoneMode(false); - rect.left += (destRect.right - destRect.left); + rect.left += (dstRect.right - dstRect.left); } } diff --git a/src/T2DLL/T2ImageObj.h b/src/T2DLL/T2ImageObj.h index a2cde9d..71a9d5e 100644 --- a/src/T2DLL/T2ImageObj.h +++ b/src/T2DLL/T2ImageObj.h @@ -46,7 +46,7 @@ struct ObjectData { SubPartData subParts[4]; }; -class AFX_EXT_CLASS T2ImageObj { +class AFX_CLASS_EXPORT T2ImageObj { public: T2ImageObj(); virtual ~T2ImageObj(); diff --git a/src/T2DLL/T2InfoDialog.h b/src/T2DLL/T2InfoDialog.h index 702340e..5ea04b8 100644 --- a/src/T2DLL/T2InfoDialog.h +++ b/src/T2DLL/T2InfoDialog.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2Dialog.h" -class AFX_EXT_CLASS T2InfoDialog : public T2Dialog { +class AFX_CLASS_EXPORT T2InfoDialog : public T2Dialog { public: T2InfoDialog(T2DrawableObject* object); virtual ~T2InfoDialog(); diff --git a/src/T2DLL/T2Maru_Reggae.cpp b/src/T2DLL/T2Maru_Reggae.cpp index 612dc62..d236e36 100644 --- a/src/T2DLL/T2Maru_Reggae.cpp +++ b/src/T2DLL/T2Maru_Reggae.cpp @@ -2,6 +2,7 @@ #include "GlobalFunc.h" #include "T2Archive.h" #include "T2DateTime.h" +#include "T2DLL.h" #include "T2EquipPtrList.h" #include "T2FloorInfo.h" #include "T2Maru_Reggae.h" diff --git a/src/T2DLL/T2Maru_Reggae.h b/src/T2DLL/T2Maru_Reggae.h index 4184c9a..e0a8b99 100644 --- a/src/T2DLL/T2Maru_Reggae.h +++ b/src/T2DLL/T2Maru_Reggae.h @@ -19,7 +19,7 @@ enum { kMaruReggaeStatus11 = 11, }; -class AFX_EXT_CLASS T2Maru_Reggae : public T2EventItem { +class AFX_CLASS_EXPORT T2Maru_Reggae : public T2EventItem { public: T2Maru_Reggae(T2TowerEvent* inTowerEvent, CResFile* inResFile, int inSubID); virtual ~T2Maru_Reggae(); diff --git a/src/T2DLL/T2Matter.h b/src/T2DLL/T2Matter.h index 4c7b9df..c3c66be 100644 --- a/src/T2DLL/T2Matter.h +++ b/src/T2DLL/T2Matter.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2DrawableObject.h" -class AFX_EXT_CLASS T2Matter : public T2DrawableObject { +class AFX_CLASS_EXPORT T2Matter : public T2DrawableObject { public: T2Matter(); diff --git a/src/T2DLL/T2MatterArray.h b/src/T2DLL/T2MatterArray.h index f19cc44..fe96a05 100644 --- a/src/T2DLL/T2MatterArray.h +++ b/src/T2DLL/T2MatterArray.h @@ -3,7 +3,7 @@ #include "T2Matter.h" #include "T2ObjectArray.h" -class AFX_EXT_CLASS T2MatterArray : public T2ObjectArray { +class AFX_CLASS_EXPORT T2MatterArray : public T2ObjectArray { public: enum { kGroupSize = 448 }; diff --git a/src/T2DLL/T2MatterArrayList.h b/src/T2DLL/T2MatterArrayList.h index d2a33e6..2e71e01 100644 --- a/src/T2DLL/T2MatterArrayList.h +++ b/src/T2DLL/T2MatterArrayList.h @@ -2,7 +2,7 @@ #include "common.h" #include "LArray.h" -class AFX_EXT_CLASS T2MatterArrayList : public LArray { +class AFX_CLASS_EXPORT T2MatterArrayList : public LArray { public: T2MatterArrayList(); virtual ~T2MatterArrayList(); diff --git a/src/T2DLL/T2MatterDef.h b/src/T2DLL/T2MatterDef.h index 62cf41c..6894129 100644 --- a/src/T2DLL/T2MatterDef.h +++ b/src/T2DLL/T2MatterDef.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2TemplatePlugin.h" -class AFX_EXT_CLASS T2MatterDef : public T2TemplatePlugin { +class AFX_CLASS_EXPORT T2MatterDef : public T2TemplatePlugin { public: T2MatterDef(DWORD type, T2PluginSpecifier& specifier, CResFile* resFile); virtual ~T2MatterDef(); @@ -10,11 +10,19 @@ public: virtual void AssignSilhouette(T2TemplatePluginList* list); virtual int GetSortKey() { return mSortKey; } - int GetAttribute() const { return mAttribute; } - virtual T2SilhouetteDef* GetSilhouetteDef() const { return mSilhouetteDef; } + int GetAttribute() const; + virtual T2SilhouetteDef* GetSilhouetteDef() const; int mSortKey; int mAttribute; int mSilhouetteID; T2SilhouetteDef *mSilhouetteDef; }; + +inline int T2MatterDef::GetAttribute() const { + return mAttribute; +} + +inline /*virtual*/ T2SilhouetteDef* T2MatterDef::GetSilhouetteDef() const { + return mSilhouetteDef; +} diff --git a/src/T2DLL/T2Message.cpp b/src/T2DLL/T2Message.cpp index 73850eb..f8cf66f 100644 --- a/src/T2DLL/T2Message.cpp +++ b/src/T2DLL/T2Message.cpp @@ -1,6 +1,12 @@ #include "CT2App.h" #include "T2Message.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + static BOOL s100E3E08; // unknown name - 100E3E0C diff --git a/src/T2DLL/T2Message.h b/src/T2DLL/T2Message.h index 7b16240..bfd3a0c 100644 --- a/src/T2DLL/T2Message.h +++ b/src/T2DLL/T2Message.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS T2Message : public CWnd { +class AFX_CLASS_EXPORT T2Message : public CWnd { DECLARE_MESSAGE_MAP() public: T2Message(); diff --git a/src/T2DLL/T2MetroRailway.cpp b/src/T2DLL/T2MetroRailway.cpp index 246012f..89b44a5 100644 --- a/src/T2DLL/T2MetroRailway.cpp +++ b/src/T2DLL/T2MetroRailway.cpp @@ -2,6 +2,7 @@ #include "GlobalFunc.h" #include "T2BitImage.h" #include "T2DateTime.h" +#include "T2DLL.h" #include "T2ImageObj.h" #include "T2MetroRailway.h" #include "T2SoundPlayer.h" diff --git a/src/T2DLL/T2Mover.h b/src/T2DLL/T2Mover.h index f4979dd..9a303d9 100644 --- a/src/T2DLL/T2Mover.h +++ b/src/T2DLL/T2Mover.h @@ -7,16 +7,20 @@ enum { kMoverStatus9 = 9 }; -class AFX_EXT_CLASS T2Mover : public T2Equip { +class AFX_CLASS_EXPORT T2Mover : public T2Equip { public: T2Mover(); virtual ~T2Mover(); + + void SetShowShaft(BOOL v) { mShowShaft = v; } + void StartBuild() { mStatus = kMoverStatus0; } + virtual BOOL IsBuildFinish() { return mStatus >= kMoverStatus9; } + virtual void SetUsed(BOOL); virtual BOOL Enter(CLink*) { return false; } virtual BOOL Leave(CLink*) { return false; } virtual unsigned int Idle(T2TowerDoc*); virtual void Draw(T2TowerDoc*, const RECT&); - virtual BOOL IsBuildFinish() { return mStatus >= kMoverStatus9; } virtual PROCCODE DoDestruct(T2TowerDoc*, POINT, RECT&); virtual BOOL Destruct(T2TowerDoc*, CRect&); virtual T2InfoDialog* ShowInfoDialog(T2TowerDoc*, CPoint); @@ -58,17 +62,15 @@ public: void ShowShaft(); void HideShaft(); - void SetShowShaft(BOOL v) { mShowShaft = v; } - void StartBuild() { mStatus = kMoverStatus0; } - BOOL IsStair() const { return IsSetAttribute(kMoverAttrIsStair); } - BOOL IsElevator() const { return IsSetAttribute(kMoverAttrIsElevator); } - BOOL IsCheckRequest() const { return mCheckRequest; } - void SetCheckRequest(BOOL v) { mCheckRequest = v; } - int GetLength() const { return mLength; } - int GetWaitCount() const { return mWaitCount; } - T2RequestIDArray* GetReqIDArray() const { return mReqIDArray; } - T2MoverModuleList* GetModuleList() const { return mModuleList; } - BOOL IsShaftVisible() const { return mShowShaft; } + BOOL IsStair() const; + BOOL IsElevator() const; + BOOL IsCheckRequest() const; + void SetCheckRequest(BOOL v); + int GetLength() const; + int GetWaitCount() const; + T2RequestIDArray* GetReqIDArray() const; + T2MoverModuleList* GetModuleList() const; + BOOL IsShaftVisible() const; protected: virtual void LoadSelf(T2Archive&, T2TowerDoc*); @@ -84,3 +86,39 @@ protected: BOOL mShowShaft; BOOL mCheckRequest; }; + +inline BOOL T2Mover::IsStair() const { + return IsSetAttribute(kMoverAttrIsStair); +} + +inline BOOL T2Mover::IsElevator() const { + return IsSetAttribute(kMoverAttrIsElevator); +} + +inline BOOL T2Mover::IsCheckRequest() const { + return mCheckRequest; +} + +inline void T2Mover::SetCheckRequest(BOOL v) { + mCheckRequest = v; +} + +inline int T2Mover::GetLength() const { + return mLength; +} + +inline int T2Mover::GetWaitCount() const { + return mWaitCount; +} + +inline T2RequestIDArray* T2Mover::GetReqIDArray() const { + return mReqIDArray; +} + +inline T2MoverModuleList* T2Mover::GetModuleList() const { + return mModuleList; +} + +inline BOOL T2Mover::IsShaftVisible() const { + return mShowShaft; +} diff --git a/src/T2DLL/T2MoverArray.h b/src/T2DLL/T2MoverArray.h index 4018dba..c832cd1 100644 --- a/src/T2DLL/T2MoverArray.h +++ b/src/T2DLL/T2MoverArray.h @@ -3,7 +3,7 @@ #include "T2Mover.h" #include "T2ObjectArray.h" -class AFX_EXT_CLASS T2MoverArray : public T2ObjectArray { +class AFX_CLASS_EXPORT T2MoverArray : public T2ObjectArray { public: enum { kGroupSize = 32 }; diff --git a/src/T2DLL/T2MoverArrayList.h b/src/T2DLL/T2MoverArrayList.h index 8d69581..566c5c8 100644 --- a/src/T2DLL/T2MoverArrayList.h +++ b/src/T2DLL/T2MoverArrayList.h @@ -2,7 +2,7 @@ #include "common.h" #include "LArray.h" -class AFX_EXT_CLASS T2MoverArrayList : public LArray { +class AFX_CLASS_EXPORT T2MoverArrayList : public LArray { public: T2MoverArrayList(); virtual ~T2MoverArrayList(); diff --git a/src/T2DLL/T2MoverCEArray.h b/src/T2DLL/T2MoverCEArray.h index 34be7dd..b28913b 100644 --- a/src/T2DLL/T2MoverCEArray.h +++ b/src/T2DLL/T2MoverCEArray.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2RouteCEArray.h" -class AFX_EXT_CLASS T2MoverCEArray : public T2RouteCEArray { +class AFX_CLASS_EXPORT T2MoverCEArray : public T2RouteCEArray { public: T2MoverCEArray(); virtual ~T2MoverCEArray(); diff --git a/src/T2DLL/T2MoverDef.h b/src/T2DLL/T2MoverDef.h index 381d8b3..e8e4057 100644 --- a/src/T2DLL/T2MoverDef.h +++ b/src/T2DLL/T2MoverDef.h @@ -2,13 +2,17 @@ #include "common.h" #include "T2EquipDef.h" -class AFX_EXT_CLASS T2MoverDef : public T2EquipDef { +class AFX_CLASS_EXPORT T2MoverDef : public T2EquipDef { public: T2MoverDef(DWORD, T2PluginSpecifier&, CResFile*, T2WorldDef*, T2MoverPlugin*); virtual ~T2MoverDef(); + + int GetMinLength() const { return mMinLength; } + int GetMaxLength() const { return mMaxLength; } + virtual BOOL IsMover() { return true; } + virtual void GetName(CString&); virtual BOOL InitObject(T2Object*) { return false; } - virtual BOOL IsMover() { return true; } virtual CURSORTYPE QueryCursor(T2TowerDoc*, POINT, CString&, RECT&, POINT&, int, unsigned int, int); virtual int CalcMentenanceCostProc(const T2HaveOutViewObject*) const; virtual AREACHECKCODE AreaCheck(T2TowerDoc*, RECT&, unsigned int, int); @@ -29,21 +33,18 @@ public: BOOL InitObject(T2Mover*, const POINT&); - int GetMinLength() const { return mMinLength; } - int GetMaxLength() const { return mMaxLength; } int GetSpeed(int i) const { return (i >= 0 && i < 3) ? mSpeed[i] : 0; } - BOOL IsStair() { return IsSetAttribute(kMoverAttrIsStair); } - void GetAddSize(RECT& r) const { r = mAddSize; } - int GetDefaultWait() const { return mDefaultWait; } - int GetMaxModule() const { return mMaxModule; } - void GetModuleInset(RECT& r) const { r = mModuleInset; } - int GetMaxStop() const { return mMaxStop; } - T2BitImage* GetOffBitMap() const { return mOffBitMap; } - int GetScore() const { return mScore; } - - static unsigned int GetRequiredRequestSpace() { return 4; } + BOOL IsStair(); + void GetAddSize(RECT& r) const; + int GetDefaultWait() const; + int GetMaxModule() const; + void GetModuleInset(RECT& r) const; + int GetMaxStop() const; + T2BitImage* GetOffBitMap() const; + int GetScore() const; + static unsigned int GetRequiredRequestSpace(); protected: RECT mAddSize; @@ -63,3 +64,39 @@ protected: int m1B0[3]; T2BitImage *mOffBitMap; }; + +inline BOOL T2MoverDef::IsStair() { + return IsSetAttribute(kMoverAttrIsStair); +} + +inline void T2MoverDef::GetAddSize(RECT& r) const { + r = mAddSize; +} + +inline int T2MoverDef::GetDefaultWait() const { + return mDefaultWait; +} + +inline int T2MoverDef::GetMaxModule() const { + return mMaxModule; +} + +inline void T2MoverDef::GetModuleInset(RECT& r) const { + r = mModuleInset; +} + +inline int T2MoverDef::GetMaxStop() const { + return mMaxStop; +} + +inline T2BitImage* T2MoverDef::GetOffBitMap() const { + return mOffBitMap; +} + +inline int T2MoverDef::GetScore() const { + return mScore; +} + +inline /*static*/ unsigned int T2MoverDef::GetRequiredRequestSpace() { + return 4; +} diff --git a/src/T2DLL/T2MoverModule.h b/src/T2DLL/T2MoverModule.h index 75a3626..30d3192 100644 --- a/src/T2DLL/T2MoverModule.h +++ b/src/T2DLL/T2MoverModule.h @@ -9,7 +9,7 @@ struct T2MoverModuleMessageData { int value; }; -class AFX_EXT_CLASS T2MoverModule : public T2DrawableObject, public LBroadcaster { +class AFX_CLASS_EXPORT T2MoverModule : public T2DrawableObject, public LBroadcaster { public: T2MoverModule(); virtual ~T2MoverModule(); diff --git a/src/T2DLL/T2MoverModuleList.cpp b/src/T2DLL/T2MoverModuleList.cpp index 0629242..f388435 100644 --- a/src/T2DLL/T2MoverModuleList.cpp +++ b/src/T2DLL/T2MoverModuleList.cpp @@ -124,6 +124,6 @@ unsigned int T2MoverModuleList::GetItemCount() { } } -/*virtual*/ int T2MoverModuleList::GetModuleCount() const { +inline /*virtual*/ int T2MoverModuleList::GetModuleCount() const { return mModuleCount; } diff --git a/src/T2DLL/T2MoverModuleList.h b/src/T2DLL/T2MoverModuleList.h index 515872a..0febad8 100644 --- a/src/T2DLL/T2MoverModuleList.h +++ b/src/T2DLL/T2MoverModuleList.h @@ -2,7 +2,7 @@ #include "common.h" #include "LArray.h" -class AFX_EXT_CLASS T2MoverModuleList : public LArray { +class AFX_CLASS_EXPORT T2MoverModuleList : public LArray { public: T2MoverModuleList(); virtual ~T2MoverModuleList(); diff --git a/src/T2DLL/T2MoverModuleTable.h b/src/T2DLL/T2MoverModuleTable.h index d45c08c..66adb4e 100644 --- a/src/T2DLL/T2MoverModuleTable.h +++ b/src/T2DLL/T2MoverModuleTable.h @@ -9,7 +9,7 @@ struct HomeNotification { T2MoverModuleTable *theTable; }; -class AFX_EXT_CLASS T2MoverModuleTable : public T2DlgItemImageTable { +class AFX_CLASS_EXPORT T2MoverModuleTable : public T2DlgItemImageTable { public: T2MoverModuleTable(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); virtual ~T2MoverModuleTable(); diff --git a/src/T2DLL/T2MoverPlugin.h b/src/T2DLL/T2MoverPlugin.h index aaa4f8f..f3a6b16 100644 --- a/src/T2DLL/T2MoverPlugin.h +++ b/src/T2DLL/T2MoverPlugin.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2EquipPlugin.h" -class AFX_EXT_CLASS T2MoverPlugin : public T2EquipPlugin { +class AFX_CLASS_EXPORT T2MoverPlugin : public T2EquipPlugin { public: T2MoverPlugin(DWORD, T2PluginSpecifier&); virtual ~T2MoverPlugin(); diff --git a/src/T2DLL/T2MoverRoutingTable.cpp b/src/T2DLL/T2MoverRoutingTable.cpp index dd791e4..66c99fe 100644 --- a/src/T2DLL/T2MoverRoutingTable.cpp +++ b/src/T2DLL/T2MoverRoutingTable.cpp @@ -5,6 +5,7 @@ #include "T2MoverRoutingTable.h" #include "T2Request.h" #include "T2RoutingTable.h" +#include "T2RoutingTableElem.h" #include "T2Tenant.h" T2MoverRoutingTable::T2MoverRoutingTable(T2FloorInfo* inFloorInfo, T2FloorPtrList* inFloorPtrList, T2Mover* inMover) diff --git a/src/T2DLL/T2MoverRoutingTable.h b/src/T2DLL/T2MoverRoutingTable.h index 4ea411a..a310821 100644 --- a/src/T2DLL/T2MoverRoutingTable.h +++ b/src/T2DLL/T2MoverRoutingTable.h @@ -2,7 +2,7 @@ #include "common.h" #include "LArray.h" -class AFX_EXT_CLASS T2MoverRoutingTable : private LArray { +class AFX_CLASS_EXPORT T2MoverRoutingTable : private LArray { public: T2MoverRoutingTable(T2FloorInfo* inFloorInfo, T2FloorPtrList* inFloorPtrList, T2Mover* inMover); virtual ~T2MoverRoutingTable(); @@ -16,8 +16,8 @@ public: BOOL GetNextRoute(POINT inPt, unsigned int inFloorID, POINT& ioPt, unsigned int inFloorID2, unsigned int& outScore); T2Tenant* SelectNearFloor(POINT inPt, int& outFinalHPos, unsigned int& ioScore); - T2Mover* GetMover() const { return mMover; } - int GetMoverHPos() const { return mMoverHPos; } + T2Mover* GetMover() const; + int GetMoverHPos() const; protected: BOOL IsStopFloor(int inIndex); @@ -31,3 +31,6 @@ protected: T2FloorPtrList *mFloorPtrList; T2FloorInfo *mFloorInfo; }; + +inline T2Mover* T2MoverRoutingTable::GetMover() const { return mMover; } +inline int T2MoverRoutingTable::GetMoverHPos() const { return mMoverHPos; } diff --git a/src/T2DLL/T2MovieParamArray.h b/src/T2DLL/T2MovieParamArray.h index d642f5e..2bd1771 100644 --- a/src/T2DLL/T2MovieParamArray.h +++ b/src/T2DLL/T2MovieParamArray.h @@ -2,7 +2,7 @@ #include "common.h" #include "LArray.h" -class AFX_EXT_CLASS T2MovieParamArray : private LArray { +class AFX_CLASS_EXPORT T2MovieParamArray : private LArray { public: T2MovieParamArray(); virtual ~T2MovieParamArray(); diff --git a/src/T2DLL/T2MoviePlugin.h b/src/T2DLL/T2MoviePlugin.h index 78f5b70..d46e1b8 100644 --- a/src/T2DLL/T2MoviePlugin.h +++ b/src/T2DLL/T2MoviePlugin.h @@ -12,7 +12,7 @@ struct MovieInfo { int mCC_5; }; -class AFX_EXT_CLASS T2MoviePlugin : public T2SubPlugin { +class AFX_CLASS_EXPORT T2MoviePlugin : public T2SubPlugin { public: T2MoviePlugin(DWORD inType, T2PluginSpecifier& inSpecifier); virtual ~T2MoviePlugin(); diff --git a/src/T2DLL/T2MoviePluginList.h b/src/T2DLL/T2MoviePluginList.h index 56586a7..65fb716 100644 --- a/src/T2DLL/T2MoviePluginList.h +++ b/src/T2DLL/T2MoviePluginList.h @@ -2,7 +2,7 @@ #include "common.h" #include "CFilePluginList.h" -class AFX_EXT_CLASS T2MoviePluginList : public CFilePluginList { +class AFX_CLASS_EXPORT T2MoviePluginList : public CFilePluginList { public: T2MoviePluginList(); virtual ~T2MoviePluginList(); diff --git a/src/T2DLL/T2MovieTable.h b/src/T2DLL/T2MovieTable.h index fe3c9ae..a611ccc 100644 --- a/src/T2DLL/T2MovieTable.h +++ b/src/T2DLL/T2MovieTable.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2VerticalTable.h" -class AFX_EXT_CLASS T2MovieTable : public T2VerticalTable { +class AFX_CLASS_EXPORT T2MovieTable : public T2VerticalTable { public: T2MovieTable(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); virtual ~T2MovieTable() {} diff --git a/src/T2DLL/T2MsgWindowCallback.h b/src/T2DLL/T2MsgWindowCallback.h index da451e0..72ca6bb 100644 --- a/src/T2DLL/T2MsgWindowCallback.h +++ b/src/T2DLL/T2MsgWindowCallback.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS T2MsgWindowCallback { +class AFX_CLASS_EXPORT T2MsgWindowCallback { public: virtual void CallbackZoomIn(); virtual void CallbackZoomOut(); diff --git a/src/T2DLL/T2Name.h b/src/T2DLL/T2Name.h index 102e6a8..6539dec 100644 --- a/src/T2DLL/T2Name.h +++ b/src/T2DLL/T2Name.h @@ -10,7 +10,7 @@ enum { kPeopleNameType = 5 }; -class AFX_EXT_CLASS T2Name { +class AFX_CLASS_EXPORT T2Name { public: T2Name(); T2Name(T2Archive&); diff --git a/src/T2DLL/T2NameList.h b/src/T2DLL/T2NameList.h index 03fd23a..a8a984e 100644 --- a/src/T2DLL/T2NameList.h +++ b/src/T2DLL/T2NameList.h @@ -2,7 +2,7 @@ #include "common.h" #include "LArray.h" -class AFX_EXT_CLASS T2NameList : public LArray { +class AFX_CLASS_EXPORT T2NameList : public LArray { public: T2NameList(); virtual ~T2NameList(); diff --git a/src/T2DLL/T2NameTable.h b/src/T2DLL/T2NameTable.h index 7a47c72..6a64a12 100644 --- a/src/T2DLL/T2NameTable.h +++ b/src/T2DLL/T2NameTable.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2VerticalTable.h" -class AFX_EXT_CLASS T2NameTable : public T2VerticalTable { +class AFX_CLASS_EXPORT T2NameTable : public T2VerticalTable { public: T2NameTable(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); virtual ~T2NameTable() {} diff --git a/src/T2DLL/T2Object.h b/src/T2DLL/T2Object.h index e7c2c4b..a7ca87e 100644 --- a/src/T2DLL/T2Object.h +++ b/src/T2DLL/T2Object.h @@ -38,26 +38,29 @@ enum { kStatus16, }; -class AFX_EXT_CLASS T2Object { +class AFX_CLASS_EXPORT T2Object { public: T2Object(); virtual ~T2Object() {} + BOOL IsUsed() const { return mUsed; } virtual void SetUsed(BOOL u) { mUsed = u; } + + int GetStatus() const { return mStatus; } + void SetStatus(int s) { mStatus = s; } + virtual BOOL Enter(CLink*) { return false; } virtual BOOL Leave(CLink*) { return false; } virtual unsigned int Idle(T2TowerDoc*) { return 0; } + + BOOL IsFavorite() const { return mFavorite; } virtual void SetFavorite(BOOL v); + virtual void Load(T2Archive& archive, T2TowerDoc* towerDoc); virtual void Save(T2Archive& archive); virtual void LoadSelf(T2Archive& archive, T2TowerDoc* towerDoc); virtual void SaveSelf(T2Archive& archive); - BOOL IsUsed() const { return mUsed; } - int GetStatus() const { return mStatus; } - void SetStatus(int s) { mStatus = s; } - BOOL IsFavorite() const { return mFavorite; } - protected: virtual void InitLoaded(); diff --git a/src/T2DLL/T2ObjectArray.h b/src/T2DLL/T2ObjectArray.h index 1d7a6fb..c77317c 100644 --- a/src/T2DLL/T2ObjectArray.h +++ b/src/T2DLL/T2ObjectArray.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS T2ObjectArray { +class AFX_CLASS_EXPORT T2ObjectArray { public: T2ObjectArray(unsigned int startID = 1); virtual ~T2ObjectArray(); diff --git a/src/T2DLL/T2ObjectArrayList.h b/src/T2DLL/T2ObjectArrayList.h index e9e7450..c6037db 100644 --- a/src/T2DLL/T2ObjectArrayList.h +++ b/src/T2DLL/T2ObjectArrayList.h @@ -2,7 +2,7 @@ #include "common.h" #include "CObjectList.h" -class AFX_EXT_CLASS T2ObjectArrayList : public CObjectList { +class AFX_CLASS_EXPORT T2ObjectArrayList : public CObjectList { public: T2ObjectArrayList(); virtual ~T2ObjectArrayList(); diff --git a/src/T2DLL/T2OptionPlugin.h b/src/T2DLL/T2OptionPlugin.h index d02fc29..20fb965 100644 --- a/src/T2DLL/T2OptionPlugin.h +++ b/src/T2DLL/T2OptionPlugin.h @@ -2,9 +2,11 @@ #include "common.h" #include "T2PluginSpecifier.h" -class AFX_EXT_CLASS T2OptionPlugin { +class AFX_CLASS_EXPORT T2OptionPlugin { // a proper definition for this will have to wait // as nothing seems to actually use this subsystem... +protected: + T2OptionPlugin(); public: virtual ~T2OptionPlugin(); virtual CString GetName() const { return "OPTION"; } diff --git a/src/T2DLL/T2OptionPluginList.h b/src/T2DLL/T2OptionPluginList.h index 462575e..b1f0a24 100644 --- a/src/T2DLL/T2OptionPluginList.h +++ b/src/T2DLL/T2OptionPluginList.h @@ -2,7 +2,7 @@ #include "common.h" #include "LArray.h" -class T2OptionPluginList : private LArray { +class AFX_CLASS_EXPORT T2OptionPluginList : private LArray { public: T2OptionPluginList(); virtual ~T2OptionPluginList(); diff --git a/src/T2DLL/T2OutDecoration.h b/src/T2DLL/T2OutDecoration.h index 9dcc8a3..ce7d56d 100644 --- a/src/T2DLL/T2OutDecoration.h +++ b/src/T2DLL/T2OutDecoration.h @@ -3,7 +3,7 @@ #include "LArray.h" #include "T2EventItem.h" -class AFX_EXT_CLASS T2OutDecoration : public T2EventItem { +class AFX_CLASS_EXPORT T2OutDecoration : public T2EventItem { public: T2OutDecoration(T2TowerEvent* inTowerEvent, CResFile* inResFile, int inSubID); virtual ~T2OutDecoration(); diff --git a/src/T2DLL/T2OutObj.h b/src/T2DLL/T2OutObj.h index a3cb599..aea795a 100644 --- a/src/T2DLL/T2OutObj.h +++ b/src/T2DLL/T2OutObj.h @@ -7,7 +7,7 @@ enum { kOutObjStatus1 }; -class AFX_EXT_CLASS T2OutObj : public T2HaveOutViewObject { +class AFX_CLASS_EXPORT T2OutObj : public T2HaveOutViewObject { public: T2OutObj(); virtual ~T2OutObj(); diff --git a/src/T2DLL/T2OutObjArray.h b/src/T2DLL/T2OutObjArray.h index b3791eb..008bd17 100644 --- a/src/T2DLL/T2OutObjArray.h +++ b/src/T2DLL/T2OutObjArray.h @@ -3,7 +3,7 @@ #include "T2ObjectArray.h" #include "T2OutObj.h" -class AFX_EXT_CLASS T2OutObjArray : public T2ObjectArray { +class AFX_CLASS_EXPORT T2OutObjArray : public T2ObjectArray { public: enum { kGroupSize = 64 }; diff --git a/src/T2DLL/T2OutObjArrayList.h b/src/T2DLL/T2OutObjArrayList.h index a028bdd..0ca19f2 100644 --- a/src/T2DLL/T2OutObjArrayList.h +++ b/src/T2DLL/T2OutObjArrayList.h @@ -2,7 +2,7 @@ #include "common.h" #include "LArray.h" -class AFX_EXT_CLASS T2OutObjArrayList : public LArray { +class AFX_CLASS_EXPORT T2OutObjArrayList : public LArray { public: T2OutObjArrayList(); virtual ~T2OutObjArrayList(); diff --git a/src/T2DLL/T2OutObjInfoDialog.h b/src/T2DLL/T2OutObjInfoDialog.h index a13e21c..27800a4 100644 --- a/src/T2DLL/T2OutObjInfoDialog.h +++ b/src/T2DLL/T2OutObjInfoDialog.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2InfoDialog.h" -class AFX_EXT_CLASS T2OutObjInfoDialog : public T2InfoDialog { +class AFX_CLASS_EXPORT T2OutObjInfoDialog : public T2InfoDialog { public: T2OutObjInfoDialog(T2OutObj* inOutObj); virtual ~T2OutObjInfoDialog(); diff --git a/src/T2DLL/T2OuterObjDef.h b/src/T2DLL/T2OuterObjDef.h index 4cb0364..e8c1328 100644 --- a/src/T2DLL/T2OuterObjDef.h +++ b/src/T2DLL/T2OuterObjDef.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2ToolDef.h" -class AFX_EXT_CLASS T2OuterObjDef : public T2ToolDef { +class AFX_CLASS_EXPORT T2OuterObjDef : public T2ToolDef { public: T2OuterObjDef(DWORD, T2PluginSpecifier&, CResFile*, T2WorldDef*, T2ToolPlugin*); virtual ~T2OuterObjDef(); diff --git a/src/T2DLL/T2OuterObjList.cpp b/src/T2DLL/T2OuterObjList.cpp index 09c2908..10224a4 100644 --- a/src/T2DLL/T2OuterObjList.cpp +++ b/src/T2DLL/T2OuterObjList.cpp @@ -1,4 +1,11 @@ #include "T2OuterObjList.h" +#include "T2OutObj.h" T2OuterObjList::~T2OuterObjList() { + LArrayIterator iterator(*this); + T2OutObj *theOutObj; + + while (iterator.Next(&theOutObj)) { + // do fuck all + } } diff --git a/src/T2DLL/T2OuterObjList.h b/src/T2DLL/T2OuterObjList.h index 529d3b9..8069ac1 100644 --- a/src/T2DLL/T2OuterObjList.h +++ b/src/T2DLL/T2OuterObjList.h @@ -2,7 +2,7 @@ #include "common.h" #include "LArray.h" -class AFX_EXT_CLASS T2OuterObjList : public LArray { +class AFX_CLASS_EXPORT T2OuterObjList : public LArray { public: ~T2OuterObjList(); }; diff --git a/src/T2DLL/T2OuterObjPlugin.h b/src/T2DLL/T2OuterObjPlugin.h index eb17310..565859f 100644 --- a/src/T2DLL/T2OuterObjPlugin.h +++ b/src/T2DLL/T2OuterObjPlugin.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2ToolPlugin.h" -class AFX_EXT_CLASS T2OuterObjPlugin : public T2ToolPlugin { +class AFX_CLASS_EXPORT T2OuterObjPlugin : public T2ToolPlugin { public: T2OuterObjPlugin(DWORD inType, T2PluginSpecifier& inSpecifier); virtual ~T2OuterObjPlugin(); diff --git a/src/T2DLL/T2OutsideInfo.h b/src/T2DLL/T2OutsideInfo.h index 0ad058f..abb7cf7 100644 --- a/src/T2DLL/T2OutsideInfo.h +++ b/src/T2DLL/T2OutsideInfo.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS T2OutsideInfo { +class AFX_CLASS_EXPORT T2OutsideInfo { public: T2OutsideInfo(const T2FloorInfo& inFloorInfo); virtual ~T2OutsideInfo(); diff --git a/src/T2DLL/T2PaletteAnime.h b/src/T2DLL/T2PaletteAnime.h index 778834d..31497b2 100644 --- a/src/T2DLL/T2PaletteAnime.h +++ b/src/T2DLL/T2PaletteAnime.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS T2PaletteAnime { +class AFX_CLASS_EXPORT T2PaletteAnime { public: T2PaletteAnime(T2WorldDef*, T2DateTime*); virtual ~T2PaletteAnime(); @@ -17,34 +17,15 @@ public: T2PaletteAnimeDef* GetPaletteAnimeDef() const { return mPaletteAnimeDef; } int GetSkyState() const { return mSkyState; } int GetSkyCount() const { return mSkyCount; } + void IncSECount(); int GetSECount() const { return mSECount; } LOGPALETTE* GetInterPalette() { return mInterCTab; } int GetSEKind() const { return mSEKind; } BOOL IsUpdated() const { return mPaletteUpdated; } void ClearUpdate() { mPaletteUpdated = false; } - void IncSECount() { - mSECount++; - if (mSECount >= 60) - mSECount = 0; - } - BOOL IsFine() const { - BOOL result = true; - if (mSkyState == 3 || mSkyState == 4) - result = false; - return result; - } - BOOL IsSnow() const { return (mSkyState == 4); } - BOOL IsShininDay() const { - switch (mSkyState) { - case 3: - case 4: - case 9: - case 10: - return false; - default: - return true; - } - } + BOOL IsFine() const; + BOOL IsSnow() const; + BOOL IsShininDay() const; protected: void RotatePalette(LOGPALETTE*, unsigned int, unsigned int) const; @@ -70,3 +51,32 @@ private: T2DayLightFilter *mDayLightFilter; T2WeatherFilter *mWeatherFilter; }; + +inline void T2PaletteAnime::IncSECount() { + mSECount++; + if (mSECount >= 60) + mSECount = 0; +} + +inline BOOL T2PaletteAnime::IsFine() const { + BOOL result = true; + if (mSkyState == 3 || mSkyState == 4) + result = false; + return result; +} + +inline BOOL T2PaletteAnime::IsSnow() const { + return (mSkyState == 4); +} + +inline BOOL T2PaletteAnime::IsShininDay() const { + switch (mSkyState) { + case 3: + case 4: + case 9: + case 10: + return false; + default: + return true; + } +} diff --git a/src/T2DLL/T2PaletteAnimeDef.cpp b/src/T2DLL/T2PaletteAnimeDef.cpp index ec58110..ee45d91 100644 --- a/src/T2DLL/T2PaletteAnimeDef.cpp +++ b/src/T2DLL/T2PaletteAnimeDef.cpp @@ -1,9 +1,8 @@ #include "CResFile.h" #include "GlobalFunc.h" +#include "T2DLL.h" #include "T2PaletteAnimeDef.h" -int AFX_EXT_CLASS gCommonColor[20]; - T2PaletteAnimeDef::T2PaletteAnimeDef(HINSTANCE instance, CResFile* resFile) { int i, j; diff --git a/src/T2DLL/T2PaletteAnimeDef.h b/src/T2DLL/T2PaletteAnimeDef.h index dac16fc..6b45469 100644 --- a/src/T2DLL/T2PaletteAnimeDef.h +++ b/src/T2DLL/T2PaletteAnimeDef.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS T2PaletteAnimeDef { +class AFX_CLASS_EXPORT T2PaletteAnimeDef { public: T2PaletteAnimeDef(HINSTANCE, CResFile*); ~T2PaletteAnimeDef(); diff --git a/src/T2DLL/T2People.cpp b/src/T2DLL/T2People.cpp index a238b1c..ce92a22 100644 --- a/src/T2DLL/T2People.cpp +++ b/src/T2DLL/T2People.cpp @@ -4,6 +4,7 @@ #include "T2DateTime.h" #include "T2FloorInfo.h" #include "T2ImageObj.h" +#include "T2MetroRailway.h" #include "T2Mover.h" #include "T2Name.h" #include "T2NameList.h" @@ -131,28 +132,28 @@ int T2People::GetWidth() const { } int T2People::GetRouteType() { - int result = kRouteType0; + int theRouteType = kRouteType0; T2SilhouetteDef *silhouetteDef = mSilhouetteDef[mStyle]; if (!IsSetSpecialFlag(kSpecialFlag80)) { T2SilhouetteDef *silhouetteDef = mSilhouetteDef[mStyle]; if (silhouetteDef) - result = silhouetteDef->GetRouteType(); + theRouteType = silhouetteDef->GetRouteType(); } else { - result = kRouteTypeNeg1; + theRouteType = kRouteTypeNeg1; } - return result; + return theRouteType; } BOOL T2People::CalcWaitPersonArea(T2FloorInfo* floorInfo, RECT& rect) { - BOOL result = false; + BOOL ok = false; - T2Request *request = floorInfo->GetRequest(mCurrEquipID); - if (request) - result = request->CalcPersonArea(this, rect); + T2Request *theRequest = floorInfo->GetRequest(mCurrEquipID); + if (theRequest) + ok = theRequest->CalcPersonArea(this, rect); - return result; + return ok; } void T2People::CalcWalkingSilhouetteArea(RECT& rect) const { @@ -235,9 +236,9 @@ unsigned int T2People::GetCurTenantID() const { if (!IsWalk()) { if (IsReachDestination(towerDoc->towerDoc_vf12C()->GetGroundLine() - 1)) { T2FloorInfo *floorInfo = towerDoc->towerDoc_vf12C(); - T2Tenant *tenant = floorInfo->GetTenant(mDstTenant); - if (tenant) - tenant->EnterTenant(towerDoc, this); + T2Tenant *theDstTenant = floorInfo->GetTenant(mDstTenant); + if (theDstTenant) + theDstTenant->EnterTenant(towerDoc, this); } } break; @@ -268,20 +269,20 @@ unsigned int T2People::GetCurTenantID() const { } void T2People::IdleWaitMover(T2TowerDoc* towerDoc) { - T2FloorInfo *floorInfo = towerDoc->towerDoc_vf12C(); - BOOL changed = IncStress(5); + T2FloorInfo *theFloorInfo = towerDoc->towerDoc_vf12C(); + BOOL didChange = IncStress(5); if (mStress >= 300) { - T2Request *request = floorInfo->GetRequest(mCurrEquipID); + T2Request *request = theFloorInfo->GetRequest(mCurrEquipID); request->Leave(this); JumpToDestination(towerDoc); IncEstimate(-50); - changed = false; + didChange = false; } - if (changed) { + if (didChange) { RECT rect; - CalcWaitPersonArea(floorInfo, rect); + CalcWaitPersonArea(theFloorInfo, rect); towerDoc->GetTowerMainView()->tmv_vf128(rect, false); } } @@ -335,7 +336,7 @@ void T2People::MoveToLobby(T2TowerDoc* towerDoc) { } BOOL T2People::MoveToParking(T2TowerDoc* towerDoc) { - BOOL result = false; + BOOL ok = false; T2RegistedTenantDB *registedTenantDB = towerDoc->towerDoc_vf174(); if (registedTenantDB) { @@ -348,53 +349,65 @@ BOOL T2People::MoveToParking(T2TowerDoc* towerDoc) { if (parking) { SetDestinationToReturn(); parking->EnterTenant(towerDoc, this); - result = true; + ok = true; } } - return result; + return ok; } BOOL T2People::MoveToSubway(T2TowerDoc* towerDoc) { - // TODO: T2MetroRailway - return 0; + BOOL ok = false; + + T2TowerEvent *event = towerDoc->mWorldDef->GetTowerEvent(); + T2DateTime *now = towerDoc->towerDoc_vf120(); + T2Transport *metro = event->GetMetroRailway(); + if (metro) { + T2Transport *available = metro->GetAvailable(now); + if (available) { + available->Enter(this); + ok = true; + } + } + + return ok; } BOOL T2People::MoveToShip(T2TowerDoc* towerDoc) { - BOOL result = false; + BOOL ok = false; - T2TowerEvent *towerEvent = towerDoc->mWorldDef->GetTowerEvent(); + T2TowerEvent *event = towerDoc->mWorldDef->GetTowerEvent(); T2DateTime *now = towerDoc->towerDoc_vf120(); - T2Transport *transport = towerEvent->GetCruise(); - if (transport) { - T2Transport *available = transport->GetAvailable(now); + T2Transport *cruise = event->GetCruise(); + if (cruise) { + T2Transport *available = cruise->GetAvailable(now); if (available) { available->Enter(this); - result = true; + ok = true; } } - return result; + return ok; } void T2People::MoveByEStair(T2TowerDoc* towerDoc) { T2FloorInfo *floorInfo = towerDoc->towerDoc_vf12C(); if (floorInfo) { - T2Tenant *curTenant = floorInfo->GetTenant(mCurrEquipID); - T2Tenant *dstFloor = floorInfo->GetFloor(mCurrDestPos.y, mCurrDestPos.x); + T2Tenant *theCurTenant = floorInfo->GetTenant(mCurrEquipID); + T2Tenant *theDstFloor = floorInfo->GetFloor(mCurrDestPos.y, mCurrDestPos.x); - if (curTenant && dstFloor) { + if (theCurTenant && theDstFloor) { RECT dstRect; - dstFloor->GetEquipArea(dstRect); + theDstFloor->GetEquipArea(dstRect); if (mCurrDestPos.x == dstRect.left) mDirection = 0; else if (mCurrDestPos.x == (dstRect.right - 2)) mDirection = 1; - curTenant->Leave(this); - dstFloor->Enter(this); + theCurTenant->Leave(this); + theDstFloor->Enter(this); } else { ChangeStatus(kStatus3); } @@ -423,13 +436,13 @@ void T2People::SolveNoRoute(T2TowerDoc* towerDoc) { T2FloorInfo *floorInfo = towerDoc->towerDoc_vf12C(); if (IsWalk()) { // "é“ãŒãªã„よ~" - there is no way - CString msg = "\x93\xB9\x82\xAA\x82\xC8\x82\xA2\x82\xE6\x81\x60"; - towerDoc->towerDoc_vf13C()->PeopleBalloonMessage(msg, this); + CString theMessage = "\x93\xB9\x82\xAA\x82\xC8\x82\xA2\x82\xE6\x81\x60"; + towerDoc->towerDoc_vf13C()->PeopleBalloonMessage(theMessage, this); - RECT rect; - CalcWalkingSilhouetteArea(rect); - floorInfo->SetTenantDrawModeByRect(rect, DrawMode1); - towerDoc->GetTowerMainView()->tmv_vf128(rect, false); + RECT theRect; + CalcWalkingSilhouetteArea(theRect); + floorInfo->SetTenantDrawModeByRect(theRect, DrawMode1); + towerDoc->GetTowerMainView()->tmv_vf128(theRect, false); } T2Tenant *tenant = floorInfo->GetTenant(mCurrEquipID); @@ -447,7 +460,7 @@ void T2People::SolveNoRoute(T2TowerDoc* towerDoc) { } BOOL T2People::FindRoute(T2TowerDoc* towerDoc) { - BOOL result = false; + BOOL ok = false; int status = mStatus; T2FloorInfo *floorInfo = towerDoc->towerDoc_vf12C(); @@ -461,7 +474,7 @@ BOOL T2People::FindRoute(T2TowerDoc* towerDoc) { status = kStatus10; else status = kStatus14; - result = true; + ok = true; } else { int routeType = GetRouteType(); if (towerDoc->towerDoc_vf124()->GetNextRoute(mCurPosition, mCurrDestPos, routeType)) { @@ -469,13 +482,13 @@ BOOL T2People::FindRoute(T2TowerDoc* towerDoc) { status = kStatus5; else status = kStatus13; - result = true; + ok = true; } } } } - if (result) { + if (ok) { if (mCurPosition.x < mCurrDestPos.x) mDirection = 0; else @@ -488,7 +501,7 @@ BOOL T2People::FindRoute(T2TowerDoc* towerDoc) { trafficInfo->Pass(mCurPosition, mCurrDestPos, 1); } - return result; + return ok; } void T2People::JumpToDestination(T2TowerDoc* towerDoc) { @@ -510,7 +523,7 @@ void T2People::GoOutTower(T2TowerDoc* towerDoc) { } void T2People::IdleSearchedPerson(T2TowerDoc* towerDoc) { - BOOL flag = false; + BOOL changed = false; int varC; if (someGlobalPeople == this) @@ -523,23 +536,23 @@ void T2People::IdleSearchedPerson(T2TowerDoc* towerDoc) { case kStatus13: case kStatus14: if (mDirection != 1) - flag = WalkSearchedPersonRight(towerDoc); + changed = WalkSearchedPersonRight(towerDoc); else - flag = WalkSearchedPersonLeft(towerDoc); + changed = WalkSearchedPersonLeft(towerDoc); break; case kStatus2: { T2TowerMainView *mainView = towerDoc->GetTowerMainView(); - RECT rect; - CalcWalkingSilhouetteArea(rect); - mainView->tmv_vf128(rect, false); + RECT area; + CalcWalkingSilhouetteArea(area); + mainView->tmv_vf128(area, false); mStatus = kStatus3; break; } } - if (flag) { + if (changed) { switch (mStatus) { case kStatus5: if (!IsRegistRequest(towerDoc)) @@ -549,9 +562,9 @@ void T2People::IdleSearchedPerson(T2TowerDoc* towerDoc) { case kStatus10: { T2FloorInfo *floorInfo = towerDoc->towerDoc_vf12C(); - T2Tenant *tenant = floorInfo->GetTenant(mDstTenant); - if (tenant) - tenant->EnterTenant(towerDoc, this); + T2Tenant *theDstTenant = floorInfo->GetTenant(mDstTenant); + if (theDstTenant) + theDstTenant->EnterTenant(towerDoc, this); else ChangeStatus(kStatus4); break; @@ -573,88 +586,88 @@ void T2People::IdleSearchedPerson(T2TowerDoc* towerDoc) { } BOOL T2People::WalkSearchedPersonRight(T2TowerDoc* towerDoc) { - BOOL result = false; + BOOL ok = false; T2FloorInfo *floorInfo = towerDoc->mFloorInfo; - T2TowerMainView *towerMainView = towerDoc->GetTowerMainView(); + T2TowerMainView *theMainView = towerDoc->GetTowerMainView(); RECT rect; SetRect(&rect, mCurPosition.x, mCurPosition.y, mCurPosition.x + 2, mCurPosition.y + 1); floorInfo->SetTenantDrawModeByRect(rect, DrawMode1); - towerMainView->tmv_vf128(rect, false); + theMainView->tmv_vf128(rect, false); - int var = 2; + int theWalkWidth = 2; - if ((mCurPosition.x + var) > mCurrDestPos.x) { + if ((mCurPosition.x + theWalkWidth) < mCurrDestPos.x) { if (mWalkStyle != 1) ChangeWalkStyle(1); else ChangeWalkStyle(0); } else { - var = mCurrDestPos.x - mCurPosition.x; + theWalkWidth = mCurrDestPos.x - mCurPosition.x; ChangeWalkStyle(0); - result = true; + ok = true; } - mCurPosition.x += var; - OffsetRect(&rect, var, 0); - towerMainView->tmv_vf128(rect, false); + mCurPosition.x += theWalkWidth; + OffsetRect(&rect, theWalkWidth, 0); + theMainView->tmv_vf128(rect, false); if (mCurPosition.y != (floorInfo->GetGroundLine() - 1)) - IncStress(var / 4); + IncStress(theWalkWidth / 4); - return result; + return ok; } BOOL T2People::WalkSearchedPersonLeft(T2TowerDoc* towerDoc) { - BOOL result = false; + BOOL ok = false; T2FloorInfo *floorInfo = towerDoc->towerDoc_vf12C(); - T2TowerMainView *towerMainView = towerDoc->GetTowerMainView(); + T2TowerMainView *theMainView = towerDoc->GetTowerMainView(); RECT rect; SetRect(&rect, mCurPosition.x, mCurPosition.y, mCurPosition.x + 2, mCurPosition.y + 1); floorInfo->SetTenantDrawModeByRect(rect, DrawMode1); - towerMainView->tmv_vf128(rect, false); + theMainView->tmv_vf128(rect, false); - int var = 2; + int theWalkWidth = 2; - if ((mCurPosition.x - var) > mCurrDestPos.x) { + if ((mCurPosition.x - theWalkWidth) > mCurrDestPos.x) { if (mWalkStyle != 1) ChangeWalkStyle(1); else ChangeWalkStyle(0); } else { - var = mCurPosition.x - mCurrDestPos.x; + theWalkWidth = mCurPosition.x - mCurrDestPos.x; ChangeWalkStyle(0); - result = true; + ok = true; } #line 809 - _ASSERT(var >= 0); + _ASSERT(theWalkWidth >= 0); - mCurPosition.x -= var; - OffsetRect(&rect, -var, 0); - towerMainView->tmv_vf128(rect, false); + mCurPosition.x -= theWalkWidth; + OffsetRect(&rect, -theWalkWidth, 0); + theMainView->tmv_vf128(rect, false); if (mCurPosition.y != (floorInfo->GetGroundLine() - 1)) - IncStress(var / 4); + IncStress(theWalkWidth / 4); - return result; + return ok; } BOOL T2People::IsReachDestination(int y) { - BOOL result = false; + BOOL ok = false; int var = 16; if (mDirection != 1) { if ((mCurPosition.x + var) >= mCurrDestPos.x) { var = mCurrDestPos.x - mCurPosition.x; - result = true; + ok = true; } mCurPosition.x += var; } else { if ((mCurPosition.x - var) <= mCurrDestPos.x) { var = mCurPosition.x - mCurrDestPos.x; - result = true; + ok = true; } mCurPosition.x -= var; } @@ -662,18 +675,18 @@ BOOL T2People::IsReachDestination(int y) { if (mCurPosition.y != y) IncStress(var / 4); - return result; + return ok; } BOOL T2People::IsRegistRequest(T2TowerDoc* towerDoc) { - BOOL result = false; + BOOL done = false; - T2FloorInfo *floorInfo = towerDoc->mFloorInfo; - T2Request *request = floorInfo->GetRequest(mCurPosition.y, mCurPosition.x); - if (request) - result = request->Regist(towerDoc, this); + T2FloorInfo *theFloorInfo = towerDoc->mFloorInfo; + T2Request *theRequest = theFloorInfo->GetRequest(mCurPosition.y, mCurPosition.x); + if (theRequest) + done = theRequest->Regist(towerDoc, this); - return result; + return done; } void T2People::ChangeStatus(int status) { @@ -700,7 +713,12 @@ void T2People::SetSilhouette() { T2SilhouetteDef *silhouetteDef = mSilhouetteDef[mStyle]; if (silhouetteDef) { - m18 = silhouetteDef->GetSilhouette((mDirection != -1) ? mDirection : 0, mWalkStyle); + int var; + if (mDirection != -1) + var = mDirection; + else + var = 0; + m18 = silhouetteDef->GetSilhouette(var, mWalkStyle); } else { m18 = 0; } @@ -724,7 +742,7 @@ void T2People::SetAnimePattern(int fillerStart, int fillerRange, int hStart, int } BOOL T2People::StopOnHisWay(T2TenantMemberDef* tenantMemberDef, int econoType, int score, RECT rect, int bindTime, int tenantType, int tenantID, int startTime) { - BOOL result = false; + BOOL ok = false; BOOL negScoreFlag = false; if (score < 0) { @@ -739,18 +757,18 @@ BOOL T2People::StopOnHisWay(T2TenantMemberDef* tenantMemberDef, int econoType, i if (SetDestinationToReturn()) { SetDestination(tenantID, startTime); ChangeStatus(kStatus3); - result = true; + ok = true; } } } } } - return result; + return ok; } BOOL T2People::CalledInTenant(T2TenantMemberDef* tenantMemberDef, int econoType, int bindTime, int tenantType, unsigned int tenantID, unsigned int startTime) { - BOOL result = false; + BOOL ok = false; if (CalcFreeTime(startTime) > bindTime && mPrevTenantType != tenantType) { #line 992 @@ -758,11 +776,11 @@ BOOL T2People::CalledInTenant(T2TenantMemberDef* tenantMemberDef, int econoType, if (mPeopleType->CheckWithDemand(tenantMemberDef, econoType)) { SetDestination(tenantID, startTime); - result = true; + ok = true; } } - return result; + return ok; } int T2People::CalcFreeTime(unsigned int time) { @@ -878,23 +896,23 @@ BOOL T2People::StressChanged() { BOOL changed = false; if (!IsSpecialColor()) { - int col = mColor; + int color = mColor; T2PeopleDef *def = (T2PeopleDef *) GetMatterDef(); if (!def) return false; if (mStress < def->GetStressBlueLimit()) - col = 1; + color = 1; else if (mStress < def->GetStressYellowLimit()) - col = 7; + color = 7; else if (mStress < (def->GetStressMax() - 10)) - col = 9; + color = 9; else - col = 9; + color = 9; - if (mColor != col) { - mColor = col; + if (mColor != color) { + mColor = color; changed = true; } } @@ -944,29 +962,29 @@ void T2People::ClearColor() { } BOOL T2People::VIPEstimation() { - BOOL result = false; + BOOL ok = false; if (IsVIP()) - result = CalcCurrEstimate() > 200; + ok = CalcCurrEstimate() > 200; - return result; + return ok; } BOOL T2People::SearchToilet(T2TowerDoc* towerDoc) { - BOOL result = false; + BOOL ok = false; if (SetDestinationToReturn()) { - T2RegistedTenantDB *registedTenantDB = towerDoc->towerDoc_vf174(); - T2RouteNavigator *routeNavigator = towerDoc->towerDoc_vf124(); - if (registedTenantDB && routeNavigator) { + T2RegistedTenantDB *theDB = towerDoc->towerDoc_vf174(); + T2RouteNavigator *theNavi = towerDoc->towerDoc_vf124(); + if (theDB && theNavi) { int toiletStatus; - T2Tenant *toilet = registedTenantDB->SearchToilet(routeNavigator, mCurPosition, toiletStatus); + T2Tenant *theToilet = theDB->SearchToilet(theNavi, mCurPosition, toiletStatus); - if (toilet) { - toilet->IncReserveCount(1); - SetDestination(toilet->GetEquipID()); + if (theToilet) { + theToilet->IncReserveCount(1); + SetDestination(theToilet->GetEquipID()); SetStatus(kStatus3); - result = true; + ok = true; } else { SetReturnToDestination(); T2TowerMessage *towerMessage = towerDoc->towerDoc_vf13C(); @@ -988,7 +1006,7 @@ BOOL T2People::SearchToilet(T2TowerDoc* towerDoc) { } } - return result; + return ok; } void T2People::DrawSearchedPerson(T2TowerDoc* towerDoc) { @@ -1050,9 +1068,9 @@ void T2People::Draw(T2TowerDoc* towerDoc, T2Equip* equip) { UT2Coordinate::UnitToQD(rect, towerDoc->towerDoc_vf108()); - int objectID = equip->GetEquipDef()->mImageObj->FindObject(1003, mFiller); - if (objectID >= 0) - equip->GetEquipDef()->mImageObj->DrawObject(towerDoc->towerDoc_vf10C(), objectID, rect, towerDoc->towerDoc_vf108()); + int theInd = equip->GetEquipDef()->mImageObj->FindObject(1003, mFiller); + if (theInd >= 0) + equip->GetEquipDef()->mImageObj->DrawObject(towerDoc->towerDoc_vf10C(), theInd, rect, towerDoc->towerDoc_vf108()); } } @@ -1064,9 +1082,9 @@ void T2People::DrawAt(T2TowerDoc* towerDoc, T2Equip* equip, POINT pt) { UT2Coordinate::UnitToQD(rect, towerDoc->towerDoc_vf108()); - int objectID = equip->GetEquipDef()->mImageObj->FindObject(1003, mFiller); - if (objectID >= 0) - equip->GetEquipDef()->mImageObj->DrawObject(towerDoc->towerDoc_vf10C(), objectID, rect); + int theInd = equip->GetEquipDef()->mImageObj->FindObject(1003, mFiller); + if (theInd >= 0) + equip->GetEquipDef()->mImageObj->DrawObject(towerDoc->towerDoc_vf10C(), theInd, rect); } } @@ -1133,43 +1151,43 @@ void T2People::Interview(T2TowerDoc* towerDoc) { } BOOL T2People::GetInterviewWords(T2TowerDoc* towerDoc, CString& outStr) { - OptionEvent11Data eventData; + OptionEvent11Data optionEvent; - eventData.str = &outStr; - eventData.people = this; - if (!DispatchOptionEvent(OptionEventType_11, &eventData)) + optionEvent.people = this; + optionEvent.str = &outStr; + if (!DispatchOptionEvent(OptionEventType_11, &optionEvent)) return outStr != ""; - unsigned int flags = 0; + unsigned int theFlags = 0; - T2PeopleDef *peopleDef = (T2PeopleDef *) GetMatterDef(); - T2FloorInfo *floorInfo = towerDoc->towerDoc_vf12C(); - T2Tenant *dstTenant = floorInfo->GetTenant(mDstTenant); - T2Tenant *workTenant = floorInfo->GetTenant(GetWorkTenant()); + T2PeopleDef *thePeopleDef = (T2PeopleDef *) GetMatterDef(); + T2FloorInfo *theFloorInfo = towerDoc->towerDoc_vf12C(); + T2Tenant *theDstTenant = theFloorInfo->GetTenant(mDstTenant); + T2Tenant *theWorkTenant = theFloorInfo->GetTenant(GetWorkTenant()); - T2EquipDef *equipDef = NULL; + T2EquipDef *theEquipDef = NULL; if (mDstTenant != 1) { - if (dstTenant) { - equipDef = dstTenant->GetEquipDef(); - if (dstTenant == workTenant) - flags |= 1; + if (theDstTenant) { + theEquipDef = theDstTenant->GetEquipDef(); + if (theDstTenant == theWorkTenant) + theFlags |= 1; } } else { - flags |= 8; - equipDef = towerDoc->mTenantTemplates->FindTenantDef(mPrevTenantType); - if (workTenant && workTenant->GetEquipDef() == equipDef) - flags |= 1; + theFlags |= 8; + theEquipDef = towerDoc->mTenantTemplates->FindTenantDef(mPrevTenantType); + if (theWorkTenant && theWorkTenant->GetEquipDef() == theEquipDef) + theFlags |= 1; } if (mStyle == kPeopleStyle1) - flags |= 2; + theFlags |= 2; else if (mStyle == kPeopleStyle2) - flags |= 4; + theFlags |= 4; unsigned int level = 0; if (IsVIP()) { if (mDstTenant == 1 && VIPEstimation()) - flags |= 0x10; + theFlags |= 0x10; switch (towerDoc->towerDoc_vf138()) { case 1: @@ -1184,40 +1202,40 @@ BOOL T2People::GetInterviewWords(T2TowerDoc* towerDoc, CString& outStr) { } } else if (IsMaru()) { level = 6; - flags &= ~1; + theFlags &= ~1; } else if (IsReggae()) { level = 7; - } else if (IsSetSpecialFlag(kSpecialFlag4) && (!dstTenant || dstTenant->GetRegistID() != kTenantRegistID4)) { + } else if (IsSetSpecialFlag(kSpecialFlag4) && (!theDstTenant || theDstTenant->GetRegistID() != kTenantRegistID4)) { level = 1; - } else if (IsSetSpecialFlag(kSpecialFlag2) && (!dstTenant || dstTenant->GetRegistID() != kTenantRegistID7)) { + } else if (IsSetSpecialFlag(kSpecialFlag2) && (!theDstTenant || theDstTenant->GetRegistID() != kTenantRegistID7)) { level = 2; } - T2WordDefArray *wordDefArray = NULL; + T2WordDefArray *theWordDefArray = NULL; if (level != 0) { - wordDefArray = towerDoc->towerDoc_vf170()->mWordDefArray; + theWordDefArray = towerDoc->towerDoc_vf170()->mWordDefArray; } else { - if (mStatus == kStatus6 && peopleDef && mStress >= peopleDef->GetStressYellowLimit()) { - T2Request *request = floorInfo->GetRequest(mCurrEquipID); + if (mStatus == kStatus6 && thePeopleDef && mStress >= thePeopleDef->GetStressYellowLimit()) { + T2Request *request = theFloorInfo->GetRequest(mCurrEquipID); if (request) { unsigned int moverID = request->GetMoverID(); if (moverID) { - T2Mover *mover = floorInfo->GetMover(moverID); - equipDef = mover ? mover->GetEquipDef() : NULL; + T2Mover *mover = theFloorInfo->GetMover(moverID); + theEquipDef = mover ? mover->GetEquipDef() : NULL; } } } - wordDefArray = equipDef ? equipDef->mWordDefArray : NULL; + theWordDefArray = theEquipDef ? theEquipDef->mWordDefArray : NULL; } - if (wordDefArray) - wordDefArray->GetWords(GetSex(), GetAge(), flags, level, outStr); + if (theWordDefArray) + theWordDefArray->GetWords(GetSex(), GetAge(), theFlags, level, outStr); - eventData.str = &outStr; - eventData.people = this; - DispatchOptionEvent(OptionEventType_12, &eventData); + optionEvent.people = this; + optionEvent.str = &outStr; + DispatchOptionEvent(OptionEventType_12, &optionEvent); return outStr != ""; } @@ -1257,6 +1275,7 @@ void T2People::BreakoutEmergency(T2TowerDoc* towerDoc) { T2Matter::LoadSelf(archive, towerDoc); if (IsUsed()) { +#pragma var_order(uc, s, us, i, peopleTypeCode, linkID, linkCode) unsigned char uc; short s; unsigned short us; @@ -1328,6 +1347,7 @@ void T2People::BreakoutEmergency(T2TowerDoc* towerDoc) { T2Matter::SaveSelf(archive); if (IsUsed()) { +#pragma var_order(linkPeople, uc, s, emptyLinkID, us, i, peopleTypeCode, linkCode) unsigned char uc; short s; unsigned short us; @@ -1466,13 +1486,13 @@ void T2People::GetName(CString& outStr) { } } -void T2People::ClearSpecialFlag(unsigned int flag) { +inline void T2People::ClearSpecialFlag(unsigned int flag) { mSpecialFlag &= ~flag; if ((flag & kSpecialFlag4) > 0) mColor = 1; } -void T2People::SetSpecialFlag(unsigned int flag) { +inline void T2People::SetSpecialFlag(unsigned int flag) { mSpecialFlag |= flag; if ((flag & kSpecialFlag4) > 0) mColor = 17; diff --git a/src/T2DLL/T2People.h b/src/T2DLL/T2People.h index d1c99ec..74c63d0 100644 --- a/src/T2DLL/T2People.h +++ b/src/T2DLL/T2People.h @@ -22,7 +22,7 @@ enum { kMaxPeopleStyle = 2 }; -class AFX_EXT_CLASS T2People : public CLink, public T2Matter { +class AFX_CLASS_EXPORT T2People : public CLink, public T2Matter { public: T2People(); virtual ~T2People(); @@ -106,18 +106,8 @@ public: void InitStress() { mStress = 0; } int GetStress() const { return mStress; } int GetEstimate() const { return mEstimate; } - unsigned int GetAge() const { - unsigned int age = 0; - if (mPeopleType) - age = mPeopleType->GetAge(); - return age; - } - unsigned int GetSex() const { - unsigned int sex = 1; - if (mPeopleType) - sex = !mPeopleType->IsMale(); - return sex; - } + unsigned int GetAge() const; + unsigned int GetSex() const; protected: virtual void LoadSelf(T2Archive&, T2TowerDoc*); @@ -170,3 +160,16 @@ protected: private: void Initialize(); }; + +inline unsigned int T2People::GetAge() const { + unsigned int age = 0; + if (mPeopleType) + age = mPeopleType->GetAge(); + return age; +} +inline unsigned int T2People::GetSex() const { + unsigned int sex = 1; + if (mPeopleType) + sex = !mPeopleType->IsMale(); + return sex; +} diff --git a/src/T2DLL/T2PeopleAnimeDef.cpp b/src/T2DLL/T2PeopleAnimeDef.cpp index 7297df0..a392cca 100644 --- a/src/T2DLL/T2PeopleAnimeDef.cpp +++ b/src/T2DLL/T2PeopleAnimeDef.cpp @@ -1,6 +1,7 @@ #include "CResFile.h" #include "T2People.h" #include "T2PeopleAnimeDef.h" +#include "T2PeopleAnimeDefElem.h" #include "UT2Utils.h" T2PeopleAnimeDef::T2PeopleAnimeDef(CResFile& resFile) { @@ -35,31 +36,3 @@ void T2PeopleAnimeDef::Set(T2People* people, int h, int inIndex) { mElems[index].Set(people, h); } } - - - -T2PeopleAnimeDefElem::T2PeopleAnimeDefElem() { - mFillerStart = 0; - mFillerRange = 0; - mHStart = 0; - mHRange = 0; -} - -/*virtual*/ T2PeopleAnimeDefElem::~T2PeopleAnimeDefElem() { -} - -void T2PeopleAnimeDefElem::Initialize(CResFile& resFile) { - resFile >> mFillerStart; - resFile >> mFillerRange; - resFile >> mHStart; - resFile >> mHRange; -} - -void T2PeopleAnimeDefElem::Set(T2People* people, int h) { - if (mFillerStart >= 0) { - people->SetFiller(mFillerStart + UT2Utils::Randomize(mFillerRange)); - people->MoveHTo(h + mHStart + UT2Utils::Randomize(mHRange)); - } else { - people->SetFiller(-1); - } -} diff --git a/src/T2DLL/T2PeopleAnimeDef.h b/src/T2DLL/T2PeopleAnimeDef.h index f83a77b..1ee14d0 100644 --- a/src/T2DLL/T2PeopleAnimeDef.h +++ b/src/T2DLL/T2PeopleAnimeDef.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS T2PeopleAnimeDef { +class AFX_CLASS_EXPORT T2PeopleAnimeDef { public: T2PeopleAnimeDef(CResFile& resFile); virtual ~T2PeopleAnimeDef(); @@ -16,17 +16,3 @@ private: int m10; T2PeopleAnimeDefElem *mElems; }; - -class AFX_EXT_CLASS T2PeopleAnimeDefElem { -public: - T2PeopleAnimeDefElem(); - virtual ~T2PeopleAnimeDefElem(); - void Initialize(CResFile& resFile); - void Set(T2People* people, int h); - -private: - int mFillerStart; - int mFillerRange; - int mHStart; - int mHRange; -}; diff --git a/src/T2DLL/T2PeopleAnimeDefElem.cpp b/src/T2DLL/T2PeopleAnimeDefElem.cpp new file mode 100644 index 0000000..4edc362 --- /dev/null +++ b/src/T2DLL/T2PeopleAnimeDefElem.cpp @@ -0,0 +1,30 @@ +#include "CResFile.h" +#include "T2People.h" +#include "T2PeopleAnimeDefElem.h" +#include "UT2Utils.h" + +T2PeopleAnimeDefElem::T2PeopleAnimeDefElem() { + mFillerStart = 0; + mFillerRange = 0; + mHStart = 0; + mHRange = 0; +} + +/*virtual*/ T2PeopleAnimeDefElem::~T2PeopleAnimeDefElem() { +} + +void T2PeopleAnimeDefElem::Initialize(CResFile& resFile) { + resFile >> mFillerStart; + resFile >> mFillerRange; + resFile >> mHStart; + resFile >> mHRange; +} + +void T2PeopleAnimeDefElem::Set(T2People* people, int h) { + if (mFillerStart >= 0) { + people->SetFiller(mFillerStart + UT2Utils::Randomize(mFillerRange)); + people->MoveHTo(h + mHStart + UT2Utils::Randomize(mHRange)); + } else { + people->SetFiller(-1); + } +} diff --git a/src/T2DLL/T2PeopleAnimeDefElem.h b/src/T2DLL/T2PeopleAnimeDefElem.h new file mode 100644 index 0000000..3f02175 --- /dev/null +++ b/src/T2DLL/T2PeopleAnimeDefElem.h @@ -0,0 +1,16 @@ +#pragma once +#include "common.h" + +class AFX_CLASS_EXPORT T2PeopleAnimeDefElem { +public: + T2PeopleAnimeDefElem(); + virtual ~T2PeopleAnimeDefElem(); + void Initialize(CResFile& resFile); + void Set(T2People* people, int h); + +private: + int mFillerStart; + int mFillerRange; + int mHStart; + int mHRange; +}; diff --git a/src/T2DLL/T2PeopleArray.h b/src/T2DLL/T2PeopleArray.h index 49dd766..8e64e3d 100644 --- a/src/T2DLL/T2PeopleArray.h +++ b/src/T2DLL/T2PeopleArray.h @@ -3,7 +3,7 @@ #include "T2ObjectArray.h" #include "T2People.h" -class AFX_EXT_CLASS T2PeopleArray : public T2ObjectArray { +class AFX_CLASS_EXPORT T2PeopleArray : public T2ObjectArray { public: T2PeopleArray(unsigned int startID = 1); virtual ~T2PeopleArray() {} diff --git a/src/T2DLL/T2PeopleArrayList.cpp b/src/T2DLL/T2PeopleArrayList.cpp index 91b94a6..25e5984 100644 --- a/src/T2DLL/T2PeopleArrayList.cpp +++ b/src/T2DLL/T2PeopleArrayList.cpp @@ -32,10 +32,11 @@ T2PeopleArray* T2PeopleArrayList::GetItemAt(int index) { T2People* T2PeopleArrayList::FindPeople(unsigned int peopleID) { LArrayIterator iterator(*this); + T2People *people; T2PeopleArray *peopleArray; while (iterator.Next(&peopleArray)) { - T2People *people = peopleArray->FindPeople(peopleID); + people = peopleArray->FindPeople(peopleID); if (people) return people; } @@ -112,37 +113,37 @@ void T2PeopleArrayList::AddStress(int v) { } void T2PeopleArrayList::Read(T2Archive& archive, T2TowerDoc* towerDoc) { - int count; - archive >> count; + int numOfPeopleArrays; + archive >> numOfPeopleArrays; RemoveItemsAt(GetCount(), 1); unsigned int startID = 1; - for (int i = 0; i < count; i++) { + for (int i = 0; i < numOfPeopleArrays; i++) { Add(new T2PeopleArray(startID)); startID += 256; } - T2PeopleArray *peopleArray; + T2PeopleArray *thePeopleArray; - LArrayIterator iterator1(*this); - while (iterator1.Next(&peopleArray)) - peopleArray->Read(archive, towerDoc); + LArrayIterator iter(*this); + while (iter.Next(&thePeopleArray)) + thePeopleArray->Read(archive, towerDoc); - LArrayIterator iterator2(*this); - while (iterator2.Next(&peopleArray)) - peopleArray->ResolveLink(this); + LArrayIterator iter2(*this); + while (iter2.Next(&thePeopleArray)) + thePeopleArray->ResolveLink(this); } void T2PeopleArrayList::Write(T2Archive& archive) { - int count = GetItemCount(); - archive << count; + int numOfPeopleArrays = GetItemCount(); + archive << numOfPeopleArrays; LArrayIterator iterator(*this); - T2PeopleArray *peopleArray; + T2PeopleArray *thePeopleArray; - while (iterator.Next(&peopleArray)) - peopleArray->Write(archive); + while (iterator.Next(&thePeopleArray)) + thePeopleArray->Write(archive); } void T2PeopleArrayList::BreakoutEmergency(T2TowerDoc* towerDoc) { diff --git a/src/T2DLL/T2PeopleArrayList.h b/src/T2DLL/T2PeopleArrayList.h index 88af4ae..9ace5dc 100644 --- a/src/T2DLL/T2PeopleArrayList.h +++ b/src/T2DLL/T2PeopleArrayList.h @@ -2,7 +2,7 @@ #include "common.h" #include "LArray.h" -class AFX_EXT_CLASS T2PeopleArrayList : private LArray { +class AFX_CLASS_EXPORT T2PeopleArrayList : private LArray { public: T2PeopleArrayList(); virtual ~T2PeopleArrayList(); diff --git a/src/T2DLL/T2PeopleDef.h b/src/T2DLL/T2PeopleDef.h index 6e0cafb..256bf9c 100644 --- a/src/T2DLL/T2PeopleDef.h +++ b/src/T2DLL/T2PeopleDef.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2MatterDef.h" -class AFX_EXT_CLASS T2PeopleDef : public T2MatterDef { +class AFX_CLASS_EXPORT T2PeopleDef : public T2MatterDef { public: T2PeopleDef(DWORD type, T2PluginSpecifier& specifier, CResFile* resFile); virtual ~T2PeopleDef(); diff --git a/src/T2DLL/T2PeopleDemandList.cpp b/src/T2DLL/T2PeopleDemandList.cpp index e8def3b..e9fdcdd 100644 --- a/src/T2DLL/T2PeopleDemandList.cpp +++ b/src/T2DLL/T2PeopleDemandList.cpp @@ -11,11 +11,11 @@ T2PeopleDemandList::T2PeopleDemandList(T2PoolDef* inPoolDef, T2SeasonParamDef* i : LArray(sizeof(T2PeopleTimeZoneList *)) , mSeasonParamDef(inSeasonParamDef) { - int count = inPoolDef->GetNumOfDemand(); - for (int i = 0; i < count; i++) { - DemandInfo *theDemandInfo = inPoolDef->GetDemandInfo(i); - T2PeopleTimeZoneList *theTimeZoneList = new T2PeopleTimeZoneList(theDemandInfo->b, theDemandInfo->a, inWorldDef); - Add(theTimeZoneList); + int numDemand = inPoolDef->GetNumOfDemand(); + for (int i = 0; i < numDemand; i++) { + DemandInfo *theDemand = inPoolDef->GetDemandInfo(i); + T2PeopleTimeZoneList *list = new T2PeopleTimeZoneList(theDemand->b, theDemand->a, inWorldDef); + Add(list); } } @@ -45,43 +45,43 @@ void T2PeopleDemandList::Add(T2PeopleTimeZoneList* inTimeZoneList) { } void T2PeopleDemandList::Add(T2PoolGradeDef* inGradeDef) { + T2PeopleTimeZoneList *theTimeZoneList; LArrayIterator iterator(*this); - int demandType = 0; + int theDemandType = 0; T2PeopleType peopleType; - T2PeopleTimeZoneList *theTimeZoneList; while (iterator.Next(&theTimeZoneList)) { - peopleType.SetDemandType(demandType); + peopleType.SetDemandType(theDemandType); - T2PoolDefDemandElem *theDemandElem = inGradeDef->GetDemandElem(demandType); + T2PoolDefDemandElem *theDemandElem = inGradeDef->GetDemandElem(theDemandType); theTimeZoneList->Add(&peopleType, theDemandElem); - demandType++; + theDemandType++; } } void T2PeopleDemandList::Init(unsigned int inMonth, unsigned int inSomeNum) { - float rate = 0.0f; + float theRate = 0.0f; if (mSeasonParamDef) - rate = mSeasonParamDef->GetRate(inMonth - 1); + theRate = mSeasonParamDef->GetRate(inMonth - 1); LArrayIterator iterator(*this); T2PeopleTimeZoneList *theTimeZoneList; while (iterator.Next(&theTimeZoneList)) - theTimeZoneList->Init(inSomeNum, rate); + theTimeZoneList->Init(inSomeNum, theRate); } void T2PeopleDemandList::IncHour(unsigned int inMonth) { - float rate = 0.0f; + float theRate = 1.0f; if (mSeasonParamDef) - rate = mSeasonParamDef->GetRate(inMonth - 1); + theRate = mSeasonParamDef->GetRate(inMonth - 1); LArrayIterator iterator(*this); T2PeopleTimeZoneList *theTimeZoneList; while (iterator.Next(&theTimeZoneList)) - theTimeZoneList->IncHour(rate); + theTimeZoneList->IncHour(theRate); } T2PeopleTimeZoneList* T2PeopleDemandList::GetItem(int inDemandType) const { @@ -93,35 +93,35 @@ T2PeopleTimeZoneList* T2PeopleDemandList::GetItem(int inDemandType) const { } BOOL T2PeopleDemandList::Find(T2TenantMemberDef* inTenantMemberDef, int inEconoType, unsigned int inTransportType, BOOL inCheckOnlyFirstEconoType) const { - BOOL result = false; + BOOL found = false; T2PeopleTimeZoneList *theList = GetItem(inTenantMemberDef->GetDemandType()); if (theList) - result = theList->Find(inTenantMemberDef, inEconoType, inTransportType, inCheckOnlyFirstEconoType); + found = theList->Find(inTenantMemberDef, inEconoType, inTransportType, inCheckOnlyFirstEconoType); - return result; + return found; } BOOL T2PeopleDemandList::Call(T2TenantMemberDef* inTenantMemberDef, int inEconoType, unsigned int inTransportType, T2PeopleType& outPeopleType) const { - BOOL result = false; - int demandType = inTenantMemberDef->GetDemandType(); + BOOL found = false; + int theDemandType = inTenantMemberDef->GetDemandType(); - if (demandType != -1) { - T2PeopleTimeZoneList *theList = GetItem(demandType); + if (theDemandType != -1) { + T2PeopleTimeZoneList *theList = GetItem(theDemandType); if (theList) - result = theList->Call(inTenantMemberDef, inEconoType, inTransportType, outPeopleType); + found = theList->Call(inTenantMemberDef, inEconoType, inTransportType, outPeopleType); } else { - for (int i = UT2Utils::Randomize(mItemCount) + 1, j = 0; !result && j < mItemCount; j++, i++) { + for (int i = UT2Utils::Randomize(mItemCount) + 1, j = 0; !found && j < mItemCount; j++, i++) { if (i > mItemCount) i = 1; T2PeopleTimeZoneList *theList = GetItem(i); if (theList && !theList->IsFixed()) - result = theList->Call(inTenantMemberDef, inEconoType, inTransportType, outPeopleType); + found = theList->Call(inTenantMemberDef, inEconoType, inTransportType, outPeopleType); } } - return result; + return found; } void T2PeopleDemandList::DispatchRestore(T2PeopleType& peopleType) { diff --git a/src/T2DLL/T2PeopleDemandList.h b/src/T2DLL/T2PeopleDemandList.h index e330e85..c5cbb6c 100644 --- a/src/T2DLL/T2PeopleDemandList.h +++ b/src/T2DLL/T2PeopleDemandList.h @@ -2,7 +2,7 @@ #include "common.h" #include "LArray.h" -class AFX_EXT_CLASS T2PeopleDemandList : private LArray { +class AFX_CLASS_EXPORT T2PeopleDemandList : private LArray { public: T2PeopleDemandList(T2PoolDef* inPoolDef, T2SeasonParamDef* inSeasonParamDef, T2WorldDef* inWorldDef); T2PeopleDemandList(T2Archive& inArchive, T2SeasonParamDef* inSeasonParamDef, T2WorldDef* inWorldDef); diff --git a/src/T2DLL/T2PeopleInfoDialog.cpp b/src/T2DLL/T2PeopleInfoDialog.cpp index c57f233..26b98a4 100644 --- a/src/T2DLL/T2PeopleInfoDialog.cpp +++ b/src/T2DLL/T2PeopleInfoDialog.cpp @@ -27,6 +27,7 @@ T2PeopleInfoDialog::T2PeopleInfoDialog(T2People* people) } /*virtual*/ void T2PeopleInfoDialog::OnT2Create() { +#pragma var_order(item1040, item1012, item7090, favName, item1030, item1010, item1020, item1011, pplEvalGage, theName, str1, nonFavName, theWorldDef, stressGage, hasAnyName, str2, theTowerDoc, theSilhouettePane, theNameID) T2TowerDoc *theTowerDoc = mTowerDoc; T2WorldDef *theWorldDef = GetCurrentT2TowerDoc()->towerDoc_vf170(); @@ -66,6 +67,7 @@ T2PeopleInfoDialog::T2PeopleInfoDialog(T2People* people) // 1030 - where they're going from T2DlgItem *item1030 = (T2DlgItem *) GetDlgItem(1030); if (mPeople->GetWorkTenant() > 1) { +#pragma var_order(item1010, nameStr, workTenant, workTenantName, theNameID) T2Tenant *workTenant = theTowerDoc->mFloorInfo->GetTenant(mPeople->GetWorkTenant()); T2Name *workTenantName = theTowerDoc->mNameDB->Search(workTenant, false); @@ -136,6 +138,7 @@ T2PeopleInfoDialog::T2PeopleInfoDialog(T2People* people) str1 = "\x82\xC8\x82\xB5"; } +#pragma var_order(item1040, item1012, item7090, favName, item1030, item1010, item1020, item1011, pplEvalGage, theName, str1, nonFavName, theWorldDef, stressGage, hasAnyName, str2, theTowerDoc, theSilhouettePane, theNameID) // 1040 - where they're going to T2DlgItem *item1040 = (T2DlgItem *) GetDlgItem(1040); item1040->SetDescriptor(str1); @@ -143,7 +146,7 @@ T2PeopleInfoDialog::T2PeopleInfoDialog(T2People* people) T2DlgItemStressGage *stressGage = (T2DlgItemStressGage *) GetDlgItem(110); stressGage->SetPeople(mPeople); - T2DlgItemPPLEvalGage *pplEvalGage = (T2DlgItemPPLEvalGage *) GetDlgItem(126); + T2DlgItemPPLEvalGage *pplEvalGage = (T2DlgItemPPLEvalGage *) GetDlgItem(120); pplEvalGage->SetPeople(mPeople); BOOL hasAnyName = false; @@ -166,27 +169,27 @@ T2PeopleInfoDialog::T2PeopleInfoDialog(T2People* people) } CString T2PeopleInfoDialog::GetTenantName(T2TowerDoc* towerDoc, unsigned int inTenantID) { - CString result = ""; + CString resultName = ""; unsigned int tenantID = inTenantID; if (tenantID == 1) { // "ãƒãƒ“ー" - lobby - result = "\x83\x8D\x83\x72\x81\x5B"; + resultName = "\x83\x8D\x83\x72\x81\x5B"; } else { - CString str; + CString roomNum; T2Tenant *theTenant = towerDoc->mFloorInfo->GetTenant(tenantID); T2Name *theName = towerDoc->mNameDB->Search(theTenant, false); - UT2Utils::GetRoomNumberString(theTenant->GetFloorNumber(towerDoc->mFloorInfo), result); - UT2Utils::GetRoomNumberString(theTenant->GetRoomNumber(towerDoc->mFloorInfo), str); + UT2Utils::GetRoomNumberString(theTenant->GetFloorNumber(towerDoc->mFloorInfo), resultName); + UT2Utils::GetRoomNumberString(theTenant->GetRoomNumber(towerDoc->mFloorInfo), roomNum); - // "階" + str + "å·å®¤" - floor + ... + room number - result = result + "\x8A\x4B" + str + "\x8D\x86\x8E\xBA "; + // "階" + roomNum + "å·å®¤" - floor + ... + room number + resultName = resultName + "\x8A\x4B" + roomNum + "\x8D\x86\x8E\xBA "; CString nameStr; - unsigned int theNameID; + unsigned int id; if (theName) - theName->GetName(nameStr, theNameID); + theName->GetName(nameStr, id); if (nameStr == "") { T2ToolDef *toolDef = (T2ToolDef *) theTenant->GetEquipDef(); @@ -194,37 +197,37 @@ CString T2PeopleInfoDialog::GetTenantName(T2TowerDoc* towerDoc, unsigned int inT toolDef->GetName(nameStr, 0); } - result += nameStr; + resultName += nameStr; } - return result; + return resultName; } /*virtual*/ void T2PeopleInfoDialog::CreateDlgItem(CTokenizer& tokenizer, T2DialogDef& def) { if (!_stricmp(tokenizer.Current(), "SILH")) { - RECT rect; - int id = tokenizer.NextInteger(); - rect.left = tokenizer.NextInteger(); - rect.top = tokenizer.NextInteger(); - rect.right = tokenizer.NextInteger(); - rect.bottom = tokenizer.NextInteger(); - - T2SilhouettePane *silhouettePane = new T2SilhouettePane(mTowerDoc, mImageObj, mPalette); - silhouettePane->Create("", def.flags, rect, this, id); + RECT theItemRect; + int theID = tokenizer.NextInteger(); + theItemRect.left = tokenizer.NextInteger(); + theItemRect.top = tokenizer.NextInteger(); + theItemRect.right = tokenizer.NextInteger(); + theItemRect.bottom = tokenizer.NextInteger(); + + T2SilhouettePane *item = new T2SilhouettePane(mTowerDoc, mImageObj, mPalette); + item->Create("", def.flags, theItemRect, this, theID); if (mCurrentFont >= 0) - silhouettePane->SetFont(*mFonts[mCurrentFont]); + item->SetFont(*mFonts[mCurrentFont]); } else if (!_stricmp(tokenizer.Current(), "PPLEV")) { - RECT rect; - int id = tokenizer.NextInteger(); - rect.left = tokenizer.NextInteger(); - rect.top = tokenizer.NextInteger(); - rect.right = tokenizer.NextInteger(); - rect.bottom = tokenizer.NextInteger(); - - T2DlgItemPPLEvalGage *pplEvalGage = new T2DlgItemPPLEvalGage(mTowerDoc, mImageObj, mPalette); - pplEvalGage->Create("", def.flags, rect, this, id); + RECT theItemRect; + int theID = tokenizer.NextInteger(); + theItemRect.left = tokenizer.NextInteger(); + theItemRect.top = tokenizer.NextInteger(); + theItemRect.right = tokenizer.NextInteger(); + theItemRect.bottom = tokenizer.NextInteger(); + + T2DlgItemPPLEvalGage *item = new T2DlgItemPPLEvalGage(mTowerDoc, mImageObj, mPalette); + item->Create("", def.flags, theItemRect, this, theID); if (mCurrentFont >= 0) - pplEvalGage->SetFont(*mFonts[mCurrentFont]); + item->SetFont(*mFonts[mCurrentFont]); } else { T2Dialog::CreateDlgItem(tokenizer, def); } @@ -233,23 +236,23 @@ CString T2PeopleInfoDialog::GetTenantName(T2TowerDoc* towerDoc, unsigned int inT /*virtual*/ void T2PeopleInfoDialog::OnT2Destroy() { } -/*virtual*/ BOOL T2PeopleInfoDialog::OnT2DialogCommand(UINT cmd, long data) { - WORD hi = HIWORD(cmd); - WORD lo = LOWORD(cmd); +/*virtual*/ BOOL T2PeopleInfoDialog::OnT2DialogCommand(WPARAM inWParam, LPARAM inLParam) { + WORD code = HIWORD(inWParam); + WORD id = LOWORD(inWParam); - if (lo == 1 && hi == 0) { + if (id == IDOK && code == 0) { // nothing - } else if (lo == 2 && hi == 0) { + } else if (id == IDCANCEL && code == 0) { // wtf is going on here? compiler uses a different register DestroyWindow(); - } else if (lo == 7090 && hi == 0) { + } else if (id == 7090 && code == 0) { m104 = true; GetT2DlgItem(7090)->EnableWindow(false); T2DlgItem *item = (T2DlgItem *) GetDlgItem(1010); - CString str; - item->GetDescriptor(str); - if (str == "") + CString text; + item->GetDescriptor(text); + if (text == "") item->SetDescriptor(m108); } @@ -268,9 +271,9 @@ CString T2PeopleInfoDialog::GetTenantName(T2TowerDoc* towerDoc, unsigned int inT nameStr = m108; if (m108 != nameStr || m104 == 1) { - T2Name *nonFavName = mTowerDoc->mNameDB->Search(mPeople, false); - if (nonFavName) { - nonFavName->SetName(nameStr); + T2Name *name = mTowerDoc->mNameDB->Search(mPeople, false); + if (name) { + name->SetName(nameStr); } else { T2Name *newName = new T2Name(nameStr, mPeople, false); mTowerDoc->mNameDB->Add(newName); diff --git a/src/T2DLL/T2PeopleInfoDialog.h b/src/T2DLL/T2PeopleInfoDialog.h index 6413029..4f22886 100644 --- a/src/T2DLL/T2PeopleInfoDialog.h +++ b/src/T2DLL/T2PeopleInfoDialog.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2InfoDialog.h" -class AFX_EXT_CLASS T2PeopleInfoDialog : public T2InfoDialog { +class AFX_CLASS_EXPORT T2PeopleInfoDialog : public T2InfoDialog { public: T2PeopleInfoDialog(T2People*); virtual ~T2PeopleInfoDialog(); @@ -11,7 +11,7 @@ protected: virtual void OnT2Create(); virtual void CreateDlgItem(CTokenizer&, T2DialogDef&); virtual void OnT2Destroy(); - virtual BOOL OnT2DialogCommand(UINT cmd, long data); + virtual BOOL OnT2DialogCommand(WPARAM inWParam, LPARAM inLParam); virtual BOOL OnT2EraseBkgnd(CDC*); virtual void OnT2OK(); diff --git a/src/T2DLL/T2PeopleLinkIterator.h b/src/T2DLL/T2PeopleLinkIterator.h index 5838b46..716e269 100644 --- a/src/T2DLL/T2PeopleLinkIterator.h +++ b/src/T2DLL/T2PeopleLinkIterator.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS T2PeopleLinkIterator { +class AFX_CLASS_EXPORT T2PeopleLinkIterator { public: T2PeopleLinkIterator(T2People*); virtual ~T2PeopleLinkIterator(); diff --git a/src/T2DLL/T2PeopleLoader.cpp b/src/T2DLL/T2PeopleLoader.cpp index f2e76a3..e19a554 100644 --- a/src/T2DLL/T2PeopleLoader.cpp +++ b/src/T2DLL/T2PeopleLoader.cpp @@ -5,37 +5,43 @@ #include "T2TemplatePluginDB.h" #include "T2TemplatePluginList.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + /*static*/ void T2PeopleLoader::Load(T2PluginSpecifier* specifier, T2TemplatePluginDB* db) { LoadSilhouette(specifier, db); LoadPeople(specifier, db); } /*static*/ void T2PeopleLoader::Unload(T2TemplatePluginDB* db) { - LArrayIterator silhouetteIterator(*db->GetTemplatePluginList('SlDf')); + LArrayIterator silhouetteIter(*db->GetTemplatePluginList('SlDf')); T2SilhouetteDef *silhouetteDef; - while (silhouetteIterator.Next(&silhouetteDef)) + while (silhouetteIter.Next(&silhouetteDef)) delete silhouetteDef; - LArrayIterator peopleIterator(*db->GetTemplatePluginList('PPDf')); + LArrayIterator peopleIter(*db->GetTemplatePluginList('PPDf')); T2PeopleDef *peopleDef; - while (peopleIterator.Next(&peopleDef)) + while (peopleIter.Next(&peopleDef)) delete peopleDef; } /*static*/ BOOL T2PeopleLoader::LoadSilhouette(T2PluginSpecifier* specifier, T2TemplatePluginDB* db) { CResFile resFile; if (resFile.OpenResource(specifier->mInstance, 1, 'SlDf')) { - T2TemplatePluginList *silhouetteList = db->GetTemplatePluginList('SlDf'); + T2TemplatePluginList *silhouetteDefList = db->GetTemplatePluginList('SlDf'); - int count; - resFile >> count; + int numOfDefs; + resFile >> numOfDefs; - for (int i = 0; i < count; i++) { + for (int index = 0; index < numOfDefs; index++) { #line 47 - T2SilhouetteDef *silhouetteDef = DEBUG_NEW T2SilhouetteDef('SlDf', *specifier, &resFile); + T2SilhouetteDef *silhouetteDef = new T2SilhouetteDef('SlDf', *specifier, &resFile); - if (!silhouetteList->FindSilhouette(silhouetteDef->GetSilhouetteType())) - silhouetteList->Add(silhouetteDef); + if (!silhouetteDefList->FindSilhouette(silhouetteDef->GetSilhouetteType())) + silhouetteDefList->Add(silhouetteDef); else delete silhouetteDef; } @@ -48,19 +54,19 @@ /*static*/ BOOL T2PeopleLoader::LoadPeople(T2PluginSpecifier* specifier, T2TemplatePluginDB* db) { CResFile resFile; if (resFile.OpenResource(specifier->mInstance, 1, 'PPDf')) { - T2TemplatePluginList *peopleList = db->GetTemplatePluginList('PPDf'); - T2TemplatePluginList *silhouetteList = db->GetTemplatePluginList('SlDf'); + T2TemplatePluginList *peopleDefList = db->GetTemplatePluginList('PPDf'); + T2TemplatePluginList *silhouetteDefList = db->GetTemplatePluginList('SlDf'); - int count; - resFile >> count; + int numOfDefs; + resFile >> numOfDefs; - for (int i = 0; i < count; i++) { + for (int index = 0; index < numOfDefs; index++) { #line 70 - T2PeopleDef *peopleDef = DEBUG_NEW T2PeopleDef('PPDf', *specifier, &resFile); + T2PeopleDef *peopleDef = new T2PeopleDef('PPDf', *specifier, &resFile); - if (!peopleList->FindPeopleDef(peopleDef->GetPeopleType())) { - peopleDef->AssignSilhouette(silhouetteList); - peopleList->Add(peopleDef); + if (!peopleDefList->FindPeopleDef(peopleDef->GetPeopleType())) { + peopleDef->AssignSilhouette(silhouetteDefList); + peopleDefList->Add(peopleDef); } else { delete peopleDef; } diff --git a/src/T2DLL/T2PeopleLoader.h b/src/T2DLL/T2PeopleLoader.h index 6c97936..8bf497a 100644 --- a/src/T2DLL/T2PeopleLoader.h +++ b/src/T2DLL/T2PeopleLoader.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS T2PeopleLoader { +class AFX_CLASS_EXPORT T2PeopleLoader { public: static void Load(T2PluginSpecifier*, T2TemplatePluginDB*); static void Unload(T2TemplatePluginDB*); diff --git a/src/T2DLL/T2PeoplePtrList.h b/src/T2DLL/T2PeoplePtrList.h index 6a3b198..788b996 100644 --- a/src/T2DLL/T2PeoplePtrList.h +++ b/src/T2DLL/T2PeoplePtrList.h @@ -2,7 +2,7 @@ #include "common.h" #include "LArray.h" -class AFX_EXT_CLASS T2PeoplePtrList : public LArray { +class AFX_CLASS_EXPORT T2PeoplePtrList : public LArray { public: T2PeoplePtrList(int count = 0); virtual ~T2PeoplePtrList(); diff --git a/src/T2DLL/T2PeopleTimeZoneList.cpp b/src/T2DLL/T2PeopleTimeZoneList.cpp index b9601aa..1b3578a 100644 --- a/src/T2DLL/T2PeopleTimeZoneList.cpp +++ b/src/T2DLL/T2PeopleTimeZoneList.cpp @@ -27,6 +27,7 @@ T2PeopleTimeZoneList::T2PeopleTimeZoneList(unsigned int someNum, unsigned int is T2PeopleTimeZoneList::T2PeopleTimeZoneList(T2Archive& archive, T2WorldDef* worldDef) : LArray(sizeof(T2PeopleTypeArray *)) { +#pragma var_order(uc, c, i, count) _20 = 0; mWorldDef = worldDef; @@ -47,17 +48,17 @@ T2PeopleTimeZoneList::T2PeopleTimeZoneList(T2Archive& archive, T2WorldDef* world mCurrentHour = c; for (int i = 0; i < count; i++) { - T2PeopleTypeArray *theArray = new T2PeopleTypeArray(archive); - Add(theArray); + T2PeopleTypeArray *array = new T2PeopleTypeArray(archive); + Add(array); } } /*virtual*/ T2PeopleTimeZoneList::~T2PeopleTimeZoneList() { + T2PeopleTypeArray *array; LArrayIterator iterator(*this); - T2PeopleTypeArray *theArray; - while (iterator.Next(&theArray)) - delete theArray; + while (iterator.Next(&array)) + delete array; } void T2PeopleTimeZoneList::Add(T2PeopleTypeArray* inArray) { @@ -65,18 +66,18 @@ void T2PeopleTimeZoneList::Add(T2PeopleTypeArray* inArray) { } void T2PeopleTimeZoneList::Add(T2PeopleType* inPeopleType, T2PoolDefDemandElem* inDemandElem) { + T2PeopleTypeArray *array; LArrayIterator iterator(*this); - T2PeopleTypeArray *theArray; unsigned int timeZoneType = 0; - while (iterator.Next(&theArray)) { + while (iterator.Next(&array)) { inPeopleType->SetTimeZoneType(timeZoneType); TimeZoneInfo *theTimeZoneInfo = inDemandElem->GetTimeZoneInfo(timeZoneType); CResFile resFile; if (resFile.OpenResource(mWorldDef->mModuleHandle, theTimeZoneInfo->m0, 'PzDf')) { T2PoolTimeZoneDef *theTimeZoneDef = new T2PoolTimeZoneDef(resFile); - theArray->Add(inPeopleType, theTimeZoneDef, theTimeZoneInfo->m4); + array->Add(inPeopleType, theTimeZoneDef, theTimeZoneInfo->m4); delete theTimeZoneDef; } else { CString str; @@ -92,11 +93,11 @@ void T2PeopleTimeZoneList::Init(unsigned int someNum, float limit) { mCurrentItem = someNum / mHoursPerItem; mCurrentHour = someNum % mHoursPerItem; + T2PeopleTypeArray *array; LArrayIterator iterator(*this); - T2PeopleTypeArray *theArray; - while (iterator.Next(&theArray)) - theArray->InitSearchLimit(limit); + while (iterator.Next(&array)) + array->InitSearchLimit(limit); } void T2PeopleTimeZoneList::IncHour(float limit) { @@ -108,7 +109,7 @@ void T2PeopleTimeZoneList::IncHour(float limit) { mCurrentHour = 0; mCurrentItem++; - if (mCurrentItem > GetCount()) + if (mCurrentItem >= GetCount()) mCurrentItem = 0; T2PeopleTypeArray *theNewArray = CurrentItem(); @@ -118,11 +119,11 @@ void T2PeopleTimeZoneList::IncHour(float limit) { } T2PeopleTypeArray* T2PeopleTimeZoneList::GetItem(int inIndex) const { - T2PeopleTypeArray *theArray; + T2PeopleTypeArray *array; int index = inIndex + 1; - if (!FetchItemAt(index, &theArray)) - theArray = NULL; - return theArray; + if (!FetchItemAt(index, &array)) + array = NULL; + return array; } T2PeopleTypeArray* T2PeopleTimeZoneList::CurrentItem() const { @@ -130,28 +131,29 @@ T2PeopleTypeArray* T2PeopleTimeZoneList::CurrentItem() const { } BOOL T2PeopleTimeZoneList::Find(T2TenantMemberDef* inTenantMemberDef, int inEconoType, unsigned int inTransportType, BOOL inCheckOnlyFirstEconoType) const { - T2PeopleTypeArray *theArray = CurrentItem(); - return theArray->Find(inTenantMemberDef, inEconoType, inTransportType, inCheckOnlyFirstEconoType); + T2PeopleTypeArray *array = CurrentItem(); + return array->Find(inTenantMemberDef, inEconoType, inTransportType, inCheckOnlyFirstEconoType); } BOOL T2PeopleTimeZoneList::Call(T2TenantMemberDef* inTenantMemberDef, int inEconoType, unsigned int inTransportType, T2PeopleType& outPeopleType) { - T2PeopleTypeArray *theArray = CurrentItem(); - return theArray->Call(inTenantMemberDef, inEconoType, inTransportType, outPeopleType); + T2PeopleTypeArray *array = CurrentItem(); + return array->Call(inTenantMemberDef, inEconoType, inTransportType, outPeopleType); } void T2PeopleTimeZoneList::DispatchRestore(T2PeopleType& inPeopleType) { - T2PeopleTypeArray *theArray = GetItem(inPeopleType.GetTimeZoneType()); - if (theArray) - theArray->Restore(inPeopleType); + T2PeopleTypeArray *array = GetItem(inPeopleType.GetTimeZoneType()); + if (array) + array->Restore(inPeopleType); } void T2PeopleTimeZoneList::DispatchAdd(T2PeopleType* inPeopleType) { - T2PeopleTypeArray *theArray = GetItem(inPeopleType->GetTimeZoneType()); - if (theArray) - theArray->Add(inPeopleType, 1); + T2PeopleTypeArray *array = GetItem(inPeopleType->GetTimeZoneType()); + if (array) + array->Add(inPeopleType, 1); } void T2PeopleTimeZoneList::Write(T2Archive& archive) { +#pragma var_order(uc, c, i) archive << mItemCount; unsigned char uc; @@ -168,8 +170,8 @@ void T2PeopleTimeZoneList::Write(T2Archive& archive) { archive << c; for (int i = 0; i < mItemCount; i++) { - T2PeopleTypeArray *theArray = GetItem(i); - if (theArray) - theArray->Write(archive); + T2PeopleTypeArray *array = GetItem(i); + if (array) + array->Write(archive); } } diff --git a/src/T2DLL/T2PeopleTimeZoneList.h b/src/T2DLL/T2PeopleTimeZoneList.h index 59a81b7..1b00721 100644 --- a/src/T2DLL/T2PeopleTimeZoneList.h +++ b/src/T2DLL/T2PeopleTimeZoneList.h @@ -2,7 +2,7 @@ #include "common.h" #include "LArray.h" -class AFX_EXT_CLASS T2PeopleTimeZoneList : public LArray { +class AFX_CLASS_EXPORT T2PeopleTimeZoneList : public LArray { public: T2PeopleTimeZoneList(unsigned int someNum, unsigned int isFixed, T2WorldDef* worldDef); T2PeopleTimeZoneList(T2Archive&, T2WorldDef*); @@ -16,14 +16,14 @@ public: void DispatchAdd(T2PeopleType*); void Write(T2Archive&); - BOOL IsFixed() const { return mIsFixed;} + BOOL IsFixed() const; protected: void Add(T2PeopleTypeArray* inArray); T2PeopleTypeArray* GetItem(int index) const; T2PeopleTypeArray* CurrentItem() const; - int GetNumOfTimeZone() const { return GetCount(); } + int GetNumOfTimeZone() const; int _20; BOOL mIsFixed; @@ -32,3 +32,11 @@ protected: int mCurrentHour; T2WorldDef *mWorldDef; }; + +inline BOOL T2PeopleTimeZoneList::IsFixed() const { + return mIsFixed; +} + +inline int T2PeopleTimeZoneList::GetNumOfTimeZone() const { + return GetCount(); +} diff --git a/src/T2DLL/T2PeopleType.h b/src/T2DLL/T2PeopleType.h index 063e682..048df87 100644 --- a/src/T2DLL/T2PeopleType.h +++ b/src/T2DLL/T2PeopleType.h @@ -11,10 +11,18 @@ enum { }; enum { + kTransportFlagLobbyLeft = 1 << kTransportLobbyLeft, + kTransportFlagLobbyRight = 1 << kTransportLobbyRight, + kTransportFlagParking = 1 << kTransportParking, + kTransportFlagSubway = 1 << kTransportSubway, + kTransportFlagShip = 1 << kTransportShip +}; + +enum { kEconoType7 = 7, }; -class AFX_EXT_CLASS T2PeopleType { +class AFX_CLASS_EXPORT T2PeopleType { public: T2PeopleType(); ~T2PeopleType(); @@ -29,29 +37,18 @@ public: void Read(T2Archive&); void Write(T2Archive&); - void SetSilhouetteType(int v) { mSilhouetteType = v; } - void SetEconoType(int v) { mEconoType = v; } - void SetTransportType(int v) { mTransportType = v; } - void SetLifeCount(int v) { mLife = v; } - int GetSilhouetteType() const { return mSilhouetteType; } - int GetTransportType() const { return mTransportType; } - int GetAge() const { - return mSilhouetteType >> 3; - } - BOOL IsMale() const { - return (mSilhouetteType % 2) == 0; - } - BOOL IsImmortal() const { - return (mLife == 127); - } - BOOL HasLife() const { - return (mLife > 0); - } - void DecreaseLife() { - if (!IsImmortal()) - mLife--; - } - int GetEconoType() const { return mEconoType; } + void SetSilhouetteType(int v); + void SetEconoType(int v); + void SetTransportType(int v); + void SetLifeCount(int v); + int GetSilhouetteType() const; + int GetTransportType() const; + int GetAge() const; + BOOL IsMale() const; + BOOL IsImmortal() const; + BOOL HasLife() const; + void DecreaseLife(); + int GetEconoType() const; protected: BOOL CheckDemandType(int) const; @@ -64,3 +61,52 @@ protected: int mLife; int mTransportType; }; + +inline void T2PeopleType::SetSilhouetteType(int v) { + mSilhouetteType = v; +} + +inline void T2PeopleType::SetEconoType(int v) { + mEconoType = v; +} + +inline void T2PeopleType::SetTransportType(int v) { + mTransportType = v; +} + +inline void T2PeopleType::SetLifeCount(int v) { + mLife = v; +} + +inline int T2PeopleType::GetSilhouetteType() const { + return mSilhouetteType; +} + +inline int T2PeopleType::GetTransportType() const { + return mTransportType; +} + +inline int T2PeopleType::GetAge() const { + return mSilhouetteType >> 3; +} + +inline BOOL T2PeopleType::IsMale() const { + return (mSilhouetteType % 2) == 0; +} + +inline BOOL T2PeopleType::IsImmortal() const { + return (mLife == 127); +} + +inline BOOL T2PeopleType::HasLife() const { + return (mLife > 0); +} + +inline void T2PeopleType::DecreaseLife() { + if (!IsImmortal()) + mLife--; +} + +inline int T2PeopleType::GetEconoType() const { + return mEconoType; +} diff --git a/src/T2DLL/T2PeopleTypeArray.cpp b/src/T2DLL/T2PeopleTypeArray.cpp index 5d6ddd5..4be584f 100644 --- a/src/T2DLL/T2PeopleTypeArray.cpp +++ b/src/T2DLL/T2PeopleTypeArray.cpp @@ -70,23 +70,24 @@ void T2PeopleTypeArray::InitSearchLimit(float limit) { BOOL T2PeopleTypeArray::Find(T2TenantMemberDef* tenantMemberDef, int inEconoType, unsigned int inTransportType, BOOL inCheckOnlyFirstEconoType) const { BOOL result = false; - T2PeopleType peopleType; + T2PeopleType thePeopleType; - int numOfPeople = tenantMemberDef->GetNumOfPeople(); - int xxx = 0; - int econoType = inEconoType; + int n; + int numPeople = tenantMemberDef->GetNumOfPeople(); + int numCheck = 0; + int theEconoType = inEconoType; - if (numOfPeople > 1 && m24 != 0) - numOfPeople = 1; + if (numPeople > 1 && m24 != 0) + numPeople = 1; - for (int i = m28; !result && i <= m2C; i++) { - if (FetchItemAt(i, &peopleType)) { - if (peopleType.Check(tenantMemberDef, econoType, inTransportType)) { - xxx++; - if (xxx >= numOfPeople) { + for (n = m28; !result && n <= m2C; n++) { + if (FetchItemAt(n, &thePeopleType)) { + if (thePeopleType.Check(tenantMemberDef, theEconoType, inTransportType)) { + numCheck++; + if (numCheck >= numPeople) { result = true; - } else if (xxx == 1 && inCheckOnlyFirstEconoType) { - econoType = -1; + } else if (numCheck == 1 && inCheckOnlyFirstEconoType) { + theEconoType = -1; } } } @@ -97,15 +98,15 @@ BOOL T2PeopleTypeArray::Find(T2TenantMemberDef* tenantMemberDef, int inEconoType BOOL T2PeopleTypeArray::Call(T2TenantMemberDef* tenantMemberDef, int inEconoType, unsigned int inTransportType, T2PeopleType& outPeopleType) { BOOL result = false; - T2PeopleType peopleType; + T2PeopleType thePeopleType; - for (int i = m28; !result && i <= m2C; i++) { - if (FetchItemAt(i, &peopleType)) { - if (peopleType.Check(tenantMemberDef, inEconoType, inTransportType)) { + for (int n = m28; !result && n <= m2C; n++) { + if (FetchItemAt(n, &thePeopleType)) { + if (thePeopleType.Check(tenantMemberDef, inEconoType, inTransportType)) { result = true; - outPeopleType = peopleType; + outPeopleType = thePeopleType; if (!m24) { - RemoveItemsAt(1, i); + RemoveItemsAt(1, n); m2C--; } } @@ -125,10 +126,10 @@ void T2PeopleTypeArray::Restore(T2PeopleType& peopleType) { void T2PeopleTypeArray::Read(T2Archive& archive) { RemoveItemsAt(GetCount(), 1); - int count; - archive >> count; + int numPeople; + archive >> numPeople; - for (int i = 0; i < count; i++) { + for (int i = 0; i < numPeople; i++) { T2PeopleType peopleType; peopleType.Read(archive); Add(&peopleType, 1); diff --git a/src/T2DLL/T2PeopleTypeArray.h b/src/T2DLL/T2PeopleTypeArray.h index f9156cd..2fa8cad 100644 --- a/src/T2DLL/T2PeopleTypeArray.h +++ b/src/T2DLL/T2PeopleTypeArray.h @@ -2,7 +2,7 @@ #include "common.h" #include "LArray.h" -class AFX_EXT_CLASS T2PeopleTypeArray : protected LArray { +class AFX_CLASS_EXPORT T2PeopleTypeArray : protected LArray { public: T2PeopleTypeArray(unsigned int); T2PeopleTypeArray(T2Archive&); diff --git a/src/T2DLL/T2PlaceParamDef.h b/src/T2DLL/T2PlaceParamDef.h index a259740..328b35f 100644 --- a/src/T2DLL/T2PlaceParamDef.h +++ b/src/T2DLL/T2PlaceParamDef.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS T2PlaceParamDef { +class AFX_CLASS_EXPORT T2PlaceParamDef { public: enum EPlace { Place_0, // pool @@ -13,9 +13,10 @@ public: T2PlaceParamDef(CResFile& resFile); virtual ~T2PlaceParamDef(); - unsigned int GetPercent(EPlace place) const { return mEntries[place].mPercent; } - float GetRate(EPlace place) const { return mEntries[place].mRate; } - short GetScore(EPlace place) const { return mEntries[place].mScore; } +public: + unsigned int GetPercent(EPlace place) const; + float GetRate(EPlace place) const; + short GetScore(EPlace place) const; protected: struct { @@ -24,3 +25,15 @@ protected: float mRate; } mEntries[kMaxPlace]; }; + +inline unsigned int T2PlaceParamDef::GetPercent(EPlace place) const { + return mEntries[place].mPercent; +} + +inline float T2PlaceParamDef::GetRate(EPlace place) const { + return mEntries[place].mRate; +} + +inline short T2PlaceParamDef::GetScore(EPlace place) const { + return mEntries[place].mScore; +} diff --git a/src/T2DLL/T2PluginInfoTable.h b/src/T2DLL/T2PluginInfoTable.h index dde9bbf..0a6615f 100644 --- a/src/T2DLL/T2PluginInfoTable.h +++ b/src/T2DLL/T2PluginInfoTable.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2DlgItemImageTable.h" -class AFX_EXT_CLASS T2PluginInfoTable : public T2DlgItemImageTable { +class AFX_CLASS_EXPORT T2PluginInfoTable : public T2DlgItemImageTable { public: T2PluginInfoTable(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); virtual ~T2PluginInfoTable(); diff --git a/src/T2DLL/T2PluginLoader.cpp b/src/T2DLL/T2PluginLoader.cpp index 57867ed..9018012 100644 --- a/src/T2DLL/T2PluginLoader.cpp +++ b/src/T2DLL/T2PluginLoader.cpp @@ -1,5 +1,6 @@ #include "CT2App.h" #include "GlobalFunc.h" +#include "T2DLL.h" #include "T2PluginLoader.h" #include "T2PluginSpecifier.h" @@ -22,17 +23,17 @@ void T2PluginLoader::InitFileList() { strcat(dirBuf, "Plugins\\"); char *dirBufEnd = &dirBuf[strlen(dirBuf)]; - CString dbPath = GetTowerDirectory() + "plugins\\Database"; - BOOL errorFlag = false; + CString databasePath = GetTowerDirectory() + "plugins\\Database"; + BOOL fail = false; CFile file; - if (file.Open(dbPath, CFile::modeRead)) { + if (file.Open(databasePath, CFile::modeRead)) { CArchive archive(&file, CArchive::load); - DWORD count = mList.GetCount(); - archive >> count; + DWORD countDatabase = mList.GetCount(); + archive >> countDatabase; - for (unsigned int i = 0; i < count; i++) { + for (unsigned int index = 0; index < countDatabase; index++) { T2PluginSpecifier *spec = new T2PluginSpecifier; spec->Read(archive); mList.AddTail(spec); @@ -43,39 +44,39 @@ void T2PluginLoader::InitFileList() { // check that the database is up-to-date CFileStatus status; - int count2 = 0; + int numSpec = 0; - POSITION p = mList.GetHeadPosition(); - while (p) { - T2PluginSpecifier *spec = (T2PluginSpecifier *) mList.GetNext(p); + POSITION pos = mList.GetHeadPosition(); + while (pos) { + T2PluginSpecifier *spec = (T2PluginSpecifier *) mList.GetNext(pos); if (CFile::GetStatus(spec->mPath, status)) { if (status.m_mtime == spec->mTime) - count2++; + numSpec++; } } - if (count2 != mList.GetCount()) - errorFlag = true; + if (numSpec != mList.GetCount()) + fail = true; - count2 = 0; + numSpec = 0; strcpy(dirBufEnd, "*.t2p"); - WIN32_FIND_DATA findData; - HANDLE findHandle = FindFirstFile(dirBuf, &findData); - BOOL findOK = (findHandle != INVALID_HANDLE_VALUE); - while (findOK) { - findOK = FindNextFile(findHandle, &findData); - count2++; + WIN32_FIND_DATA findInfo; + HANDLE handle = FindFirstFile(dirBuf, &findInfo); + BOOL find = (handle != INVALID_HANDLE_VALUE); + while (find) { + find = FindNextFile(handle, &findInfo); + numSpec++; } - FindClose(findHandle); + FindClose(handle); - if (count2 != mList.GetCount()) - errorFlag = true; + if (numSpec != mList.GetCount()) + fail = true; } else { - errorFlag = true; + fail = true; } - if (errorFlag) { + if (fail) { // update the DB AfxSetResourceHandle(gT2App->m_hInstance); @@ -83,19 +84,19 @@ void T2PluginLoader::InitFileList() { dialog->Create(1000); gT2App->app_vfB4(); - POSITION p = mList.GetHeadPosition(); - while (p) { - T2PluginSpecifier *spec = (T2PluginSpecifier *) mList.GetNext(p); + POSITION pos = mList.GetHeadPosition(); + while (pos) { + T2PluginSpecifier *spec = (T2PluginSpecifier *) mList.GetNext(pos); delete spec; } mList.RemoveAll(); strcpy(dirBufEnd, "*.t2p"); - WIN32_FIND_DATA findData; - HANDLE findHandle = FindFirstFile(dirBuf, &findData); - BOOL findOK = (findHandle != INVALID_HANDLE_VALUE); - while (findOK) { - strcpy(dirBufEnd, findData.cFileName); + WIN32_FIND_DATA findInfo; + HANDLE handle = FindFirstFile(dirBuf, &findInfo); + BOOL find = (handle != INVALID_HANDLE_VALUE); + while (find) { + strcpy(dirBufEnd, findInfo.cFileName); T2PluginSpecifier *spec = new T2PluginSpecifier; spec->Initialize(NULL, dirBuf); @@ -103,19 +104,19 @@ void T2PluginLoader::InitFileList() { spec->mIsLoaded = false; mList.AddTail(spec); - findOK = FindNextFile(findHandle, &findData); + find = FindNextFile(handle, &findInfo); } - FindClose(findHandle); + FindClose(handle); - if (file.Open(dbPath, CFile::modeWrite | CFile::modeCreate)) { + if (file.Open(databasePath, CFile::modeWrite | CFile::modeCreate)) { CArchive archive(&file, CArchive::store); DWORD count = mList.GetCount(); archive << count; - p = mList.GetHeadPosition(); - while (p) { - T2PluginSpecifier *spec = (T2PluginSpecifier *) mList.GetNext(p); + pos = mList.GetHeadPosition(); + while (pos) { + T2PluginSpecifier *spec = (T2PluginSpecifier *) mList.GetNext(pos); spec->Write(archive); } diff --git a/src/T2DLL/T2PluginLoader.h b/src/T2DLL/T2PluginLoader.h index aa2d5a2..8653f8c 100644 --- a/src/T2DLL/T2PluginLoader.h +++ b/src/T2DLL/T2PluginLoader.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS T2PluginLoader { +class AFX_CLASS_EXPORT T2PluginLoader { public: T2PluginLoader(); ~T2PluginLoader(); diff --git a/src/T2DLL/T2PluginSpecifier.cpp b/src/T2DLL/T2PluginSpecifier.cpp index 5e8c16b..69a4fed 100644 --- a/src/T2DLL/T2PluginSpecifier.cpp +++ b/src/T2DLL/T2PluginSpecifier.cpp @@ -35,24 +35,24 @@ void T2PluginSpecifier::Initialize(HINSTANCE inst, const char* path) { if (inst) { if (!resFile.OpenResource(inst, 128, "ATTR")) { #line 45 - __Rep1(__FILE__, __LINE__, "�v���O�C�������Ă��邩�A�ȑO��The Tower�U���Ù�I���������߂ÉA�v���O�C�����g���Ȃ��Ȃ��Ă��܂��B\nWindows���ċN�����Ă݂Ă��������B\n�v���O�C�� �F %s", (DWORD) path); + __Rep1(__FILE__, __LINE__, "\x83\x76\x83\x89\x83\x4F\x83\x43\x83\x93\x82\xAA\x89\xF3\x82\xEA\x82\xC4\x82\xA2\x82\xE9\x82\xA9\x81\x41\x88\xC8\x91\x4F\x82\xC9\x54\x68\x65\x20\x54\x6F\x77\x65\x72\x87\x55\x82\xAA\x88\xD9\x8F\xED\x8F\x49\x97\xB9\x82\xB5\x82\xBD\x82\xBD\x82\xDF\x82\xC9\x81\x41\x83\x76\x83\x89\x83\x4F\x83\x43\x83\x93\x82\xAA\x8E\x67\x82\xA6\x82\xC8\x82\xAD\x82\xC8\x82\xC1\x82\xC4\x82\xA2\x82\xDC\x82\xB7\x81\x42\n\x57\x69\x6E\x64\x6F\x77\x73\x82\xF0\x8D\xC4\x8B\x4E\x93\xAE\x82\xB5\x82\xC4\x82\xDD\x82\xC4\x82\xAD\x82\xBE\x82\xB3\x82\xA2\x81\x42\n\x83\x76\x83\x89\x83\x4F\x83\x43\x83\x93\x96\xBC\x20\x81\x46\x20\x25\x73", (DWORD) path); } } else { if (!resFile.OpenResource(path, 128, 'ATTR')) { #line 50 - __Rep1(__FILE__, __LINE__, "�v���O�C�������Ă��邩�A�ȑO��The Tower�U���Ù�I���������߂ÉA�v���O�C�����g���Ȃ��Ȃ��Ă��܂��B\nWindows���ċN�����Ă݂Ă��������B\n�v���O�C�� �F %s", (DWORD) path); + __Rep1(__FILE__, __LINE__, "\x83\x76\x83\x89\x83\x4F\x83\x43\x83\x93\x82\xAA\x89\xF3\x82\xEA\x82\xC4\x82\xA2\x82\xE9\x82\xA9\x81\x41\x88\xC8\x91\x4F\x82\xC9\x54\x68\x65\x20\x54\x6F\x77\x65\x72\x87\x55\x82\xAA\x88\xD9\x8F\xED\x8F\x49\x97\xB9\x82\xB5\x82\xBD\x82\xBD\x82\xDF\x82\xC9\x81\x41\x83\x76\x83\x89\x83\x4F\x83\x43\x83\x93\x82\xAA\x8E\x67\x82\xA6\x82\xC8\x82\xAD\x82\xC8\x82\xC1\x82\xC4\x82\xA2\x82\xDC\x82\xB7\x81\x42\n\x57\x69\x6E\x64\x6F\x77\x73\x82\xF0\x8D\xC4\x8B\x4E\x93\xAE\x82\xB5\x82\xC4\x82\xDD\x82\xC4\x82\xAD\x82\xBE\x82\xB3\x82\xA2\x81\x42\n\x83\x76\x83\x89\x83\x4F\x83\x43\x83\x93\x96\xBC\x20\x81\x46\x20\x25\x73", (DWORD) path); } } - int a; + int tmp; resFile >> mID; resFile >> mAttrib; - resFile >> a; // mDependID + resFile >> tmp; // mDependID resFile >> mGameLevel; resFile >> mSecretItem; - resFile >> a; // mItemType - resFile >> a; // mMustItem + resFile >> tmp; // mItemType + resFile >> tmp; // mMustItem resFile >> mPluginName; mIsSubPlugin = resFile.IsSubPlugin(); @@ -62,22 +62,28 @@ void T2PluginSpecifier::Initialize(HINSTANCE inst, const char* path) { if (inst) { if (!resFile.OpenResource(inst, 128, "DESC")) { + // プラグインãŒå£Šã‚Œã¦ã„ã‚‹ã‹ã€ä»¥å‰ã«The Towerâ…¡ãŒç•°å¸¸çµ‚了ã—ãŸãŸã‚ã«ã€ãƒ—ラグインãŒä½¿ãˆãªããªã£ã¦ã„ã¾ã™ã€‚ + // Windowsã‚’å†èµ·å‹•ã—ã¦ã¿ã¦ãã ã•ã„。 + // プラグインå : %s #line 68 - __Rep1(__FILE__, __LINE__, "�v���O�C�������Ă��邩�A�ȑO��The Tower�U���Ù�I���������߂ÉA�v���O�C�����g���Ȃ��Ȃ��Ă��܂��B\nWindows���ċN�����Ă݂Ă��������B\n�v���O�C�� �F %s", (DWORD) path); + __Rep1(__FILE__, __LINE__, "\x83\x76\x83\x89\x83\x4F\x83\x43\x83\x93\x82\xAA\x89\xF3\x82\xEA\x82\xC4\x82\xA2\x82\xE9\x82\xA9\x81\x41\x88\xC8\x91\x4F\x82\xC9\x54\x68\x65\x20\x54\x6F\x77\x65\x72\x87\x55\x82\xAA\x88\xD9\x8F\xED\x8F\x49\x97\xB9\x82\xB5\x82\xBD\x82\xBD\x82\xDF\x82\xC9\x81\x41\x83\x76\x83\x89\x83\x4F\x83\x43\x83\x93\x82\xAA\x8E\x67\x82\xA6\x82\xC8\x82\xAD\x82\xC8\x82\xC1\x82\xC4\x82\xA2\x82\xDC\x82\xB7\x81\x42\n\x57\x69\x6E\x64\x6F\x77\x73\x82\xF0\x8D\xC4\x8B\x4E\x93\xAE\x82\xB5\x82\xC4\x82\xDD\x82\xC4\x82\xAD\x82\xBE\x82\xB3\x82\xA2\x81\x42\n\x83\x76\x83\x89\x83\x4F\x83\x43\x83\x93\x96\xBC\x20\x81\x46\x20\x25\x73", (DWORD) path); } } else { if (!resFile.OpenResource(path, 128, 'DESC')) { + // プラグインãŒå£Šã‚Œã¦ã„ã‚‹ã‹ã€ä»¥å‰ã«The Towerâ…¡ãŒç•°å¸¸çµ‚了ã—ãŸãŸã‚ã«ã€ãƒ—ラグインãŒä½¿ãˆãªããªã£ã¦ã„ã¾ã™ã€‚ + // Windowsã‚’å†èµ·å‹•ã—ã¦ã¿ã¦ãã ã•ã„。 + // プラグインå : %s #line 73 - __Rep1(__FILE__, __LINE__, "�v���O�C�������Ă��邩�A�ȑO��The Tower�U���Ù�I���������߂ÉA�v���O�C�����g���Ȃ��Ȃ��Ă��܂��B\nWindows���ċN�����Ă݂Ă��������B\n�v���O�C�� �F %s", (DWORD) path); + __Rep1(__FILE__, __LINE__, "\x83\x76\x83\x89\x83\x4F\x83\x43\x83\x93\x82\xAA\x89\xF3\x82\xEA\x82\xC4\x82\xA2\x82\xE9\x82\xA9\x81\x41\x88\xC8\x91\x4F\x82\xC9\x54\x68\x65\x20\x54\x6F\x77\x65\x72\x87\x55\x82\xAA\x88\xD9\x8F\xED\x8F\x49\x97\xB9\x82\xB5\x82\xBD\x82\xBD\x82\xDF\x82\xC9\x81\x41\x83\x76\x83\x89\x83\x4F\x83\x43\x83\x93\x82\xAA\x8E\x67\x82\xA6\x82\xC8\x82\xAD\x82\xC8\x82\xC1\x82\xC4\x82\xA2\x82\xDC\x82\xB7\x81\x42\n\x57\x69\x6E\x64\x6F\x77\x73\x82\xF0\x8D\xC4\x8B\x4E\x93\xAE\x82\xB5\x82\xC4\x82\xDD\x82\xC4\x82\xAD\x82\xBE\x82\xB3\x82\xA2\x81\x42\n\x83\x76\x83\x89\x83\x4F\x83\x43\x83\x93\x96\xBC\x20\x81\x46\x20\x25\x73", (DWORD) path); } } resFile >> mType; resFile >> m28; - CFileStatus fileStatus; - CFile::GetStatus(path, fileStatus); - mTime = fileStatus.m_mtime; + CFileStatus stat; + CFile::GetStatus(path, stat); + mTime = stat.m_mtime; } void T2PluginSpecifier::Read(CArchive& archive) { diff --git a/src/T2DLL/T2PluginSpecifier.h b/src/T2DLL/T2PluginSpecifier.h index 37fbff5..8a3c6d0 100644 --- a/src/T2DLL/T2PluginSpecifier.h +++ b/src/T2DLL/T2PluginSpecifier.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS T2PluginSpecifier : public CObject { +class AFX_CLASS_EXPORT T2PluginSpecifier : public CObject { public: T2PluginSpecifier(); virtual void operator=(T2PluginSpecifier&); diff --git a/src/T2DLL/T2Pool.h b/src/T2DLL/T2Pool.h index e91e659..54489f9 100644 --- a/src/T2DLL/T2Pool.h +++ b/src/T2DLL/T2Pool.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS T2Pool { +class AFX_CLASS_EXPORT T2Pool { public: T2Pool(T2PoolDef* inDef, T2SeasonParamDef* inSeason, T2TemplatePluginList* inPluginList, T2PeopleArrayList* inPeopleList, int inLevel, unsigned int inIndex, unsigned int inSomeNum, T2WorldDef* inWorldDef); T2Pool(T2Archive& inArchive, T2PoolDef* inDef, T2SeasonParamDef* inSeason, T2TemplatePluginList* inPluginList, T2PeopleArrayList* inPeopleList, T2WorldDef* inWorldDef); @@ -19,8 +19,7 @@ public: T2People* BornVIP(int inSilhouetteType, int inEconoType = -1); void DeadVIP(T2People* inPeople); void Write(T2Archive& inArchive); - - int GetPopulation() const { return mPopulation; } + int GetPopulation() const; protected: void DayChanged(); @@ -38,3 +37,7 @@ protected: T2TemplatePluginList *mPlugins; T2PeopleArrayList *mPeopleList; }; + +inline int T2Pool::GetPopulation() const { + return mPopulation; +} diff --git a/src/T2DLL/T2PrefDialogBox.h b/src/T2DLL/T2PrefDialogBox.h index 1f551d2..ec79ac5 100644 --- a/src/T2DLL/T2PrefDialogBox.h +++ b/src/T2DLL/T2PrefDialogBox.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2Dialog.h" -class AFX_EXT_CLASS T2PrefDialogBox : public T2Dialog { +class AFX_CLASS_EXPORT T2PrefDialogBox : public T2Dialog { public: T2PrefDialogBox(); virtual ~T2PrefDialogBox(); diff --git a/src/T2DLL/T2PrefFile.h b/src/T2DLL/T2PrefFile.h index 5484470..9f6e9ce 100644 --- a/src/T2DLL/T2PrefFile.h +++ b/src/T2DLL/T2PrefFile.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS T2PrefFile { +class AFX_CLASS_EXPORT T2PrefFile { public: T2PrefFile(const unsigned char* str1, const unsigned char* str2, int val); virtual ~T2PrefFile(); diff --git a/src/T2DLL/T2RegistedTenantDB.h b/src/T2DLL/T2RegistedTenantDB.h index 365ab44..ee5bd72 100644 --- a/src/T2DLL/T2RegistedTenantDB.h +++ b/src/T2DLL/T2RegistedTenantDB.h @@ -2,7 +2,7 @@ #include "common.h" #include "LArray.h" -class AFX_EXT_CLASS T2RegistedTenantDB : private LArray { +class AFX_CLASS_EXPORT T2RegistedTenantDB : private LArray { public: T2RegistedTenantDB(); virtual ~T2RegistedTenantDB(); diff --git a/src/T2DLL/T2RegistedTenantIterator.h b/src/T2DLL/T2RegistedTenantIterator.h index 61c06fb..ef948a6 100644 --- a/src/T2DLL/T2RegistedTenantIterator.h +++ b/src/T2DLL/T2RegistedTenantIterator.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS T2RegistedTenantIterator { +class AFX_CLASS_EXPORT T2RegistedTenantIterator { public: T2RegistedTenantIterator(const T2RegistedTenantDB* db, unsigned int registID, const T2RouteNavigator* routeNavigator, POINT point); ~T2RegistedTenantIterator(); diff --git a/src/T2DLL/T2RemoveFavoriteDialog.h b/src/T2DLL/T2RemoveFavoriteDialog.h index 50e1d00..0688734 100644 --- a/src/T2DLL/T2RemoveFavoriteDialog.h +++ b/src/T2DLL/T2RemoveFavoriteDialog.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2Dialog.h" -class AFX_EXT_CLASS T2RemoveFavoriteDialog : public T2Dialog { +class AFX_CLASS_EXPORT T2RemoveFavoriteDialog : public T2Dialog { public: T2RemoveFavoriteDialog(); virtual ~T2RemoveFavoriteDialog(); diff --git a/src/T2DLL/T2Request.cpp b/src/T2DLL/T2Request.cpp index a1607d0..3ff951a 100644 --- a/src/T2DLL/T2Request.cpp +++ b/src/T2DLL/T2Request.cpp @@ -63,15 +63,14 @@ void T2Request::InitRequest(T2FloorInfo* floorInfo, unsigned int moverID, POINT } void T2Request::RemoveRequest(T2TowerDoc* towerDoc) { - T2FloorInfo *floorInfo = towerDoc->towerDoc_vf12C(); - T2TowerMainView *mainView = towerDoc->GetTowerMainView(); + T2FloorInfo *theFloorInfo = towerDoc->towerDoc_vf12C(); + T2TowerMainView *theView = towerDoc->GetTowerMainView(); - RemoveContents(floorInfo); + RemoveContents(theFloorInfo); - CRect prevArea; - CRect area; - CalcPrevArea(area); - CalcArea(area); + CRect thePrevArea, theNextArea; + CalcPrevArea(thePrevArea); + CalcArea(theNextArea); ERequestUpDown upDown; if (mIsGoDown) @@ -79,12 +78,12 @@ void T2Request::RemoveRequest(T2TowerDoc* towerDoc) { else upDown = ERequestUpDown_0; - floorInfo->RemoveRequestID(upDown, area); + theFloorInfo->RemoveRequestID(upDown, theNextArea); SetUsed(false); - floorInfo->SetTenantDrawModeByRect(prevArea, DrawMode1); + theFloorInfo->SetTenantDrawModeByRect(thePrevArea, DrawMode1); - if (mainView) - mainView->tmv_vf128(area, false); + if (theView) + theView->tmv_vf128(theNextArea, false); } void T2Request::RemoveContents(T2FloorInfo* floorInfo) { @@ -129,17 +128,17 @@ void T2Request::StopRemoved(T2TowerDoc* towerDoc, int y) { } T2PeopleLinkIterator iterator(mFirst); - T2People *people = NULL; - T2People *nextPeople = NULL; - iterator.Next(&people); - while (people) { - iterator.Next(&nextPeople); - if (people->GetCurrDestPos().y == y) { - Leave(people); - theFloor->Enter(people); + T2People *thePeople = NULL; + T2People *theNextPeople = NULL; + iterator.Next(&thePeople); + while (thePeople) { + iterator.Next(&theNextPeople); + if (thePeople->GetCurrDestPos().y == y) { + Leave(thePeople); + theFloor->Enter(thePeople); } - people = nextPeople; - nextPeople = NULL; + thePeople = theNextPeople; + theNextPeople = NULL; } } @@ -314,17 +313,17 @@ T2People* T2Request::LeaveFirst() { } BOOL T2Request::Regist(T2TowerDoc* towerDoc, T2People* people) { - BOOL result = false; + BOOL isRegist = false; T2FloorInfo *theFloorInfo = towerDoc->towerDoc_vf12C(); - POINT position = mHeadPosition; - POINT curPos = people->GetCurPosition(); + POINT headPt = mHeadPosition; + POINT curPt = people->GetCurPosition(); if (mIsGoDown) - position.x += 2; + headPt.x += 2; else - position.x -= 4; + headPt.x -= 4; - if (curPos.y == position.y && curPos.x == position.x) { + if (curPt.y == headPt.y && curPt.x == headPt.x) { POINT destPos = people->GetCurrDestPos(); if (people->IsGoDown() == mIsGoDown) { T2Mover *theMover = theFloorInfo->GetMover(mMoverID); @@ -341,13 +340,13 @@ BOOL T2Request::Regist(T2TowerDoc* towerDoc, T2People* people) { people->SetDirection(0); people->ChangeStatus(6); - result = true; + isRegist = true; } } } } - return result; + return isRegist; } void T2Request::ChangeOffPPLStatus(T2FloorInfo* floorInfo, T2People* people) { @@ -356,8 +355,8 @@ void T2Request::ChangeOffPPLStatus(T2FloorInfo* floorInfo, T2People* people) { else people->MoveHTo(mHeadPosition.x - 4); - POINT pt = people->GetCurPosition(); - T2Tenant *floor = floorInfo->GetFloor(pt.y, pt.x); + POINT curPos = people->GetCurPosition(); + T2Tenant *floor = floorInfo->GetFloor(curPos.y, curPos.x); if (floor) { floor->Enter(people); people->ChangeStatus(4); @@ -430,25 +429,25 @@ T2People* T2Request::RemoveOffPeople() { #line 541 _ASSERT(theView != NULL); - CRect rect; + CRect area; if (mPeopleRemoved) { - CalcOnArea(rect); - theFloorInfo->SetTenantDrawModeByRect(rect, DrawMode1); - theView->tmv_vf128(rect, false); + CalcOnArea(area); + theFloorInfo->SetTenantDrawModeByRect(area, DrawMode1); + theView->tmv_vf128(area, false); } else if (mOnPeople || mOffPeople) { - CalcOnArea(rect); - theView->tmv_vf128(rect, false); + CalcOnArea(area); + theView->tmv_vf128(area, false); } if (m44) { - CalcPrevArea(rect); - theFloorInfo->SetTenantDrawModeByRect(rect, DrawMode1); - theView->tmv_vf128(rect, false); + CalcPrevArea(area); + theFloorInfo->SetTenantDrawModeByRect(area, DrawMode1); + theView->tmv_vf128(area, false); } - if (CalcIncQueueArea(rect)) - theView->tmv_vf128(rect, false); + if (CalcIncQueueArea(area)) + theView->tmv_vf128(area, false); return result; } @@ -462,44 +461,44 @@ T2People* T2Request::RemoveOffPeople() { } void T2Request::DrawUp(T2TowerDoc* towerDoc, const RECT& inRect) { - RECT myRect; - SetRect(&myRect, mHeadPosition.x - 2, mHeadPosition.y, mHeadPosition.x, mHeadPosition.y + 1); + RECT rect; + SetRect(&rect, mHeadPosition.x - 2, mHeadPosition.y, mHeadPosition.x, mHeadPosition.y + 1); - if (myRect.left < inRect.right) { + if (rect.left < inRect.right) { if (mOffPeople) - mOffPeople->Draw(towerDoc, inRect); + mOffPeople->Draw(towerDoc, rect); if (mOnPeople) - mOnPeople->Draw(towerDoc, inRect); + mOnPeople->Draw(towerDoc, rect); } - OffsetRect(&myRect, -2, 0); + OffsetRect(&rect, -2, 0); T2PeopleLinkIterator iterator(mFirst); T2People *people; - while (iterator.Next(&people) && myRect.right > inRect.left) { - if (myRect.left < inRect.right) - people->Draw(towerDoc, inRect); - OffsetRect(&myRect, -people->GetWidth(), 0); + while (iterator.Next(&people) && rect.right > inRect.left) { + if (rect.left < inRect.right) + people->Draw(towerDoc, rect); + OffsetRect(&rect, -people->GetWidth(), 0); } } void T2Request::DrawDown(T2TowerDoc* towerDoc, const RECT& inRect) { - RECT myRect; - SetRect(&myRect, mHeadPosition.x, mHeadPosition.y, mHeadPosition.x + 2, mHeadPosition.y + 1); + RECT rect; + SetRect(&rect, mHeadPosition.x, mHeadPosition.y, mHeadPosition.x + 2, mHeadPosition.y + 1); - if (myRect.right > inRect.left) { + if (rect.right > inRect.left) { if (mOffPeople) - mOffPeople->Draw(towerDoc, inRect); + mOffPeople->Draw(towerDoc, rect); if (mOnPeople) - mOnPeople->Draw(towerDoc, inRect); + mOnPeople->Draw(towerDoc, rect); } - OffsetRect(&myRect, 2, 0); + OffsetRect(&rect, 2, 0); T2PeopleLinkIterator iterator(mFirst); T2People *people; - while (iterator.Next(&people) && myRect.left < inRect.right) { - if (myRect.right > inRect.left) - people->Draw(towerDoc, inRect); - OffsetRect(&myRect, people->GetWidth(), 0); + while (iterator.Next(&people) && rect.left < inRect.right) { + if (rect.right > inRect.left) + people->Draw(towerDoc, rect); + OffsetRect(&rect, people->GetWidth(), 0); } } @@ -534,6 +533,7 @@ void T2Request::BreakoutEmergency(T2TowerDoc* towerDoc) { T2Object::LoadSelf(archive, towerDoc); if (IsUsed()) { +#pragma var_order(uc, c, s, us, ui) unsigned int ui; unsigned short us; unsigned char uc; @@ -597,6 +597,7 @@ void T2Request::BreakoutEmergency(T2TowerDoc* towerDoc) { T2Object::SaveSelf(archive); if (IsUsed()) { +#pragma var_order(uc, c, s, us, ui) unsigned int ui; unsigned short us; unsigned char uc; @@ -688,61 +689,61 @@ void T2Request::DrawFinished() { } T2People* T2Request::FindUpPeople(int inH) const { - T2People *result = NULL; + T2People *theUpPeople = NULL; - int minH = mHeadPosition.x; - int maxH = minH - 2; + int rightH = mHeadPosition.x; + int leftH = rightH - 2; - if (inH >= maxH) { + if (inH >= leftH) { if (mOffPeople) - result = mOffPeople; + theUpPeople = mOffPeople; else if (mOnPeople) - result = mOnPeople; + theUpPeople = mOnPeople; } - if (!result) { - minH = maxH; + if (!theUpPeople) { + rightH = leftH; T2PeopleLinkIterator iterator(mFirst); T2People *people; - while (!result && iterator.Next(&people)) { - maxH -= people->GetWidth(); - if (inH >= maxH && inH < minH) - result = people; - minH = maxH; + while (!theUpPeople && iterator.Next(&people)) { + leftH -= people->GetWidth(); + if (inH >= leftH && inH < rightH) + theUpPeople = people; + rightH = leftH; } } - return result; + return theUpPeople; } T2People* T2Request::FindDownPeople(int inH) const { - T2People *result = NULL; + T2People *theDownPeople = NULL; - int minH = mHeadPosition.x; - int maxH = minH + 2; + int leftH = mHeadPosition.x; + int rightH = leftH + 2; - if (inH < maxH) { + if (inH < rightH) { if (mOffPeople) - result = mOffPeople; + theDownPeople = mOffPeople; else if (mOnPeople) - result = mOnPeople; + theDownPeople = mOnPeople; } - if (!result) { - minH = maxH; + if (!theDownPeople) { + leftH = rightH; T2PeopleLinkIterator iterator(mFirst); T2People *people; - while (!result && iterator.Next(&people)) { - maxH += people->GetWidth(); - if (inH < maxH && inH >= minH) - result = people; - minH = maxH; + while (!theDownPeople && iterator.Next(&people)) { + rightH += people->GetWidth(); + if (inH < rightH && inH >= leftH) + theDownPeople = people; + leftH = rightH; } } - return result; + return theDownPeople; } void T2Request::CalcValidArea(RECT& rect) { diff --git a/src/T2DLL/T2Request.h b/src/T2DLL/T2Request.h index 685f141..95da6e5 100644 --- a/src/T2DLL/T2Request.h +++ b/src/T2DLL/T2Request.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2DrawableObject.h" -class AFX_EXT_CLASS T2Request : public T2DrawableObject { +class AFX_CLASS_EXPORT T2Request : public T2DrawableObject { public: T2Request(); virtual ~T2Request(); diff --git a/src/T2DLL/T2RequestArray.h b/src/T2DLL/T2RequestArray.h index fb26990..3a6e652 100644 --- a/src/T2DLL/T2RequestArray.h +++ b/src/T2DLL/T2RequestArray.h @@ -3,7 +3,7 @@ #include "T2ObjectArray.h" #include "T2Request.h" -class AFX_EXT_CLASS T2RequestArray : public T2ObjectArray { +class AFX_CLASS_EXPORT T2RequestArray : public T2ObjectArray { public: T2RequestArray(unsigned int startID = 1000); virtual ~T2RequestArray(); diff --git a/src/T2DLL/T2RequestArrayList.h b/src/T2DLL/T2RequestArrayList.h index 1c7cd5a..315143b 100644 --- a/src/T2DLL/T2RequestArrayList.h +++ b/src/T2DLL/T2RequestArrayList.h @@ -2,7 +2,7 @@ #include "common.h" #include "LArray.h" -class AFX_EXT_CLASS T2RequestArrayList : private LArray { +class AFX_CLASS_EXPORT T2RequestArrayList : private LArray { public: T2RequestArrayList(); virtual ~T2RequestArrayList(); diff --git a/src/T2DLL/T2RequestIDArray.h b/src/T2DLL/T2RequestIDArray.h index 33d8533..10b2fd9 100644 --- a/src/T2DLL/T2RequestIDArray.h +++ b/src/T2DLL/T2RequestIDArray.h @@ -7,7 +7,7 @@ enum EReqIDArrayPos { ReqIDArrayPos_1 = 1, }; -class AFX_EXT_CLASS T2RequestIDArray : private LArray { +class AFX_CLASS_EXPORT T2RequestIDArray : private LArray { public: T2RequestIDArray(); virtual ~T2RequestIDArray(); diff --git a/src/T2DLL/T2RouteCEArray.h b/src/T2DLL/T2RouteCEArray.h index b4df1fc..999b36d 100644 --- a/src/T2DLL/T2RouteCEArray.h +++ b/src/T2DLL/T2RouteCEArray.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2CrossEquipArray.h" -class AFX_EXT_CLASS T2RouteCEArray : public T2CrossEquipArray { +class AFX_CLASS_EXPORT T2RouteCEArray : public T2CrossEquipArray { public: T2RouteCEArray(); virtual ~T2RouteCEArray(); diff --git a/src/T2DLL/T2RouteNavigator.h b/src/T2DLL/T2RouteNavigator.h index 1ba8749..a667e07 100644 --- a/src/T2DLL/T2RouteNavigator.h +++ b/src/T2DLL/T2RouteNavigator.h @@ -10,7 +10,7 @@ enum { kMaxRouteType = 4 }; -class AFX_EXT_CLASS T2RouteNavigator { +class AFX_CLASS_EXPORT T2RouteNavigator { public: T2RouteNavigator(T2FloorInfo* inFloorInfo); virtual ~T2RouteNavigator(); @@ -24,8 +24,7 @@ public: BOOL IsConnectRouteFromLobby(POINT inPt) const; BOOL GetNextRoute(POINT inFromPt, POINT& ioToPt, int inRouteType) const; T2Tenant* SelectNearTenant(POINT inPt, unsigned int inSearchScore) const; - - T2FloorPtrList* GetFloorPtrList() const { return mFloorPtrList; } + T2FloorPtrList* GetFloorPtrList() const; protected: BOOL GetNextRouteUsingEStair(POINT inFromPt, POINT&) const; @@ -34,3 +33,7 @@ protected: T2FloorInfo *mFloorInfo; T2RoutingTable *mRoutingTables[kMaxRouteType]; }; + +inline T2FloorPtrList* T2RouteNavigator::GetFloorPtrList() const { + return mFloorPtrList; +} diff --git a/src/T2DLL/T2RoutingTable.cpp b/src/T2DLL/T2RoutingTable.cpp index c6ae7fa..df91553 100644 --- a/src/T2DLL/T2RoutingTable.cpp +++ b/src/T2DLL/T2RoutingTable.cpp @@ -1,9 +1,11 @@ +#include "T2CrossEquipArray.h" #include "T2FInfoAreaIterator.h" #include "T2FloorInfo.h" #include "T2FloorPtrList.h" #include "T2Mover.h" #include "T2MoverRoutingTable.h" #include "T2RoutingTable.h" +#include "T2RoutingTableElem.h" #include "T2Tenant.h" T2RoutingTable::T2RoutingTable(T2FloorInfo* inFloorInfo, T2FloorPtrList* inFloorPtrList, int inWhichTable) @@ -359,44 +361,3 @@ T2Tenant* T2RoutingTable::SelectNearTenant(T2Tenant* inTenant, int inH, unsigned return selectedTenant; } - - - -T2RoutingTableElem::T2RoutingTableElem() { - mNextFloorID = 0; - mScore = 0; - mTime = 0; - mFinalHPos = 0; -} - -T2RoutingTableElem::~T2RoutingTableElem() { -} - -BOOL T2RoutingTableElem::IsStopFloor() const { - return ((mNextFloorID != 0) && (mScore == 0)); -} - -void T2RoutingTableElem::SetTable(unsigned int inNextFloorID, int inFinalHPos) { - mNextFloorID = inNextFloorID; - mScore = 0; - mTime = 0; - mFinalHPos = inFinalHPos; -} - -BOOL T2RoutingTableElem::IsSetTable(unsigned int inNextFloorID, unsigned int inScore, int inTime, int inFinalHPos) { - BOOL result = false; - - if (mNextFloorID == 0 || mScore > inScore) { - mNextFloorID = inNextFloorID; - mScore = inScore; - mTime = inTime; - mFinalHPos = inFinalHPos; - result = true; - } - - return result; -} - -BOOL T2RoutingTableElem::HasNextRoute(unsigned int inFloorID) const { - return (mNextFloorID != 0) && (mNextFloorID != inFloorID); -} diff --git a/src/T2DLL/T2RoutingTable.h b/src/T2DLL/T2RoutingTable.h index d42616b..f2c3691 100644 --- a/src/T2DLL/T2RoutingTable.h +++ b/src/T2DLL/T2RoutingTable.h @@ -2,7 +2,7 @@ #include "common.h" #include "LArray.h" -class AFX_EXT_CLASS T2RoutingTable : private LArray { +class AFX_CLASS_EXPORT T2RoutingTable : private LArray { public: T2RoutingTable(T2FloorInfo* inFloorInfo, T2FloorPtrList* inFloorPtrList, int inWhichTable); virtual ~T2RoutingTable(); @@ -33,24 +33,3 @@ protected: T2FloorInfo *mFloorInfo; }; -class AFX_EXT_CLASS T2RoutingTableElem { -public: - T2RoutingTableElem(); - ~T2RoutingTableElem(); - BOOL IsStopFloor() const; - void SetTable(unsigned int inNextFloorID, int inFinalHPos); - BOOL IsSetTable(unsigned int inNextFloorID, unsigned int inScore, int inTime, int inFinalHPos); - BOOL HasNextRoute(unsigned int inFloorID) const; - - unsigned int GetNextFloorID() const { return mNextFloorID; } - unsigned int GetScore() const { return mScore; } - int GetTime() const { return mTime; } - int GetFinalHPos() const { return mFinalHPos; } - BOOL HasRoute() const { return (mNextFloorID != 0); } - -protected: - unsigned int mNextFloorID; - unsigned int mScore; - int mTime; - int mFinalHPos; -}; diff --git a/src/T2DLL/T2RoutingTableElem.cpp b/src/T2DLL/T2RoutingTableElem.cpp new file mode 100644 index 0000000..93a2489 --- /dev/null +++ b/src/T2DLL/T2RoutingTableElem.cpp @@ -0,0 +1,40 @@ +#include "T2RoutingTableElem.h" + +T2RoutingTableElem::T2RoutingTableElem() { + mNextFloorID = 0; + mScore = 0; + mTime = 0; + mFinalHPos = 0; +} + +T2RoutingTableElem::~T2RoutingTableElem() { +} + +BOOL T2RoutingTableElem::IsStopFloor() const { + return ((mNextFloorID != 0) && (mScore == 0)); +} + +void T2RoutingTableElem::SetTable(unsigned int inNextFloorID, int inFinalHPos) { + mNextFloorID = inNextFloorID; + mScore = 0; + mTime = 0; + mFinalHPos = inFinalHPos; +} + +BOOL T2RoutingTableElem::IsSetTable(unsigned int inNextFloorID, unsigned int inScore, int inTime, int inFinalHPos) { + BOOL result = false; + + if (mNextFloorID == 0 || mScore > inScore) { + mNextFloorID = inNextFloorID; + mScore = inScore; + mTime = inTime; + mFinalHPos = inFinalHPos; + result = true; + } + + return result; +} + +BOOL T2RoutingTableElem::HasNextRoute(unsigned int inFloorID) const { + return (mNextFloorID != 0) && (mNextFloorID != inFloorID); +} diff --git a/src/T2DLL/T2RoutingTableElem.h b/src/T2DLL/T2RoutingTableElem.h new file mode 100644 index 0000000..376a1f6 --- /dev/null +++ b/src/T2DLL/T2RoutingTableElem.h @@ -0,0 +1,30 @@ +#pragma once +#include "common.h" + +class AFX_CLASS_EXPORT T2RoutingTableElem { +public: + T2RoutingTableElem(); + ~T2RoutingTableElem(); + BOOL IsStopFloor() const; + void SetTable(unsigned int inNextFloorID, int inFinalHPos); + BOOL IsSetTable(unsigned int inNextFloorID, unsigned int inScore, int inTime, int inFinalHPos); + BOOL HasRoute() const; + BOOL HasNextRoute(unsigned int inFloorID) const; + + unsigned int GetNextFloorID() const; + unsigned int GetScore() const; + int GetTime() const; + int GetFinalHPos() const; + +protected: + unsigned int mNextFloorID; + unsigned int mScore; + int mTime; + int mFinalHPos; +}; + +inline unsigned int T2RoutingTableElem::GetNextFloorID() const { return mNextFloorID; } +inline unsigned int T2RoutingTableElem::GetScore() const { return mScore; } +inline int T2RoutingTableElem::GetTime() const { return mTime; } +inline int T2RoutingTableElem::GetFinalHPos() const { return mFinalHPos; } +inline BOOL T2RoutingTableElem::HasRoute() const { return (mNextFloorID != 0); } diff --git a/src/T2DLL/T2SantaClaus.h b/src/T2DLL/T2SantaClaus.h index 9a47a8b..a6ba866 100644 --- a/src/T2DLL/T2SantaClaus.h +++ b/src/T2DLL/T2SantaClaus.h @@ -5,7 +5,7 @@ class T2SantaClausAttach; -class AFX_EXT_CLASS T2SantaClaus : public T2EventItem { +class AFX_CLASS_EXPORT T2SantaClaus : public T2EventItem { public: T2SantaClaus(T2TowerEvent* inTowerEvent, CResFile* inResFile, int inSubID); virtual ~T2SantaClaus(); diff --git a/src/T2DLL/T2SearchDialog.h b/src/T2DLL/T2SearchDialog.h index 34cb975..719648b 100644 --- a/src/T2DLL/T2SearchDialog.h +++ b/src/T2DLL/T2SearchDialog.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2Dialog.h" -class AFX_EXT_CLASS T2SearchDialog : public T2Dialog { +class AFX_CLASS_EXPORT T2SearchDialog : public T2Dialog { public: T2SearchDialog(T2TowerDoc* inDoc); virtual ~T2SearchDialog(); diff --git a/src/T2DLL/T2SerialDialog.cpp b/src/T2DLL/T2SerialDialog.cpp index b7f7ceb..53f1641 100644 --- a/src/T2DLL/T2SerialDialog.cpp +++ b/src/T2DLL/T2SerialDialog.cpp @@ -1,5 +1,11 @@ #include "T2SerialDialog.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + T2SerialDialog::T2SerialDialog(CWnd *parent) : CDialog(228, parent) { @@ -30,6 +36,7 @@ void T2SerialDialog::GetSerial(char *buf) { } void T2SerialDialog::OnPaint() { +#pragma var_order(bitmapDC, bitmap, bitmapDCSave, font1, save, font2, y, dc, bitmapData, rect) CPaintDC dc(this); int save = dc.SaveDC(); diff --git a/src/T2DLL/T2SettingDialog.h b/src/T2DLL/T2SettingDialog.h index 7eba9ab..c81d876 100644 --- a/src/T2DLL/T2SettingDialog.h +++ b/src/T2DLL/T2SettingDialog.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2Dialog.h" -class AFX_EXT_CLASS T2SettingDialog : public T2Dialog { +class AFX_CLASS_EXPORT T2SettingDialog : public T2Dialog { public: T2SettingDialog(T2TowerDoc* inDoc); virtual ~T2SettingDialog(); diff --git a/src/T2DLL/T2Settlement.cpp b/src/T2DLL/T2Settlement.cpp index c535892..44de3d1 100644 --- a/src/T2DLL/T2Settlement.cpp +++ b/src/T2DLL/T2Settlement.cpp @@ -28,35 +28,35 @@ T2Settlement::T2Settlement(T2TowerDoc* towerDoc, T2Archive& archive) { archive >> count; for (i = 0; i < count; i++) { - short type; - int num; - archive >> type; - archive >> num; - T2TenantDef *def = mDocument->mTenantTemplates->FindTenantDef(type); - if (def && def->IsLoaded()) - def->mSettlement = num; + short theType; + int value; + archive >> theType; + archive >> value; + T2TenantDef *theDef = mDocument->mTenantTemplates->FindTenantDef(theType); + if (theDef && theDef->IsLoaded()) + theDef->mSettlement = value; } archive >> count; for (i = 0; i < count; i++) { - short type; - int num; - archive >> type; - archive >> num; - T2MoverDef *def = mDocument->mMoverTemplates->FindMoverDef(type); - if (def && def->IsLoaded()) - def->mSettlement = num; + short theType; + int value; + archive >> theType; + archive >> value; + T2MoverDef *theDef = mDocument->mMoverTemplates->FindMoverDef(theType); + if (theDef && theDef->IsLoaded()) + theDef->mSettlement = value; } archive >> count; for (i = 0; i < count; i++) { - short type; - int num; - archive >> type; - archive >> num; - T2OuterObjDef *def = mDocument->mOuterObjTemplates->FindOutObjDef(type); - if (def && def->IsLoaded()) - def->mSettlement = num; + short theType; + int value; + archive >> theType; + archive >> value; + T2OuterObjDef *theDef = mDocument->mOuterObjTemplates->FindOutObjDef(theType); + if (theDef && theDef->IsLoaded()) + theDef->mSettlement = value; } } @@ -73,27 +73,27 @@ T2Archive& T2Settlement::Write(T2Archive& archive) const { archive << m1C; archive << (unsigned int) mDocument->towerDoc_vf178()->GetCount(); - LArrayIterator tenantIterator(*mDocument->towerDoc_vf178()); - T2TenantDef *tenantDef = NULL; - while (tenantIterator.Next(&tenantDef)) { - archive << (short) tenantDef->GetToolType(); - archive << tenantDef->mSettlement; + LArrayIterator theTenantIter(*mDocument->towerDoc_vf178()); + T2TenantDef *theTenantDef = NULL; + while (theTenantIter.Next(&theTenantDef)) { + archive << (short) theTenantDef->GetToolType(); + archive << theTenantDef->mSettlement; } archive << (unsigned int) mDocument->towerDoc_vf17C()->GetCount(); - LArrayIterator moverIterator(*mDocument->towerDoc_vf17C()); - T2MoverDef *moverDef = NULL; - while (moverIterator.Next(&moverDef)) { - archive << (short) moverDef->GetToolType(); - archive << moverDef->mSettlement; + LArrayIterator theMoverIter(*mDocument->towerDoc_vf17C()); + T2MoverDef *theMoverDef = NULL; + while (theMoverIter.Next(&theMoverDef)) { + archive << (short) theMoverDef->GetToolType(); + archive << theMoverDef->mSettlement; } archive << (unsigned int) mDocument->towerDoc_vf180()->GetCount(); - LArrayIterator outObjIterator(*mDocument->towerDoc_vf180()); - T2OuterObjDef *outObjDef = NULL; - while (outObjIterator.Next(&outObjDef)) { - archive << (short) outObjDef->GetToolType(); - archive << outObjDef->mSettlement; + LArrayIterator theOuterObjIter(*mDocument->towerDoc_vf180()); + T2OuterObjDef *theOuterObjDef = NULL; + while (theOuterObjIter.Next(&theOuterObjDef)) { + archive << (short) theOuterObjDef->GetToolType(); + archive << theOuterObjDef->mSettlement; } return archive; @@ -134,7 +134,7 @@ void T2Settlement::DoPayTool(int funds, short fundGroup, T2ToolDef* inToolDef) { } void T2Settlement::EmitPayToolMessage(T2TowerDoc* towerDoc, T2ToolDef* inToolDef, const CString& str, int length, int type) { - BOOL flag = true; + BOOL canPay = true; T2DateTime *theNow = towerDoc->towerDoc_vf120(); #line 197 @@ -143,10 +143,10 @@ void T2Settlement::EmitPayToolMessage(T2TowerDoc* towerDoc, T2ToolDef* inToolDef if (length && type) { T2DateTime *theTimeLimit = GetTimeLimitOfMessage(towerDoc, inToolDef, type); if (theTimeLimit && *theNow >= *theTimeLimit) - flag = false; + canPay = false; } - if (flag) { + if (canPay) { T2DateTime *theTimeLimit = CalcTimeLimitOfMessage(theNow, length); #line 210 _ASSERT(theTimeLimit != NULL); @@ -221,23 +221,23 @@ void T2Settlement::SetTimeLimitOfMessage(T2TowerDoc* inDoc, T2ToolDef* inToolDef T2DateTime* T2Settlement::FindCategoryTimeLimit(T2TowerDoc* inDoc, T2ToolDef* inToolDef) { T2DateTime *theTimeLimit = NULL; - T2TemplatePluginList *theList = NULL; + T2TemplatePluginList *thePluginList = NULL; int theCategory = inToolDef->GetCategory(); switch (theCategory) { default: - theList = inDoc->towerDoc_vf178(); + thePluginList = inDoc->towerDoc_vf178(); break; case 20: - theList = inDoc->towerDoc_vf17C(); + thePluginList = inDoc->towerDoc_vf17C(); break; case 200: - theList = inDoc->towerDoc_vf180(); + thePluginList = inDoc->towerDoc_vf180(); break; } - if (theList) { - LArrayIterator iterator(*theList); + if (thePluginList) { + LArrayIterator iterator(*thePluginList); T2ToolDef *theToolDef; while (!theTimeLimit && iterator.Next(&theToolDef)) { if (theToolDef->GetCategory() == theCategory) @@ -256,23 +256,23 @@ T2DateTime* T2Settlement::FindCategoryTimeLimit(T2TowerDoc* inDoc, T2ToolDef* in } void T2Settlement::LinkCategoryTimeLimit(T2TowerDoc* inDoc, T2ToolDef* inToolDef, T2DateTime* inTimeLimit) { - T2TemplatePluginList *theList = NULL; + T2TemplatePluginList *thePluginList = NULL; int theCategory = inToolDef->GetCategory(); switch (theCategory) { default: - theList = inDoc->towerDoc_vf178(); + thePluginList = inDoc->towerDoc_vf178(); break; case 20: - theList = inDoc->towerDoc_vf17C(); + thePluginList = inDoc->towerDoc_vf17C(); break; case 200: - theList = inDoc->towerDoc_vf180(); + thePluginList = inDoc->towerDoc_vf180(); break; } - if (theList) { - LArrayIterator iterator(*theList); + if (thePluginList) { + LArrayIterator iterator(*thePluginList); T2ToolDef *theToolDef; while (iterator.Next(&theToolDef)) { if (theToolDef->GetCategory() == theCategory) { @@ -365,29 +365,29 @@ int T2Settlement::GetCategorySettlement(int inCategory) const { switch (inCategory) { default: { - LArrayIterator iterator(*mDocument->towerDoc_vf178()); - T2ToolDef *theToolDef = NULL; - while (iterator.Next(&theToolDef)) { - if (theToolDef->GetCategory() == inCategory) - result += theToolDef->mSettlement; + LArrayIterator theTenantIter(*mDocument->towerDoc_vf178()); + T2ToolDef *theTenantDef = NULL; + while (theTenantIter.Next(&theTenantDef)) { + if (theTenantDef->GetCategory() == inCategory) + result += theTenantDef->mSettlement; } break; } case 20: { - LArrayIterator iterator(*mDocument->towerDoc_vf17C()); - T2ToolDef *theToolDef = NULL; - while (iterator.Next(&theToolDef)) { - result += theToolDef->mSettlement; + LArrayIterator theMoverIter(*mDocument->towerDoc_vf17C()); + T2ToolDef *theMoverDef = NULL; + while (theMoverIter.Next(&theMoverDef)) { + result += theMoverDef->mSettlement; } break; } case 200: { - LArrayIterator iterator(*mDocument->towerDoc_vf180()); - T2ToolDef *theToolDef = NULL; - while (iterator.Next(&theToolDef)) { - result += theToolDef->mSettlement; + LArrayIterator theOuterObjIter(*mDocument->towerDoc_vf180()); + T2ToolDef *theOuterObjDef = NULL; + while (theOuterObjIter.Next(&theOuterObjDef)) { + result += theOuterObjDef->mSettlement; } break; } @@ -422,21 +422,21 @@ void T2Settlement::Update() { m18 = 0; m1C = 0; - LArrayIterator tenantIterator(*mDocument->towerDoc_vf178()); - T2TenantDef *tenantDef = NULL; - while (tenantIterator.Next(&tenantDef)) { - tenantDef->mSettlement = 0; + LArrayIterator theTenantIter(*mDocument->towerDoc_vf178()); + T2TenantDef *theTenantDef = NULL; + while (theTenantIter.Next(&theTenantDef)) { + theTenantDef->mSettlement = 0; } - LArrayIterator moverIterator(*mDocument->towerDoc_vf17C()); - T2MoverDef *moverDef = NULL; - while (moverIterator.Next(&moverDef)) { - moverDef->mSettlement = 0; + LArrayIterator theMoverIter(*mDocument->towerDoc_vf17C()); + T2MoverDef *theMoverDef = NULL; + while (theMoverIter.Next(&theMoverDef)) { + theMoverDef->mSettlement = 0; } - LArrayIterator outObjIterator(*mDocument->towerDoc_vf180()); - T2OuterObjDef *outObjDef = NULL; - while (outObjIterator.Next(&outObjDef)) { - outObjDef->mSettlement = 0; + LArrayIterator theOuterObjIter(*mDocument->towerDoc_vf180()); + T2OuterObjDef *theOuterObjDef = NULL; + while (theOuterObjIter.Next(&theOuterObjDef)) { + theOuterObjDef->mSettlement = 0; } } diff --git a/src/T2DLL/T2Settlement.h b/src/T2DLL/T2Settlement.h index c4d41b4..e879a82 100644 --- a/src/T2DLL/T2Settlement.h +++ b/src/T2DLL/T2Settlement.h @@ -24,7 +24,7 @@ enum { kTimeLimitLength1Month }; -class AFX_EXT_CLASS T2Settlement { +class AFX_CLASS_EXPORT T2Settlement { public: T2Settlement(T2TowerDoc* towerDoc, int funds); T2Settlement(T2TowerDoc* towerDoc, T2Archive&); diff --git a/src/T2DLL/T2SilhouetteDef.h b/src/T2DLL/T2SilhouetteDef.h index 5675c90..ba3b750 100644 --- a/src/T2DLL/T2SilhouetteDef.h +++ b/src/T2DLL/T2SilhouetteDef.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2TemplatePlugin.h" -class AFX_EXT_CLASS T2SilhouetteDef : public T2TemplatePlugin { +class AFX_CLASS_EXPORT T2SilhouetteDef : public T2TemplatePlugin { public: T2SilhouetteDef(DWORD type, T2PluginSpecifier& specifier, CResFile* resFile); virtual ~T2SilhouetteDef(); @@ -11,8 +11,8 @@ public: virtual int GetSortKey() { return mSilhouetteType; } int GetSilhouetteType() { return mSilhouetteType; } int GetSilhouette(int a, int b) { return (a * 3) + b; } - int GetWidth() const { return mWidth; } - int GetRouteType() const { return mRouteType; } + int GetWidth() const; + int GetRouteType() const; protected: T2BitImage *mImage; @@ -22,4 +22,13 @@ protected: int mRouteType; int mResID; char mName[32]; + }; + +inline int T2SilhouetteDef::GetWidth() const { + return mWidth; +} + +inline int T2SilhouetteDef::GetRouteType() const { + return mRouteType; +} diff --git a/src/T2DLL/T2SilhouettePane.h b/src/T2DLL/T2SilhouettePane.h index 464ad43..60bdec4 100644 --- a/src/T2DLL/T2SilhouettePane.h +++ b/src/T2DLL/T2SilhouettePane.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2DlgItem.h" -class AFX_EXT_CLASS T2SilhouettePane : public T2DlgItem { +class AFX_CLASS_EXPORT T2SilhouettePane : public T2DlgItem { public: T2SilhouettePane(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); virtual ~T2SilhouettePane(); diff --git a/src/T2DLL/T2SoundPlayer.h b/src/T2DLL/T2SoundPlayer.h index 7e9a5b4..344917d 100644 --- a/src/T2DLL/T2SoundPlayer.h +++ b/src/T2DLL/T2SoundPlayer.h @@ -22,7 +22,33 @@ enum { SoundFlags_10000 = 0x10000 }; -class AFX_EXT_CLASS T2SoundPlayer : public CWnd { +class AFX_CLASS_EXPORT T2SoundObjItem { +public: + T2SoundObjItem(); + ~T2SoundObjItem(); + + enum { + FileSource = 1, + ResSource = 2 + }; + + CString mName; + SOUNDPRIORITY mPriority; + LPDIRECTSOUNDBUFFER mDSBuffers[4]; + DWORD mPlayedAt[4]; + int mSourceKind; + CString mPath; + unsigned int mResID; + HINSTANCE mModuleHandle; +}; + +class AFX_CLASS_EXPORT T2SoundObjItemList : public CList<T2SoundObjItem *, T2SoundObjItem *> { +public: + T2SoundObjItemList(); + virtual ~T2SoundObjItemList(); +}; + +class AFX_CLASS_EXPORT T2SoundPlayer : public CWnd { DECLARE_MESSAGE_MAP() public: @@ -58,29 +84,3 @@ private: BOOL mIsSoundOn; BOOL mIsFadeOut; }; - -class AFX_EXT_CLASS T2SoundObjItem { -public: - T2SoundObjItem(); - ~T2SoundObjItem(); - - enum { - FileSource = 1, - ResSource = 2 - }; - - CString mName; - SOUNDPRIORITY mPriority; - LPDIRECTSOUNDBUFFER mDSBuffers[4]; - DWORD mPlayedAt[4]; - int mSourceKind; - CString mPath; - unsigned int mResID; - HINSTANCE mModuleHandle; -}; - -class AFX_EXT_CLASS T2SoundObjItemList : public CList<T2SoundObjItem *, T2SoundObjItem *> { -public: - T2SoundObjItemList(); - virtual ~T2SoundObjItemList(); -}; diff --git a/src/T2DLL/T2Sprite.h b/src/T2DLL/T2Sprite.h index 304891b..3210f11 100644 --- a/src/T2DLL/T2Sprite.h +++ b/src/T2DLL/T2Sprite.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2SpriteObj.h" -class AFX_EXT_CLASS T2Sprite : private CList<T2SpriteObj *, T2SpriteObj *> { +class AFX_CLASS_EXPORT T2Sprite : private CList<T2SpriteObj *, T2SpriteObj *> { public: T2Sprite(); virtual ~T2Sprite(); diff --git a/src/T2DLL/T2SpriteObj.h b/src/T2DLL/T2SpriteObj.h index 0064918..0c554dd 100644 --- a/src/T2DLL/T2SpriteObj.h +++ b/src/T2DLL/T2SpriteObj.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS T2SpriteObj { +class AFX_CLASS_EXPORT T2SpriteObj { public: T2SpriteObj(); ~T2SpriteObj(); diff --git a/src/T2DLL/T2StairModule.h b/src/T2DLL/T2StairModule.h index 4d8c939..f97a69d 100644 --- a/src/T2DLL/T2StairModule.h +++ b/src/T2DLL/T2StairModule.h @@ -8,7 +8,7 @@ enum { kStairDirection2 }; -class AFX_EXT_CLASS T2StairModule : public T2MoverModule { +class AFX_CLASS_EXPORT T2StairModule : public T2MoverModule { public: T2StairModule(); virtual ~T2StairModule(); diff --git a/src/T2DLL/T2StairModuleList.h b/src/T2DLL/T2StairModuleList.h index dca1acc..2edb38d 100644 --- a/src/T2DLL/T2StairModuleList.h +++ b/src/T2DLL/T2StairModuleList.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2MoverModuleList.h" -class AFX_EXT_CLASS T2StairModuleList : public T2MoverModuleList { +class AFX_CLASS_EXPORT T2StairModuleList : public T2MoverModuleList { public: T2StairModuleList(); virtual ~T2StairModuleList(); diff --git a/src/T2DLL/T2StewardDialog.h b/src/T2DLL/T2StewardDialog.h index 8209597..0e4c730 100644 --- a/src/T2DLL/T2StewardDialog.h +++ b/src/T2DLL/T2StewardDialog.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2Dialog.h" -class AFX_EXT_CLASS T2StewardDialog : public T2Dialog { +class AFX_CLASS_EXPORT T2StewardDialog : public T2Dialog { public: T2StewardDialog(T2TowerDoc* inDoc, HINSTANCE inModule, CString& inText, int inKind); virtual BOOL OnT2DialogCommand(WPARAM inWParam, LPARAM inLParam); diff --git a/src/T2DLL/T2StopInfoArray.cpp b/src/T2DLL/T2StopInfoArray.cpp index a509cbb..b56424f 100644 --- a/src/T2DLL/T2StopInfoArray.cpp +++ b/src/T2DLL/T2StopInfoArray.cpp @@ -28,9 +28,9 @@ void T2StopInfoArray::Expand(EEquipPos pos, int count) { if (count > 0) { int actualCount = count * 2; - unsigned char zero = 0; + unsigned char nullVal = 0; for (int i = 0; i < actualCount; i++) - InsertItemsAt(1, where, &zero); + InsertItemsAt(1, where, &nullVal); } else { int actualCount = -count * 2; for (int i = 0; i < actualCount; i++) diff --git a/src/T2DLL/T2StopInfoArray.h b/src/T2DLL/T2StopInfoArray.h index 4247f40..904de8a 100644 --- a/src/T2DLL/T2StopInfoArray.h +++ b/src/T2DLL/T2StopInfoArray.h @@ -2,7 +2,7 @@ #include "common.h" #include "LArray.h" -class AFX_EXT_CLASS T2StopInfoArray : private LArray { +class AFX_CLASS_EXPORT T2StopInfoArray : private LArray { public: T2StopInfoArray(); virtual ~T2StopInfoArray(); diff --git a/src/T2DLL/T2SubPlugin.h b/src/T2DLL/T2SubPlugin.h index 2865c92..4f89ccb 100644 --- a/src/T2DLL/T2SubPlugin.h +++ b/src/T2DLL/T2SubPlugin.h @@ -2,26 +2,29 @@ #include "common.h" #include "CResourcePlugin.h" -class AFX_EXT_CLASS T2SubPlugin : public CResourcePlugin { +class AFX_CLASS_EXPORT T2SubPlugin : public CResourcePlugin { public: T2SubPlugin(DWORD type, T2PluginSpecifier& specifier); virtual ~T2SubPlugin(); virtual DWORD GetPluginStyle() { return 'SPlg'; } + + BOOL IsTieup() { return mTieup != NULL; } + BOOL IsTieupFinish(); + + unsigned int GetOpenTime() const { return mOpenTime; } + void SetOpenTime(unsigned int t) { mOpenTime = t; } + unsigned int GetCloseTime() const { return mCloseTime; } + void SetCloseTime(unsigned int t) { mCloseTime = t; } + virtual void GetTitle(CString& outStr); virtual int GetBindTime() { return 1; } virtual void GlobalData(T2GlobalData*) {} - virtual unsigned long LoadSelf() { return 0; } - BOOL IsTieupFinish(); - BOOL IsTieup() { return mTieup != NULL; } - - unsigned int GetOpenTime() const { return mOpenTime; } - void SetOpenTime(unsigned int t) { mOpenTime = t; } - unsigned int GetCloseTime() const { return mCloseTime; } - void SetCloseTime(unsigned int t) { mCloseTime = t; } int DupCustomerTableDefRes() { return mDupCustomerTableDefRes; } T2ImageObj* GetImageObj() { return mImageObj; } + virtual unsigned long LoadSelf() { return 0; } + protected: virtual void LoadRsrcFromStream(CResFile& resFile); diff --git a/src/T2DLL/T2TempPluginComparator.h b/src/T2DLL/T2TempPluginComparator.h index 86e9f4c..1b19345 100644 --- a/src/T2DLL/T2TempPluginComparator.h +++ b/src/T2DLL/T2TempPluginComparator.h @@ -2,8 +2,9 @@ #include "common.h" #include "LComparator.h" -class AFX_EXT_CLASS T2TempPluginComparator : public LComparator { +class AFX_CLASS_EXPORT T2TempPluginComparator : public LComparator { public: + T2TempPluginComparator() {} virtual ~T2TempPluginComparator() {} virtual int Compare(const void* inItemOne, const void* inItemTwo, unsigned int inSizeOne, unsigned int inSizeTwo) const; virtual BOOL IsEqualTo(const void* inItemOne, const void* inItemTwo, unsigned int inSizeOne, unsigned int inSizeTwo) const; diff --git a/src/T2DLL/T2TemplatePlugin.h b/src/T2DLL/T2TemplatePlugin.h index 8484196..df39975 100644 --- a/src/T2DLL/T2TemplatePlugin.h +++ b/src/T2DLL/T2TemplatePlugin.h @@ -2,7 +2,7 @@ #include "common.h" #include "CDefRsrcPlugin.h" -class AFX_EXT_CLASS T2TemplatePlugin : public CDefRsrcPlugin { +class AFX_CLASS_EXPORT T2TemplatePlugin : public CDefRsrcPlugin { public: T2TemplatePlugin(DWORD type, T2PluginSpecifier& specifier, CResFile* resFile, CProgramPlugin* plugin); virtual ~T2TemplatePlugin(); diff --git a/src/T2DLL/T2TemplatePluginDB.h b/src/T2DLL/T2TemplatePluginDB.h index 0d53a16..7a2ee45 100644 --- a/src/T2DLL/T2TemplatePluginDB.h +++ b/src/T2DLL/T2TemplatePluginDB.h @@ -2,7 +2,7 @@ #include "common.h" #include "LArray.h" -class T2TemplatePluginDB : private LArray { +class AFX_CLASS_EXPORT T2TemplatePluginDB : private LArray { public: T2TemplatePluginDB(); virtual ~T2TemplatePluginDB(); diff --git a/src/T2DLL/T2TemplatePluginList.cpp b/src/T2DLL/T2TemplatePluginList.cpp index 1d1158f..d67a81c 100644 --- a/src/T2DLL/T2TemplatePluginList.cpp +++ b/src/T2DLL/T2TemplatePluginList.cpp @@ -53,10 +53,10 @@ T2TenantDef* T2TemplatePluginList::FindFloor() { return NULL; LArrayIterator iterator(*this); - T2TenantDef *plugin; - while (iterator.Next(&plugin)) { - if (plugin->IsFloor()) - return plugin; + T2TenantDef *theTenantDef; + while (iterator.Next(&theTenantDef)) { + if (theTenantDef->IsFloor()) + return theTenantDef; } return NULL; @@ -66,11 +66,11 @@ T2TenantDef* T2TemplatePluginList::FindTenantDef(int equipType) { if (mPluginType != 'TnDf') return NULL; - LArrayIterator iterator(*this); - T2TenantDef *plugin; - while (iterator.Next(&plugin)) { - if (plugin->GetEquipType() == equipType) - return plugin; + LArrayIterator iter(*this); + T2TenantDef *theTemplatePlugin; + while (iter.Next(&theTemplatePlugin)) { + if (theTemplatePlugin->GetEquipType() == equipType) + return theTemplatePlugin; } return NULL; @@ -80,11 +80,11 @@ T2MoverDef* T2TemplatePluginList::FindMoverDef(int equipType) { if (mPluginType != 'MvDf') return NULL; - LArrayIterator iterator(*this); - T2MoverDef *plugin; - while (iterator.Next(&plugin)) { - if (plugin->GetEquipType() == equipType) - return plugin; + LArrayIterator iter(*this); + T2MoverDef *theTemplatePlugin; + while (iter.Next(&theTemplatePlugin)) { + if (theTemplatePlugin->GetEquipType() == equipType) + return theTemplatePlugin; } return NULL; @@ -94,11 +94,11 @@ T2OuterObjDef* T2TemplatePluginList::FindOutObjDef(int toolType) { if (mPluginType != 'OODf') return NULL; - LArrayIterator iterator(*this); - T2OuterObjDef *plugin; - while (iterator.Next(&plugin)) { - if (plugin->GetToolType() == toolType) - return plugin; + LArrayIterator iter(*this); + T2OuterObjDef *theTemplatePlugin; + while (iter.Next(&theTemplatePlugin)) { + if (theTemplatePlugin->GetToolType() == toolType) + return theTemplatePlugin; } return NULL; @@ -108,11 +108,11 @@ T2PeopleDef* T2TemplatePluginList::FindPeopleDef(int peopleType) { if (mPluginType != 'PPDf') return NULL; - LArrayIterator iterator(*this); - T2PeopleDef *plugin; - while (iterator.Next(&plugin)) { - if (plugin->GetPeopleType() == peopleType) - return plugin; + LArrayIterator iter(*this); + T2PeopleDef *theTemplatePlugin; + while (iter.Next(&theTemplatePlugin)) { + if (theTemplatePlugin->GetPeopleType() == peopleType) + return theTemplatePlugin; } return NULL; @@ -122,51 +122,51 @@ T2SilhouetteDef* T2TemplatePluginList::FindSilhouette(int silhouetteType) { if (mPluginType != 'SlDf') return NULL; - LArrayIterator iterator(*this); - T2SilhouetteDef *plugin; - while (iterator.Next(&plugin)) { - if (plugin->GetSilhouetteType() == silhouetteType) - return plugin; + LArrayIterator iter(*this); + T2SilhouetteDef *theTemplatePlugin; + while (iter.Next(&theTemplatePlugin)) { + if (theTemplatePlugin->GetSilhouetteType() == silhouetteType) + return theTemplatePlugin; } return NULL; } int T2TemplatePluginList::CalcCategoryCount() { - int count = 0; - LArray categories(sizeof(int)); - LArrayIterator toolDefIterator(*this); - T2ToolDef *toolDef; - - while (toolDefIterator.Next(&toolDef)) { - int categoryNo = toolDef->mCategoryNo; - BOOL found = false; - - LArrayIterator categoryIterator(categories); - int check; - while (categoryIterator.Next(&check)) { - if (check == categoryNo) { - found = true; + int numCategory = 0; + LArray categoryIDs(sizeof(int)); + LArrayIterator theDefIterator(*this); + T2ToolDef *def; + + while (theDefIterator.Next(&def)) { + int toolCategoryNo = def->mCategoryNo; + BOOL done = false; + + LArrayIterator theCategoryIterator(categoryIDs); + int theCategory; + while (theCategoryIterator.Next(&theCategory)) { + if (theCategory == toolCategoryNo) { + done = true; break; } } - if (!found) { - categories.InsertItemsAt(1, categories.GetCount() + 1, &categoryNo); - count++; + if (!done) { + categoryIDs.InsertItemsAt(1, categoryIDs.GetCount() + 1, &toolCategoryNo); + numCategory++; } } - return count; + return numCategory; } void T2TemplatePluginList::DispatchIdle(T2TowerDoc* towerDoc) { if (mPluginType != 'OODf' && mPluginType != 'MvDf' && mPluginType != 'TnDf') return; - LArrayIterator iterator(*this); - T2ToolDef *toolDef; + LArrayIterator iter(*this); + T2ToolDef *theTemplatePlugin; - while (iterator.Next(&toolDef)) - toolDef->DefIdleProc(towerDoc); + while (iter.Next(&theTemplatePlugin)) + theTemplatePlugin->DefIdleProc(towerDoc); } diff --git a/src/T2DLL/T2TemplatePluginList.h b/src/T2DLL/T2TemplatePluginList.h index 4ca85e1..6bcb21c 100644 --- a/src/T2DLL/T2TemplatePluginList.h +++ b/src/T2DLL/T2TemplatePluginList.h @@ -2,7 +2,7 @@ #include "common.h" #include "LArray.h" -class AFX_EXT_CLASS T2TemplatePluginList : private LArray { +class AFX_CLASS_EXPORT T2TemplatePluginList : private LArray { public: T2TemplatePluginList(DWORD pluginType); virtual ~T2TemplatePluginList(); diff --git a/src/T2DLL/T2Tenant.cpp b/src/T2DLL/T2Tenant.cpp index 7fb98fb..e1a63eb 100644 --- a/src/T2DLL/T2Tenant.cpp +++ b/src/T2DLL/T2Tenant.cpp @@ -1593,13 +1593,13 @@ unsigned int T2Tenant::CheckRouteFromPool(T2TowerDoc* inDoc, unsigned int inScor POINT entrancePt = GetEntrancePt(); if (theNavigator->CheckRoute(theFloorInfo->GetEntrancePt(1000), entrancePt, inScore)) - checkRoute |= kTransportLobbyLeft | kTransportLobbyRight; + checkRoute |= kTransportFlagLobbyLeft | kTransportFlagLobbyRight; T2RegistedTenantDB *theDB = inDoc->towerDoc_vf174(); T2Tenant *theTenant = theDB->FindEmptyParking(); if (theTenant) { if (theNavigator->CheckRoute(theTenant->GetExitPt(), entrancePt, inScore)) - checkRoute |= kTransportParking; + checkRoute |= kTransportFlagParking; } T2TowerEvent *towerEvent = inDoc->towerDoc_vf170()->GetTowerEvent(); @@ -1607,26 +1607,26 @@ unsigned int T2Tenant::CheckRouteFromPool(T2TowerDoc* inDoc, unsigned int inScor theTenant = theDB->GetFirstTenant(kTenantRegistID8); if (theTenant && theTenant->IsOpen()) { if (theNavigator->CheckRoute(theTenant->GetExitPt(), entrancePt, inScore)) - checkRoute |= kTransportSubway; + checkRoute |= kTransportFlagSubway; } T2Transport *theTransport; - if (checkRoute & kTransportSubway) { + if (checkRoute & kTransportFlagSubway) { theTransport = towerEvent->GetMetroRailway(); if (theTransport && !theTransport->GetAvailable(theDateTime) != NULL) - checkRoute &= ~kTransportSubway; + checkRoute &= ~kTransportFlagSubway; } theTenant = theDB->GetFirstTenant(kTenantRegistID9); if (theTenant && theTenant->IsOpen()) { if (theNavigator->CheckRoute(theTenant->GetExitPt(), entrancePt, inScore)) - checkRoute |= kTransportShip; + checkRoute |= kTransportFlagShip; } - if (checkRoute & kTransportShip) { + if (checkRoute & kTransportFlagShip) { theTransport = towerEvent->GetCruise(); if (theTransport && !theTransport->GetAvailable(theDateTime) != NULL) - checkRoute &= ~kTransportShip; + checkRoute &= ~kTransportFlagShip; } return checkRoute; diff --git a/src/T2DLL/T2Tenant.h b/src/T2DLL/T2Tenant.h index 73dd7f5..381424e 100644 --- a/src/T2DLL/T2Tenant.h +++ b/src/T2DLL/T2Tenant.h @@ -37,7 +37,7 @@ enum { kTenantRegistID10 = 10, // ticket booth }; -class T2Tenant : public T2Equip { +class AFX_CLASS_EXPORT T2Tenant : public T2Equip { public: T2Tenant(); virtual ~T2Tenant(); @@ -47,9 +47,44 @@ public: virtual unsigned int Idle(T2TowerDoc* inDoc); virtual void Draw(T2TowerDoc* inDoc, const RECT&); virtual void BuildStart(T2TowerDoc* inDoc); + + unsigned int GetResideDay() const { return mResideDay; } + int GetEstimate() const { return mEstimate; } + void SetRelatedTenantID(unsigned int inID) { mRelatedTenantID = inID; } + unsigned int GetRelatedTenantID() const { return mRelatedTenantID; } + BOOL IsSetRelatedTenantID() const { return (mRelatedTenantID != 0); } + BOOL IsFloor() const { return IsSetAttribute(kTenantAttrIsFloor); } + BOOL IsPoolTenant() const { return (mEquipID == 1000); } + BOOL IsHome() const { return IsSetAttribute(kTenantAttrIsHome); } + BOOL IsConcat() const { return IsSetAttribute(kTenantAttrIsConcat); } + BOOL IsPeopleAnime() const { return IsSetAttribute(kTenantAttrIsPeopleAnime | kTenantAttrIsPeopleAnime2); } + BOOL IsNeedToilet() const { return IsSetAttribute(kTenantAttrIsNeedToilet); } + BOOL IsNeedDraw() { return mToolDef && mDrawMode; } + BOOL IsTherePeople() const { return mFirstPeople != NULL; } + BOOL IsThereCustomer() const { return mCustomerCount > 0; } + T2People* GetFirstPeople() const { return mFirstPeople; } + BOOL IsOpen() const { return mStatus >= kTenantStatus30 && mStatus <= kTenantStatus9999; } + BOOL WillBeFull() const { return (mCustomerCount + mReserveCount) >= GetCapacity(); } + int CalcRestCapacity() const { return GetCapacity() - (mCustomerCount + mReserveCount); } + void SetMark(int inMark) { mMark = inMark; } + int GetMark() const { return mMark; } + int GetBelongCount() const { return mBelongCount; } + void ClearWorkCount() { mWorkCount = 0; } + int GetTotalCustomer() const { return mTotalCustomer; } + void ClearTotalCustomer() { mTotalCustomer = 0; } + void IncTotalCustomer() { mTotalCustomer++; } + T2PeoplePtrList* GetBelongList() const { return mBelongList; } + void SetRelatedTenantList(T2EquipPtrList* inList) { mRelatedTenantList = inList; } + T2EquipPtrList* GetRelatedTenantList() const { return mRelatedTenantList; } virtual BOOL IsBuildFinish() { return mStatus > kTenantStatus9; } + + BOOL IsFire() { return mStatus >= kTenantStatus10000; } + BOOL IsFireproof() const { return IsSetAttribute(kTenantAttrIsFireproof); } + unsigned int GetTenantNumber() const { return mTenantNumber; } + void SetTenantNumber(unsigned int inNumber) { mTenantNumber = inNumber; } + virtual PROCCODE DoDestruct(T2TowerDoc* inDoc, POINT inPt, RECT& outRect); - virtual void ClearDrawMode() { mDrawMode = DrawMode0; } + virtual void ClearDrawMode(); virtual void PlaySound(T2TowerDoc* inDoc, int inID, unsigned int inMask, unsigned int inFlags) const; virtual void AddCEMoverID(const T2FloorInfo* inFloorInfo, POINT inPt, unsigned int inID); virtual unsigned int GetEntranceFloorID(); @@ -131,86 +166,25 @@ public: void SetMerchandise(int inCount, int* inArray); void SetRelatedTenant(T2TowerDoc* inDoc, unsigned int inRegistID); - unsigned int GetResideDay() const { return mResideDay; } - int GetEstimate() const { return mEstimate; } - void SetRelatedTenantID(unsigned int inID) { mRelatedTenantID = inID; } - unsigned int GetRelatedTenantID() const { return mRelatedTenantID; } - BOOL IsSetRelatedTenantID() const { return (mRelatedTenantID != 0); } - BOOL IsFloor() const { return IsSetAttribute(kTenantAttrIsFloor); } - BOOL IsPoolTenant() const { return (mEquipID == 1000); } - BOOL IsHome() const { return IsSetAttribute(kTenantAttrIsHome); } - BOOL IsConcat() const { return IsSetAttribute(kTenantAttrIsConcat); } - BOOL IsPeopleAnime() const { return IsSetAttribute(kTenantAttrIsPeopleAnime | kTenantAttrIsPeopleAnime2); } - BOOL IsNeedToilet() const { return IsSetAttribute(kTenantAttrIsNeedToilet); } - BOOL IsNeedDraw() { return mToolDef && mDrawMode; } - BOOL IsTherePeople() const { return mFirstPeople != NULL; } - BOOL IsThereCustomer() const { return mCustomerCount > 0; } - T2People* GetFirstPeople() const { return mFirstPeople; } - BOOL IsOpen() const { return mStatus >= kTenantStatus30 && mStatus <= kTenantStatus9999; } - BOOL WillBeFull() const { return (mCustomerCount + mReserveCount) >= GetCapacity(); } - int CalcRestCapacity() const { return GetCapacity() - (mCustomerCount + mReserveCount); } - void SetMark(int inMark) { mMark = inMark; } - int GetMark() const { return mMark; } - int GetBelongCount() const { return mBelongCount; } - void ClearWorkCount() { mWorkCount = 0; } - int GetTotalCustomer() const { return mTotalCustomer; } - void ClearTotalCustomer() { mTotalCustomer = 0; } - void IncTotalCustomer() { mTotalCustomer++; } - T2PeoplePtrList* GetBelongList() const { return mBelongList; } - void SetRelatedTenantList(T2EquipPtrList* inList) { mRelatedTenantList = inList; } - T2EquipPtrList* GetRelatedTenantList() const { return mRelatedTenantList; } - BOOL IsFire() { return mStatus >= kTenantStatus10000; } - BOOL IsFireproof() const { return IsSetAttribute(kTenantAttrIsFireproof); } - unsigned int GetTenantNumber() const { return mTenantNumber; } - void SetTenantNumber(unsigned int inNumber) { mTenantNumber = inNumber; } - BOOL IsBind() const { return mIsBind; } - void Bind() { mIsBind = true; } - void Unbind() { mIsBind = false; } - unsigned int GetOpenTime() const { - unsigned int time = 0; - T2TenantDef *def = (T2TenantDef *) mToolDef; - if (def) - time = def->mOpenTime; - return time; - } - unsigned int GetCloseTime() const { - unsigned int time = 0; - T2TenantDef *def = (T2TenantDef *) mToolDef; - if (def) - time = def->mCloseTime; - return time; - } - int GetBindTime() const { - int time = 0; - T2TenantDef *def = (T2TenantDef *) mToolDef; - if (def) - time = def->mBindTime; - return time; - } - T2TenantMemberTableDef* GetEmployeeTableDef() const { - T2TenantMemberTableDef *theDef = NULL; - if (mToolDef) - theDef = ((T2TenantDef *) mToolDef)->mEmployeeTableDef; - return theDef; - } - BOOL IsFull() const { return mCustomerCount > GetCapacity(); } - int GetCustomerCount() const { return mCustomerCount; } - int GetKindIndex() const { return mKindIndex; } - void SetKindIndex(int inIndex) { mKindIndex = inIndex; } - void IncWorkCount() { mWorkCount++; } - void DecWorkCount() { mWorkCount--; } - int GetWorkCount() const { return mWorkCount; } - void ClearReserveCount() { mReserveCount = 0; } - void IncReserveCount(unsigned int inAmount) { mReserveCount += inAmount; } - void DecReserveCount() { - if (mReserveCount > 0) - mReserveCount--; - } - int GetReserveCount() const { return mReserveCount; } - void CancelReserve() { - if (mReserveCount > 0) - mReserveCount--; - } + BOOL IsBind() const; + void Bind(); + void Unbind(); + unsigned int GetOpenTime() const; + unsigned int GetCloseTime() const; + int GetBindTime() const; + T2TenantMemberTableDef* GetEmployeeTableDef() const; + BOOL IsFull() const; + int GetCustomerCount() const; + int GetKindIndex() const; + void SetKindIndex(int inIndex); + void IncWorkCount(); + void DecWorkCount(); + int GetWorkCount() const; + void ClearReserveCount(); + void IncReserveCount(unsigned int inAmount); + void DecReserveCount(); + int GetReserveCount() const; + void CancelReserve(); protected: virtual void LoadSelf(T2Archive& inArchive, T2TowerDoc* inDoc); @@ -231,7 +205,7 @@ protected: static void DrawColorMesh(T2TowerDoc* inDoc, const CRect& inRect, int inClr); BOOL CollectEmployeeFromPool(T2TowerDoc* inDoc, T2TenantMemberTableDef* inTable); unsigned int CheckRouteFromPool(T2TowerDoc* inDoc, unsigned int inScore) const; - int GetConsumptionPower() const { return 0; } + int GetConsumptionPower() const { return 0; } friend class T2EquipDef; friend class T2TenantArray; @@ -256,3 +230,100 @@ protected: T2EquipPtrList *mRelatedTenantList; unsigned int mTenantNumber; }; + +inline /*virtual*/ void T2Tenant::ClearDrawMode() { + mDrawMode = DrawMode0; +} + +inline BOOL T2Tenant::IsBind() const { + return mIsBind; +} + +inline void T2Tenant::Bind() { + mIsBind = true; +} + +inline void T2Tenant::Unbind() { + mIsBind = false; +} + +inline unsigned int T2Tenant::GetOpenTime() const { + unsigned int time = 0; + T2TenantDef *def = (T2TenantDef *) mToolDef; + if (def) + time = def->mOpenTime; + return time; +} + +inline unsigned int T2Tenant::GetCloseTime() const { + unsigned int time = 0; + T2TenantDef *def = (T2TenantDef *) mToolDef; + if (def) + time = def->mCloseTime; + return time; +} + +inline int T2Tenant::GetBindTime() const { + int time = 0; + T2TenantDef *def = (T2TenantDef *) mToolDef; + if (def) + time = def->mBindTime; + return time; +} + +inline T2TenantMemberTableDef* T2Tenant::GetEmployeeTableDef() const { + T2TenantMemberTableDef *theDef = NULL; + if (mToolDef) + theDef = ((T2TenantDef *) mToolDef)->mEmployeeTableDef; + return theDef; +} + +inline BOOL T2Tenant::IsFull() const { + return mCustomerCount >= GetCapacity(); +} + +inline int T2Tenant::GetCustomerCount() const { + return mCustomerCount; +} + +inline int T2Tenant::GetKindIndex() const { + return mKindIndex; +} + +inline void T2Tenant::SetKindIndex(int inIndex) { + mKindIndex = inIndex; +} + +inline void T2Tenant::IncWorkCount() { + mWorkCount++; +} + +inline void T2Tenant::DecWorkCount() { + mWorkCount--; +} + +inline int T2Tenant::GetWorkCount() const { + return mWorkCount; +} + +inline void T2Tenant::ClearReserveCount() { + mReserveCount = 0; +} + +inline void T2Tenant::IncReserveCount(unsigned int inAmount) { + mReserveCount += inAmount; +} + +inline void T2Tenant::DecReserveCount() { + if (mReserveCount > 0) + mReserveCount--; +} + +inline int T2Tenant::GetReserveCount() const { + return mReserveCount; +} + +inline void T2Tenant::CancelReserve() { + if (mReserveCount > 0) + mReserveCount--; +} diff --git a/src/T2DLL/T2TenantArray.h b/src/T2DLL/T2TenantArray.h index 6a2146b..aef2cd0 100644 --- a/src/T2DLL/T2TenantArray.h +++ b/src/T2DLL/T2TenantArray.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2ObjectArray.h" -class AFX_EXT_CLASS T2TenantArray : public T2ObjectArray { +class AFX_CLASS_EXPORT T2TenantArray : public T2ObjectArray { public: enum { kGroupSize = 128 }; diff --git a/src/T2DLL/T2TenantArrayList.h b/src/T2DLL/T2TenantArrayList.h index 1192bc7..0e3e8b5 100644 --- a/src/T2DLL/T2TenantArrayList.h +++ b/src/T2DLL/T2TenantArrayList.h @@ -2,7 +2,7 @@ #include "common.h" #include "LArray.h" -class AFX_EXT_CLASS T2TenantArrayList : public LArray { +class AFX_CLASS_EXPORT T2TenantArrayList : public LArray { public: T2TenantArrayList(); virtual ~T2TenantArrayList(); diff --git a/src/T2DLL/T2TenantCEArray.h b/src/T2DLL/T2TenantCEArray.h index addee65..1e112cc 100644 --- a/src/T2DLL/T2TenantCEArray.h +++ b/src/T2DLL/T2TenantCEArray.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2CrossEquipArray.h" -class AFX_EXT_CLASS T2TenantCEArray : public T2CrossEquipArray { +class AFX_CLASS_EXPORT T2TenantCEArray : public T2CrossEquipArray { public: T2TenantCEArray(); virtual ~T2TenantCEArray(); diff --git a/src/T2DLL/T2TenantDef.cpp b/src/T2DLL/T2TenantDef.cpp index 6b5f40a..365a0bf 100644 --- a/src/T2DLL/T2TenantDef.cpp +++ b/src/T2DLL/T2TenantDef.cpp @@ -83,22 +83,22 @@ T2TenantDef::T2TenantDef(DWORD type, T2PluginSpecifier& specifier, CResFile* res /*virtual*/ void T2TenantDef::DrawProc(T2HaveOutViewObject* obj, const RECT& inRect, T2TowerDoc* towerDoc) const { T2Tenant *tenant = (T2Tenant *) obj; - RECT rect = inRect; + RECT tenantRect = inRect; - int id; + int objID; int pattern; - BOOL someFlag; + BOOL includeRoofAndFloor; if (towerDoc->mViewMode != 1) { - id = 100; - someFlag = true; + objID = 100; + includeRoofAndFloor = true; pattern = 0; pattern += tenant->mValiation * 1000; pattern += mHeight * 100; pattern += tenant->GetPatIndex(); } else { - id = 101; - someFlag = false; + objID = 101; + includeRoofAndFloor = false; pattern = (towerDoc->mWorldDef->GetOutViewKind() + 1) * 10000; pattern += tenant->mValiation * 1000; pattern += mHeight * 100; @@ -108,13 +108,13 @@ T2TenantDef::T2TenantDef(DWORD type, T2PluginSpecifier& specifier, CResFile* res pattern += 1; } - UT2Coordinate::UnitToQD(rect, towerDoc->towerDoc_vf108(), !someFlag); + UT2Coordinate::UnitToQD(tenantRect, towerDoc->towerDoc_vf108(), !includeRoofAndFloor); - int objIndex = mImageObj->FindObject(id, pattern); - if (objIndex >= 0) { - mImageObj->DrawObject(towerDoc->towerDoc_vf10C(), objIndex, rect, towerDoc->towerDoc_vf108()); + int objectIndex = mImageObj->FindObject(objID, pattern); + if (objectIndex >= 0) { + mImageObj->DrawObject(towerDoc->towerDoc_vf10C(), objectIndex, tenantRect, towerDoc->towerDoc_vf108()); } else if (tenant->m58) { - towerDoc->towerDoc_vf10C()->FillRect(rect, 1); + towerDoc->towerDoc_vf10C()->FillRect(tenantRect, 1); } else { CString err; #ifdef _MSC_VER @@ -140,8 +140,8 @@ T2TenantDef::T2TenantDef(DWORD type, T2PluginSpecifier& specifier, CResFile* res } /*virtual*/ unsigned int T2TenantDef::IdleProc(T2HaveOutViewObject* obj, T2TowerDoc* towerDoc) { - T2Equip *equip = (T2Equip *) obj; - int status = equip->GetStatus(); + T2Equip *theEquip = (T2Equip *) obj; + int status = theEquip->GetStatus(); unsigned int result = 0; if (status < kStatus10) { @@ -149,26 +149,26 @@ T2TenantDef::T2TenantDef(DWORD type, T2PluginSpecifier& specifier, CResFile* res result = 1; status++; - equip->SetStatus(status); + theEquip->SetStatus(status); if (status == kStatus10) { - BuildFinish(towerDoc, equip); - towerDoc->mTowerMainView->tmv_vf128(equip->mArea, true); + BuildFinish(towerDoc, theEquip); + towerDoc->mTowerMainView->tmv_vf128(theEquip->mArea, true); } } - T2Tenant *tenant = (T2Tenant *) equip; - status = tenant->GetStatus(); + T2Tenant *theTenant = (T2Tenant *) theEquip; + status = theTenant->GetStatus(); - if (status >= kStatus9 && ChangeStatusOnIdle(towerDoc, tenant, status)) { + if (status >= kStatus9 && ChangeStatusOnIdle(towerDoc, theTenant, status)) { if (status == kStatus9) - tenant->SetDrawMode(DrawMode2); + theTenant->SetDrawMode(DrawMode2); else - tenant->SetDrawMode(DrawMode1); + theTenant->SetDrawMode(DrawMode1); } - if (tenant->GetDrawMode() != DrawMode0) - towerDoc->mTowerMainView->tmv_vf128(tenant->mArea, false); + if (theTenant->GetDrawMode() != DrawMode0) + towerDoc->mTowerMainView->tmv_vf128(theTenant->mArea, false); return result; } diff --git a/src/T2DLL/T2TenantDef.h b/src/T2DLL/T2TenantDef.h index b0984f7..9f4b5e1 100644 --- a/src/T2DLL/T2TenantDef.h +++ b/src/T2DLL/T2TenantDef.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2EquipDef.h" -class AFX_EXT_CLASS T2TenantDef : public T2EquipDef { +class AFX_CLASS_EXPORT T2TenantDef : public T2EquipDef { public: T2TenantDef(DWORD, T2PluginSpecifier&, CResFile*, T2WorldDef*, T2TenantPlugin*); virtual ~T2TenantDef(); diff --git a/src/T2DLL/T2TenantInfoDialog.cpp b/src/T2DLL/T2TenantInfoDialog.cpp index cfe4621..f4ed236 100644 --- a/src/T2DLL/T2TenantInfoDialog.cpp +++ b/src/T2DLL/T2TenantInfoDialog.cpp @@ -1,3 +1,4 @@ +#include "T2Tenant.h" #include "T2TenantInfoDialog.h" T2TenantInfoDialog::T2TenantInfoDialog(T2Tenant* inTenant) diff --git a/src/T2DLL/T2TenantInfoDialog.h b/src/T2DLL/T2TenantInfoDialog.h index be11c0c..1e0c77f 100644 --- a/src/T2DLL/T2TenantInfoDialog.h +++ b/src/T2DLL/T2TenantInfoDialog.h @@ -1,10 +1,8 @@ #pragma once #include "common.h" #include "T2EquipInfoDialog.h" -#include "T2Tenant.h" -#include "T2TenantDef.h" -class AFX_EXT_CLASS T2TenantInfoDialog : public T2EquipInfoDialog { +class AFX_CLASS_EXPORT T2TenantInfoDialog : public T2EquipInfoDialog { public: T2TenantInfoDialog(T2Tenant* inTenant); virtual ~T2TenantInfoDialog(); diff --git a/src/T2DLL/T2TenantMemberDef.h b/src/T2DLL/T2TenantMemberDef.h index 431e830..02d0936 100644 --- a/src/T2DLL/T2TenantMemberDef.h +++ b/src/T2DLL/T2TenantMemberDef.h @@ -1,23 +1,23 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS T2TenantMemberDef { +class AFX_CLASS_EXPORT T2TenantMemberDef { public: T2TenantMemberDef(); virtual ~T2TenantMemberDef(); void Initialize(CResFile*, float); - int GetDemandType() const { return mDemandType; } - int GetStartSilhouetteType() const { return mStartSilhouetteType; } - int GetEndSilhouetteType() const { return mEndSilhouetteType; } - int GetOptionType() const { return mOptionType; } - unsigned int GetNumOfPeople() const { return mNumOfPeople; } - void SetNumOfPeople(unsigned int v) { mNumOfPeople = v; } - float GetRate() const { return mRate; } - void SetRate(float v) { mRate = v; } - void GetName(CString& outStr) const { outStr = mName; } - unsigned int GetPercent() const { return mPercent; } - void SetPercent(unsigned int v) { mPercent = v; } + int GetDemandType() const; + int GetStartSilhouetteType() const; + int GetEndSilhouetteType() const; + int GetOptionType() const; + unsigned int GetNumOfPeople() const; + void SetNumOfPeople(unsigned int v); + float GetRate() const; + void SetRate(float v); + void GetName(CString& outStr) const; + unsigned int GetPercent() const; + void SetPercent(unsigned int v); protected: char mName[16]; @@ -29,3 +29,47 @@ protected: unsigned int mNumOfPeople; float mRate; }; + +inline int T2TenantMemberDef::GetDemandType() const { + return mDemandType; +} + +inline int T2TenantMemberDef::GetStartSilhouetteType() const { + return mStartSilhouetteType; +} + +inline int T2TenantMemberDef::GetEndSilhouetteType() const { + return mEndSilhouetteType; +} + +inline int T2TenantMemberDef::GetOptionType() const { + return mOptionType; +} + +inline unsigned int T2TenantMemberDef::GetNumOfPeople() const { + return mNumOfPeople; +} + +inline void T2TenantMemberDef::SetNumOfPeople(unsigned int v) { + mNumOfPeople = v; +} + +inline float T2TenantMemberDef::GetRate() const { + return mRate; +} + +inline void T2TenantMemberDef::SetRate(float v) { + mRate = v; +} + +inline void T2TenantMemberDef::GetName(CString& outStr) const { + outStr = mName; +} + +inline unsigned int T2TenantMemberDef::GetPercent() const { + return mPercent; +} + +inline void T2TenantMemberDef::SetPercent(unsigned int v) { + mPercent = v; +} diff --git a/src/T2DLL/T2TenantMemberTableDef.cpp b/src/T2DLL/T2TenantMemberTableDef.cpp index 780ea02..10c0b82 100644 --- a/src/T2DLL/T2TenantMemberTableDef.cpp +++ b/src/T2DLL/T2TenantMemberTableDef.cpp @@ -125,21 +125,21 @@ BOOL T2TenantMemberTableDef::IsCollectFromPool(T2TowerDoc* towerDoc) const { BOOL result = true; if (mPlaceParamDef) { - float rate = mPlaceParamDef->GetRate(T2PlaceParamDef::Place_0); - if (UT2Utils::Float2Int(rate) == 0) + float theRate = mPlaceParamDef->GetRate(T2PlaceParamDef::Place_0); + if (UT2Utils::Float2Int(theRate) == 0) result = false; } if (result && mDayParamDef) { - T2DayParamDef::EDay day = T2DayParamDef::Day_0; - T2DayParamDef::EWhether whether = T2DayParamDef::Whether_0; + T2DayParamDef::EDay theDay = T2DayParamDef::Day_0; + T2DayParamDef::EWhether theWhether = T2DayParamDef::Whether_0; - T2DateTime *now = towerDoc->towerDoc_vf120(); - if (now->IsHoliday(towerDoc)) - day = T2DayParamDef::Day_1; + T2DateTime *theNow = towerDoc->towerDoc_vf120(); + if (theNow->IsHoliday(towerDoc)) + theDay = T2DayParamDef::Day_1; - float rate = mDayParamDef->GetRate(day, whether); - if (UT2Utils::Float2Int(rate) == 0) + float theRate = mDayParamDef->GetRate(theDay, theWhether); + if (UT2Utils::Float2Int(theRate) == 0) result = false; } @@ -157,49 +157,49 @@ BOOL T2TenantMemberTableDef::IsCollectFromTenant() const { } T2DayParamDef* T2TenantMemberTableDef::MakeDayParamDef(HINSTANCE instance, int resID) { - T2DayParamDef *result = NULL; + T2DayParamDef *theDef = NULL; CResFile resFile; if (resFile.OpenResource(instance, resID, 'DpDf')) { - result = new T2DayParamDef(resFile); + theDef = new T2DayParamDef(resFile); resFile.End(); } - return result; + return theDef; } T2DayParamDef* T2TenantMemberTableDef::MakeDayParamDef(const char* path, int resID) { - T2DayParamDef *result = NULL; + T2DayParamDef *theDef = NULL; CResFile resFile; if (resFile.OpenResource(path, resID, 'DPDF')) { - result = new T2DayParamDef(resFile); + theDef = new T2DayParamDef(resFile); resFile.End(); } - return result; + return theDef; } T2PlaceParamDef* T2TenantMemberTableDef::MakePlaceParamDef(HINSTANCE instance, int resID) { - T2PlaceParamDef *result = NULL; + T2PlaceParamDef *theDef = NULL; CResFile resFile; if (resFile.OpenResource(instance, resID, 'PlDf')) { - result = new T2PlaceParamDef(resFile); + theDef = new T2PlaceParamDef(resFile); resFile.End(); } - return result; + return theDef; } T2PlaceParamDef* T2TenantMemberTableDef::MakePlaceParamDef(const char* path, int resID) { - T2PlaceParamDef *result = NULL; + T2PlaceParamDef *theDef = NULL; CResFile resFile; if (resFile.OpenResource(path, resID, 'PLDF')) { - result = new T2PlaceParamDef(resFile); + theDef = new T2PlaceParamDef(resFile); resFile.End(); } - return result; + return theDef; } diff --git a/src/T2DLL/T2TenantMemberTableDef.h b/src/T2DLL/T2TenantMemberTableDef.h index 0a05bab..90edb2c 100644 --- a/src/T2DLL/T2TenantMemberTableDef.h +++ b/src/T2DLL/T2TenantMemberTableDef.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2PlaceParamDef.h" -class AFX_EXT_CLASS T2TenantMemberTableDef { +class AFX_CLASS_EXPORT T2TenantMemberTableDef { public: T2TenantMemberTableDef(HINSTANCE, CResFile*, float); T2TenantMemberTableDef(const char*, CResFile*, float); @@ -18,8 +18,8 @@ public: BOOL IsCollectFromPool(T2TowerDoc*) const; BOOL IsCollectFromTenant() const; - int GetNumOfElem() const { return mNumOfElem; } - unsigned int GetSpecialFlag() const { return mSpecialFlag; } + int GetNumOfElem() const; + unsigned int GetSpecialFlag() const; protected: T2DayParamDef* MakeDayParamDef(HINSTANCE, int); @@ -37,3 +37,11 @@ protected: int mNumOfElem; T2TenantMemberDef *mElem; }; + +inline int T2TenantMemberTableDef::GetNumOfElem() const { + return mNumOfElem; +} + +inline unsigned int T2TenantMemberTableDef::GetSpecialFlag() const { + return mSpecialFlag; +} diff --git a/src/T2DLL/T2TenantPlugin.cpp b/src/T2DLL/T2TenantPlugin.cpp index e642b84..e5c8082 100644 --- a/src/T2DLL/T2TenantPlugin.cpp +++ b/src/T2DLL/T2TenantPlugin.cpp @@ -25,14 +25,14 @@ DWORD T2TenantPlugin::GetShopPluginType() { typedef T2TemplatePlugin *(MSVC_STDCALL* ConstructTemplatePluginType) (T2PluginSpecifier *, CResFile *, T2WorldDef *, T2TenantPlugin *); void T2TenantPlugin::LoadT2TenantDef(T2WorldDef* worldDef) { - ConstructTemplatePluginType func = (ConstructTemplatePluginType) GetProcAddress((HMODULE) mModuleHandle, "ConstructTemplatePlugin"); + ConstructTemplatePluginType theFunc = (ConstructTemplatePluginType) GetProcAddress((HMODULE) mModuleHandle, "ConstructTemplatePlugin"); #line 41 - _ASSERT(func); + _ASSERT(theFunc); CResFile resFile; resFile.OpenResource(mModuleHandle, 1, 'TnDf'); - T2TemplatePlugin *plugin = func(&mSpecifier, &resFile, worldDef, this); + T2TemplatePlugin *theDef = theFunc(&mSpecifier, &resFile, worldDef, this); resFile.End(); - mTemplatePlugin = plugin; + mTemplatePlugin = theDef; } diff --git a/src/T2DLL/T2TenantPlugin.h b/src/T2DLL/T2TenantPlugin.h index ff9706c..3c7a3d7 100644 --- a/src/T2DLL/T2TenantPlugin.h +++ b/src/T2DLL/T2TenantPlugin.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2EquipPlugin.h" -class AFX_EXT_CLASS T2TenantPlugin : public T2EquipPlugin { +class AFX_CLASS_EXPORT T2TenantPlugin : public T2EquipPlugin { public: T2TenantPlugin(DWORD, T2PluginSpecifier&); virtual ~T2TenantPlugin(); diff --git a/src/T2DLL/T2Terrorist.cpp b/src/T2DLL/T2Terrorist.cpp index 0a082c6..9afd78d 100644 --- a/src/T2DLL/T2Terrorist.cpp +++ b/src/T2DLL/T2Terrorist.cpp @@ -6,8 +6,10 @@ #include "T2DateTime.h" #include "T2Dialog.h" #include "T2DlgItem.h" +#include "T2DLL.h" #include "T2EquipPtrList.h" #include "T2FInfoAreaIterator.h" +#include "T2FInfoPtIterator.h" #include "T2FireBurning.h" #include "T2FloorInfo.h" #include "T2FloorPtrList.h" diff --git a/src/T2DLL/T2Terrorist.h b/src/T2DLL/T2Terrorist.h index 87b5b51..2ea4032 100644 --- a/src/T2DLL/T2Terrorist.h +++ b/src/T2DLL/T2Terrorist.h @@ -9,7 +9,7 @@ enum { kTerroristStatus3 = 3, }; -class AFX_EXT_CLASS T2Terrorist : public T2EventItem { +class AFX_CLASS_EXPORT T2Terrorist : public T2EventItem { public: T2Terrorist(T2TowerEvent* inTowerEvent, CResFile* inResFile, int inSubID); virtual ~T2Terrorist(); diff --git a/src/T2DLL/T2ToolCallback.h b/src/T2DLL/T2ToolCallback.h index 3cde218..752bec5 100644 --- a/src/T2DLL/T2ToolCallback.h +++ b/src/T2DLL/T2ToolCallback.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS T2ToolCallback { +class AFX_CLASS_EXPORT T2ToolCallback { public: virtual void toolCallback_vf00(int unkParam1, int unkParam2) = 0; }; diff --git a/src/T2DLL/T2ToolDef.h b/src/T2DLL/T2ToolDef.h index 19caf2a..830dc92 100644 --- a/src/T2DLL/T2ToolDef.h +++ b/src/T2DLL/T2ToolDef.h @@ -30,7 +30,7 @@ enum { kTenantAttrIsNeedToilet = 0x2000000, }; -class AFX_EXT_CLASS T2ToolDef : public T2TemplatePlugin { +class AFX_CLASS_EXPORT T2ToolDef : public T2TemplatePlugin { public: T2ToolDef(DWORD type, T2PluginSpecifier& specifier, CResFile* resFile, T2WorldDef* worldDef, T2ToolPlugin* plugin); virtual ~T2ToolDef(); @@ -38,21 +38,55 @@ public: virtual BOOL IsMover() { return false; } virtual BOOL IsTenant() { return false; } virtual BOOL IsOutObj() { return false; } + + int GetToolNo() const { return mToolNo; } + int GetCategory() const { return mCategoryNo; } + int GetToolType() const { return mToolType; } + int IsSetAttribute(unsigned int a) const { return (mAttribute & a) != 0; } + DWORD GetSubPluginType() const { return mSubPluginType; } + unsigned int GetAttribute() const { return mAttribute; } + + T2BitImage* GetToolIcon() const { return mToolIcon; } + + void GetToolName(CString& outStr, int id) const { + outStr = *mName[id]; + } + + void GetCategoryName(CString outStr) const { + // BUG: outStr should be & + outStr = mCategoryName; + } + virtual int CalcPayment(T2TowerDoc*, RECT&, unsigned int id) { return mPrice[id]; } + virtual int RequierToolIcon(T2ToolWindow*) { return 0; } + virtual CURSORTYPE QueryCursor(T2TowerDoc*, POINT, CString&, RECT&, POINT&, int, unsigned int, int); + virtual unsigned int IdleProc(T2HaveOutViewObject*, T2TowerDoc*) { return 0; } + virtual void DefIdleProc(T2TowerDoc*) {} virtual void DrawProc(T2HaveOutViewObject*, const RECT&, T2TowerDoc*) const {} virtual PROCCODE DoDestructProc(T2TowerDoc*, T2HaveOutViewObject*, POINT, RECT&); virtual void DestructFinish(T2TowerDoc*, T2HaveOutViewObject*) {} + virtual int CalcMentenanceCostProc(const T2HaveOutViewObject*) const; + + int GetConsumptionPower(unsigned int id) { + return mConsumptionPower[id]; + } + int GetCurBuildCount() const { return mCurBuildCount; } + int GetMaxBuildCount() const { return mMaxBuildCount; } + int GetSettlement() const { return mSettlement; } + void DoStartUse() { mCurBuildCount++; } + void DoEndUse() { mCurBuildCount--; } + virtual void LoadExtraData(T2Archive&, T2TowerDoc*, T2HaveOutViewObject*) {} virtual void SaveExtraData(T2Archive&, T2HaveOutViewObject*) {} virtual void Add(T2AdvertisePlugin* plugin); @@ -60,6 +94,9 @@ public: virtual PROCCODE DrawHitMask(T2TowerDoc*, T2HaveOutViewObject*) { return ProcCode_0; } + + CFilePluginList* GetSubPluginList() { return mSubPluginList; } + virtual unsigned long OptionProc(unsigned long, void*) { return 0; } @@ -69,30 +106,6 @@ public: int GetOutMoney(unsigned int id) const; void SetOutMoney(unsigned int id, int money); - int GetToolNo() const { return mToolNo; } - int GetCategory() const { return mCategoryNo; } - int GetToolType() const { return mToolType; } - int IsSetAttribute(unsigned int a) const { return (mAttribute & a) != 0; } - DWORD GetSubPluginType() const { return mSubPluginType; } - unsigned int GetAttribute() const { return mAttribute; } - T2BitImage* GetToolIcon() const { return mToolIcon; } - void GetToolName(CString& outStr, int id) const { - outStr = *mName[id]; - } - void GetCategoryName(CString outStr) const { - // BUG: outStr should be & - outStr = mCategoryName; - } - int GetConsumptionPower(unsigned int id) { - return mConsumptionPower[id]; - } - int GetCurBuildCount() const { return mCurBuildCount; } - int GetMaxBuildCount() const { return mMaxBuildCount; } - int GetSettlement() const { return mSettlement; } - void DoStartUse() { mCurBuildCount++; } - void DoEndUse() { mCurBuildCount--; } - CFilePluginList* GetSubPluginList() { return mSubPluginList; } - protected: friend class T2Mover; friend class T2Settlement; diff --git a/src/T2DLL/T2ToolDefDB.cpp b/src/T2DLL/T2ToolDefDB.cpp new file mode 100644 index 0000000..0f12394 --- /dev/null +++ b/src/T2DLL/T2ToolDefDB.cpp @@ -0,0 +1,92 @@ +#include "T2ToolDef.h" +#include "T2ToolDefDB.h" +#include "T2ToolDefList.h" + +T2ToolDefDB::T2ToolDefDB() + : LArray(sizeof(T2ToolDefList *)) +{ +} + +/*virtual*/ T2ToolDefDB::~T2ToolDefDB() { +} + +void T2ToolDefDB::AllClear() { + RemoveItemsAt(mItemCount, 1); +} + +void T2ToolDefDB::Regist(T2ToolDef* inToolDef) { + if (!inToolDef) + return; + + int categoryNo = inToolDef->GetCategory(); + int n = 1; + LArrayIterator iterator(*this); + T2ToolDefList *theToolDefList; + BOOL added = false; + + while (!added && iterator.Next(&theToolDefList)) { + int thisCategory = theToolDefList->GetCategory(); + if (thisCategory == categoryNo) { + theToolDefList->Add(inToolDef); + added = true; + } else { + if (thisCategory > categoryNo) + break; + } + + n++; + } + + if (!added) { + theToolDefList = new T2ToolDefList(categoryNo); + theToolDefList->Add(inToolDef); + InsertItemsAt(1, n, &theToolDefList); + } +} + +void T2ToolDefDB::Add(T2ToolDefList* inToolDefList) { + LArrayIterator iterator(*this); + T2ToolDefList *theToolDefList; + BOOL added = false; + + while (!added && iterator.Next(&theToolDefList)) { + if (theToolDefList->GetCategory() == inToolDefList->GetCategory()) { + LArrayIterator toolDefIterator(*inToolDefList); + T2ToolDef *theToolDef; + + while (toolDefIterator.Next(&theToolDef)) + theToolDefList->Add(theToolDef); + + added = true; + } + } + + if (!added) + InsertItemsAt(1, mItemCount + 1, &inToolDefList); +} + +T2ToolDefList* T2ToolDefDB::GetToolDefList(int inCategory) { + LArrayIterator iterator(*this); + T2ToolDefList *theToolDefList; + + while (iterator.Next(&theToolDefList)) { + if (theToolDefList->GetCategory() == inCategory) + return theToolDefList; + } + + return NULL; +} + +T2TenantDef* T2ToolDefDB::FindFloor() { + LArrayIterator iterator(*this); + T2ToolDefList *theToolDefList; + T2TenantDef *theFloor = NULL; + + while (iterator.Next(&theToolDefList)) { + theFloor = theToolDefList->FindFloor(); + if (theFloor) + return theFloor; + } + + return NULL; +} diff --git a/src/T2DLL/T2ToolDefDB.h b/src/T2DLL/T2ToolDefDB.h new file mode 100644 index 0000000..cdc408e --- /dev/null +++ b/src/T2DLL/T2ToolDefDB.h @@ -0,0 +1,14 @@ +#pragma once +#include "common.h" +#include "LArray.h" + +class AFX_CLASS_EXPORT T2ToolDefDB : public LArray { +public: + T2ToolDefDB(); + virtual ~T2ToolDefDB(); + void AllClear(); + void Regist(T2ToolDef* inToolDef); + void Add(T2ToolDefList* inToolDefList); + T2ToolDefList* GetToolDefList(int inCategory); + T2TenantDef* FindFloor(); +}; diff --git a/src/T2DLL/T2ToolDefList.cpp b/src/T2DLL/T2ToolDefList.cpp index cb2e25b..cf359ce 100644 --- a/src/T2DLL/T2ToolDefList.cpp +++ b/src/T2DLL/T2ToolDefList.cpp @@ -3,97 +3,6 @@ #include "T2ToolDef.h" #include "T2ToolDefList.h" -T2ToolDefDB::T2ToolDefDB() - : LArray(sizeof(T2ToolDefList *)) -{ -} - -/*virtual*/ T2ToolDefDB::~T2ToolDefDB() { -} - -void T2ToolDefDB::AllClear() { - RemoveItemsAt(mItemCount, 1); -} - -void T2ToolDefDB::Regist(T2ToolDef* inToolDef) { - if (!inToolDef) - return; - - int categoryNo = inToolDef->GetCategory(); - int n = 1; - LArrayIterator iterator(*this); - T2ToolDefList *theToolDefList; - BOOL added = false; - - while (!added && iterator.Next(&theToolDefList)) { - int thisCategory = theToolDefList->GetCategory(); - if (thisCategory == categoryNo) { - theToolDefList->Add(inToolDef); - added = true; - } else { - if (thisCategory > categoryNo) - break; - } - - n++; - } - - if (!added) { - theToolDefList = new T2ToolDefList(categoryNo); - theToolDefList->Add(inToolDef); - InsertItemsAt(1, n, &theToolDefList); - } -} - -void T2ToolDefDB::Add(T2ToolDefList* inToolDefList) { - LArrayIterator iterator(*this); - T2ToolDefList *theToolDefList; - BOOL added = false; - - while (!added && iterator.Next(&theToolDefList)) { - if (theToolDefList->GetCategory() == inToolDefList->GetCategory()) { - LArrayIterator toolDefIterator(*inToolDefList); - T2ToolDef *theToolDef; - - while (toolDefIterator.Next(&theToolDef)) - theToolDefList->Add(theToolDef); - - added = true; - } - } - - if (!added) - InsertItemsAt(1, mItemCount + 1, &inToolDefList); -} - -T2ToolDefList* T2ToolDefDB::GetToolDefList(int inCategory) { - LArrayIterator iterator(*this); - T2ToolDefList *theToolDefList; - - while (iterator.Next(&theToolDefList)) { - if (theToolDefList->GetCategory() == inCategory) - return theToolDefList; - } - - return NULL; -} - -T2TenantDef* T2ToolDefDB::FindFloor() { - LArrayIterator iterator(*this); - T2ToolDefList *theToolDefList; - T2TenantDef *theFloor = NULL; - - while (iterator.Next(&theToolDefList)) { - theFloor = theToolDefList->FindFloor(); - if (theFloor) - return theFloor; - } - - return NULL; -} - - - T2ToolDefList::T2ToolDefList(int inCategory) : LArray(sizeof(T2TemplatePlugin *)) { diff --git a/src/T2DLL/T2ToolDefList.h b/src/T2DLL/T2ToolDefList.h index faa8bf3..92b4425 100644 --- a/src/T2DLL/T2ToolDefList.h +++ b/src/T2DLL/T2ToolDefList.h @@ -2,18 +2,7 @@ #include "common.h" #include "LArray.h" -class AFX_EXT_CLASS T2ToolDefDB : public LArray { -public: - T2ToolDefDB(); - virtual ~T2ToolDefDB(); - void AllClear(); - void Regist(T2ToolDef* inToolDef); - void Add(T2ToolDefList* inToolDefList); - T2ToolDefList* GetToolDefList(int inCategory); - T2TenantDef* FindFloor(); -}; - -class AFX_EXT_CLASS T2ToolDefList : public LArray { +class AFX_CLASS_EXPORT T2ToolDefList : public LArray { public: T2ToolDefList(int inCategory); virtual ~T2ToolDefList(); diff --git a/src/T2DLL/T2ToolHelpWnd.cpp b/src/T2DLL/T2ToolHelpWnd.cpp index 19b53a9..c730a2a 100644 --- a/src/T2DLL/T2ToolHelpWnd.cpp +++ b/src/T2DLL/T2ToolHelpWnd.cpp @@ -1,11 +1,14 @@ #include "T2ToolDef.h" #include "T2ToolHelpWnd.h" -CObject* PASCAL T2ToolHelpWnd::CreateObject() { +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + #line 20 - return DEBUG_NEW T2ToolHelpWnd; -} -IMPLEMENT_DYNAMIC(T2ToolHelpWnd, CFrameWnd); +IMPLEMENT_DYNCREATE(T2ToolHelpWnd, CFrameWnd); T2ToolHelpWnd::T2ToolHelpWnd() { mVisible = false; diff --git a/src/T2DLL/T2ToolHelpWnd.h b/src/T2DLL/T2ToolHelpWnd.h index c598b2d..b8266fd 100644 --- a/src/T2DLL/T2ToolHelpWnd.h +++ b/src/T2DLL/T2ToolHelpWnd.h @@ -7,7 +7,7 @@ enum { kToolHelpMode2 = 2 }; -class AFX_EXT_CLASS T2ToolHelpWnd : public CFrameWnd { +class AFX_CLASS_EXPORT T2ToolHelpWnd : public CFrameWnd { DECLARE_DYNCREATE(T2ToolHelpWnd) DECLARE_MESSAGE_MAP() public: diff --git a/src/T2DLL/T2ToolPlugin.h b/src/T2DLL/T2ToolPlugin.h index c1fc7b8..3b0a3a0 100644 --- a/src/T2DLL/T2ToolPlugin.h +++ b/src/T2DLL/T2ToolPlugin.h @@ -2,7 +2,7 @@ #include "common.h" #include "CProgramPlugin.h" -class AFX_EXT_CLASS T2ToolPlugin : public CProgramPlugin { +class AFX_CLASS_EXPORT T2ToolPlugin : public CProgramPlugin { public: T2ToolPlugin(DWORD type, T2PluginSpecifier& specifier); virtual ~T2ToolPlugin(); diff --git a/src/T2DLL/T2ToolWindow.cpp b/src/T2DLL/T2ToolWindow.cpp index 08ade6c..346f1e8 100644 --- a/src/T2DLL/T2ToolWindow.cpp +++ b/src/T2DLL/T2ToolWindow.cpp @@ -1,5 +1,5 @@ #include "CT2App.h" -#include "GlobalFunc.h" +#include "T2DLL.h" #include "T2ImageObj.h" #include "T2MainWindow.h" #include "T2TemplatePluginList.h" @@ -8,15 +8,18 @@ #include "T2TowerDoc.h" #include "T2WorldDef.h" -CObject* PASCAL T2ToolWindow::CreateObject() { +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + #line 16 - return DEBUG_NEW T2ToolWindow; -} -IMPLEMENT_DYNAMIC(T2ToolWindow, CFrameWnd); +IMPLEMENT_DYNCREATE(T2ToolWindow, CFrameWnd); T2ToolWindow::T2ToolWindow() { #line 20 - mToolIconList = DEBUG_NEW T2ToolIconList; + mToolIconList = new T2ToolIconList; mDocument = NULL; mWorldDef = NULL; @@ -48,6 +51,7 @@ BEGIN_MESSAGE_MAP(T2ToolWindow, CFrameWnd) ON_WM_MOUSEMOVE() ON_WM_LBUTTONDBLCLK() ON_WM_TIMER() + ON_WM_SIZE() ON_WM_DESTROY() ON_WM_CLOSE() END_MESSAGE_MAP() @@ -125,7 +129,7 @@ afx_msg int T2ToolWindow::OnCreate(LPCREATESTRUCT lpCreateStruct) { } #line 145 - T2ToolIconItem *theItem = DEBUG_NEW T2ToolIconItem; + T2ToolIconItem *theItem = new T2ToolIconItem; theItem->mID = AssignNewID(); theItem->mName = inName; theItem->mValiation = inValiation; @@ -179,7 +183,7 @@ afx_msg int T2ToolWindow::OnCreate(LPCREATESTRUCT lpCreateStruct) { /*virtual*/ void T2ToolWindow::RemoveAll() { delete mToolIconList; #line 204 - mToolIconList = DEBUG_NEW T2ToolIconList; + mToolIconList = new T2ToolIconList; ListUpdated(); SelChange(1); @@ -555,7 +559,7 @@ afx_msg void T2ToolWindow::OnDestroy() { ); #line 615 - mListCtrl = DEBUG_NEW CListCtrl; + mListCtrl = new CListCtrl; mListCtrl->Create( LVS_REPORT | LVS_SINGLESEL | WS_VSCROLL | WS_VISIBLE | WS_CHILD, diff --git a/src/T2DLL/T2ToolWindow.h b/src/T2DLL/T2ToolWindow.h index b90aa6c..7536377 100644 --- a/src/T2DLL/T2ToolWindow.h +++ b/src/T2DLL/T2ToolWindow.h @@ -3,7 +3,7 @@ class T2ToolIconItem; -class AFX_EXT_CLASS T2ToolWindow : public CFrameWnd { +class AFX_CLASS_EXPORT T2ToolWindow : public CFrameWnd { DECLARE_DYNCREATE(T2ToolWindow) DECLARE_MESSAGE_MAP() public: @@ -73,7 +73,7 @@ protected: CListCtrl *mListCtrl; }; -class AFX_EXT_CLASS T2ToolIconItem { +class AFX_CLASS_EXPORT T2ToolIconItem { public: T2ToolIconItem(); virtual ~T2ToolIconItem(); @@ -93,7 +93,7 @@ public: T2ToolDef *mToolDef; }; -class AFX_EXT_CLASS T2ToolIconList : public CList<T2ToolIconItem *, T2ToolIconItem *> { +class AFX_CLASS_EXPORT T2ToolIconList : public CList<T2ToolIconItem *, T2ToolIconItem *> { public: T2ToolIconList(); virtual ~T2ToolIconList(); diff --git a/src/T2DLL/T2TowerEvent.h b/src/T2DLL/T2TowerEvent.h index becce7d..d69d128 100644 --- a/src/T2DLL/T2TowerEvent.h +++ b/src/T2DLL/T2TowerEvent.h @@ -2,7 +2,7 @@ #include "common.h" #include "LArray.h" -class AFX_EXT_CLASS T2TowerEvent { +class AFX_CLASS_EXPORT T2TowerEvent { public: T2TowerEvent(T2WorldDef* inWorldDef); ~T2TowerEvent(); diff --git a/src/T2DLL/T2TowerMessage.cpp b/src/T2DLL/T2TowerMessage.cpp index 0f6e7a7..c99ac63 100644 --- a/src/T2DLL/T2TowerMessage.cpp +++ b/src/T2DLL/T2TowerMessage.cpp @@ -1,6 +1,7 @@ #include "GlobalFunc.h" #include "LArray.h" #include "T2Balloon.h" +#include "T2DLL.h" #include "T2Equip.h" #include "T2EquipDef.h" #include "T2Message.h" diff --git a/src/T2DLL/T2TowerMessage.h b/src/T2DLL/T2TowerMessage.h index 434ff5b..67d40ad 100644 --- a/src/T2DLL/T2TowerMessage.h +++ b/src/T2DLL/T2TowerMessage.h @@ -11,7 +11,7 @@ enum { kAlertType3 = 3 }; -class AFX_EXT_CLASS T2TowerMessage : public LAttachment { +class AFX_CLASS_EXPORT T2TowerMessage : public LAttachment { public: T2TowerMessage(HINSTANCE inModuleHandle, T2TowerDoc* inDoc); virtual ~T2TowerMessage(); diff --git a/src/T2DLL/T2TowerVision.h b/src/T2DLL/T2TowerVision.h index 2fc44b2..3af5e4b 100644 --- a/src/T2DLL/T2TowerVision.h +++ b/src/T2DLL/T2TowerVision.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2EventItem.h" -class AFX_EXT_CLASS T2TowerVision : public T2EventItem { +class AFX_CLASS_EXPORT T2TowerVision : public T2EventItem { public: T2TowerVision(T2TowerEvent* inTowerEvent, int inSubID, int inLevelBit, BOOL inExclusive, int inCycleDay, int inBeginTime, int inEndTime, T2OutObj *inOutObj); virtual ~T2TowerVision(); diff --git a/src/T2DLL/T2TrafficInfo.h b/src/T2DLL/T2TrafficInfo.h index 422a709..2e83f31 100644 --- a/src/T2DLL/T2TrafficInfo.h +++ b/src/T2DLL/T2TrafficInfo.h @@ -7,7 +7,7 @@ struct T2TrafficUnit { short range; }; -class AFX_EXT_CLASS T2TrafficInfo { +class AFX_CLASS_EXPORT T2TrafficInfo { public: T2TrafficInfo(RECT inArea, unsigned int inA, unsigned int inB, unsigned int inC, unsigned int inUnitSize); virtual ~T2TrafficInfo(); diff --git a/src/T2DLL/T2Transport.h b/src/T2DLL/T2Transport.h index b1e0640..6ba96d5 100644 --- a/src/T2DLL/T2Transport.h +++ b/src/T2DLL/T2Transport.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS T2Transport { +class AFX_CLASS_EXPORT T2Transport { public: T2Transport(); virtual ~T2Transport(); diff --git a/src/T2DLL/T2TreasureDialog.cpp b/src/T2DLL/T2TreasureDialog.cpp index 55e27ec..74bee65 100644 --- a/src/T2DLL/T2TreasureDialog.cpp +++ b/src/T2DLL/T2TreasureDialog.cpp @@ -16,7 +16,7 @@ T2TreasureDialog::T2TreasureDialog() { } /*virtual*/ void T2TreasureDialog::CreateDlgItem(CTokenizer& inTokenizer, T2DialogDef& inDef) { - if (!_stricmp(inTokenizer.Current(), "ANIM")) { + if (!_stricmp(inTokenizer.Current(), "TRPN")) { RECT rect; UINT id = inTokenizer.NextInteger(); rect.left = inTokenizer.NextInteger(); diff --git a/src/T2DLL/T2TreasureDialog.h b/src/T2DLL/T2TreasureDialog.h index b0fb3fe..d7f7dbe 100644 --- a/src/T2DLL/T2TreasureDialog.h +++ b/src/T2DLL/T2TreasureDialog.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2Dialog.h" -class AFX_EXT_CLASS T2TreasureDialog : public T2Dialog { +class AFX_CLASS_EXPORT T2TreasureDialog : public T2Dialog { public: T2TreasureDialog(); virtual ~T2TreasureDialog(); diff --git a/src/T2DLL/T2TreasurePane.h b/src/T2DLL/T2TreasurePane.h index 1101c82..1916e97 100644 --- a/src/T2DLL/T2TreasurePane.h +++ b/src/T2DLL/T2TreasurePane.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2DlgItem.h" -class AFX_EXT_CLASS T2TreasurePane : public T2DlgItem { +class AFX_CLASS_EXPORT T2TreasurePane : public T2DlgItem { public: T2TreasurePane(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); virtual ~T2TreasurePane(); diff --git a/src/T2DLL/T2UnitInfo.h b/src/T2DLL/T2UnitInfo.h index 11242f0..df3549b 100644 --- a/src/T2DLL/T2UnitInfo.h +++ b/src/T2DLL/T2UnitInfo.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS T2UnitInfo { +class AFX_CLASS_EXPORT T2UnitInfo { public: T2UnitInfo(); ~T2UnitInfo(); diff --git a/src/T2DLL/T2VerticalTable.h b/src/T2DLL/T2VerticalTable.h index 2bf1512..ac8cccc 100644 --- a/src/T2DLL/T2VerticalTable.h +++ b/src/T2DLL/T2VerticalTable.h @@ -2,7 +2,7 @@ #include "common.h" #include "T2DlgItemImageTable.h" -class AFX_EXT_CLASS T2VerticalTable : public T2DlgItemImageTable { +class AFX_CLASS_EXPORT T2VerticalTable : public T2DlgItemImageTable { public: T2VerticalTable(T2TowerDoc* towerDoc, T2ImageObj* imageObj, CPalette* palette); void Clear(); diff --git a/src/T2DLL/T2VisitVIP.cpp b/src/T2DLL/T2VisitVIP.cpp index caeba5f..c411321 100644 --- a/src/T2DLL/T2VisitVIP.cpp +++ b/src/T2DLL/T2VisitVIP.cpp @@ -5,6 +5,7 @@ #include "GlobalFunc.h" #include "T2Archive.h" #include "T2DateTime.h" +#include "T2DLL.h" #include "T2EquipPtrList.h" #include "T2FloorInfo.h" #include "T2Name.h" diff --git a/src/T2DLL/T2VisitVIP.h b/src/T2DLL/T2VisitVIP.h index b2510b5..5faae54 100644 --- a/src/T2DLL/T2VisitVIP.h +++ b/src/T2DLL/T2VisitVIP.h @@ -12,7 +12,7 @@ enum { kVisitVIPStatus6 = 6, }; -class AFX_EXT_CLASS T2VisitVIP : public T2EventItem { +class AFX_CLASS_EXPORT T2VisitVIP : public T2EventItem { public: T2VisitVIP(T2TowerEvent* inTowerEvent, CResFile* inResFile, int inSubID); T2VisitVIP(T2TowerEvent* inTowerEvent, int inSubID, int inLevelBit, BOOL inExclusive, int inCycleDay, int inBeginTime, int inEndTime); diff --git a/src/T2DLL/T2WeatherFilter.h b/src/T2DLL/T2WeatherFilter.h index a1213c2..bcf8596 100644 --- a/src/T2DLL/T2WeatherFilter.h +++ b/src/T2DLL/T2WeatherFilter.h @@ -8,7 +8,7 @@ enum WeatherCode { WeatherCode_3 }; -class AFX_EXT_CLASS T2WeatherFilter { +class AFX_CLASS_EXPORT T2WeatherFilter { public: T2WeatherFilter(); ~T2WeatherFilter(); diff --git a/src/T2DLL/T2WordDef.h b/src/T2DLL/T2WordDef.h index e6084ae..6dc69b0 100644 --- a/src/T2DLL/T2WordDef.h +++ b/src/T2DLL/T2WordDef.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS T2WordDef { +class AFX_CLASS_EXPORT T2WordDef { public: T2WordDef(); void Read(CResFile&); diff --git a/src/T2DLL/T2WordDefArray.cpp b/src/T2DLL/T2WordDefArray.cpp index 76b3248..46f05d2 100644 --- a/src/T2DLL/T2WordDefArray.cpp +++ b/src/T2DLL/T2WordDefArray.cpp @@ -15,35 +15,35 @@ void T2WordDefArray::GetWords(unsigned int sex, unsigned int age, unsigned int f CResFile resFile; if (resFile.OpenResource(mInstance, 1, 'WoDf')) { - unsigned int numOfWordDef; - resFile >> numOfWordDef; + unsigned int numOfWordDefs; + resFile >> numOfWordDefs; - T2WordDef *wordDef = new T2WordDef[numOfWordDef]; + T2WordDef *theWordDef = new T2WordDef[numOfWordDefs]; - for (unsigned int i = 0; i < numOfWordDef; i++) - wordDef[i].Read(resFile); + for (unsigned int i = 0; i < numOfWordDefs; i++) + theWordDef[i].Read(resFile); - if (numOfWordDef > 0) { - unsigned char *seen = (unsigned char *) malloc(numOfWordDef); - memset(seen, 0, numOfWordDef); + if (numOfWordDefs > 0) { + unsigned char *seenArray = (unsigned char *) malloc(numOfWordDefs); + memset(seenArray, 0, numOfWordDefs); - unsigned int i = 0; - while ((outStr == "") && i < numOfWordDef) { - int rnd = UT2Utils::Randomize(numOfWordDef); - if (!seen[rnd]) { - seen[rnd] = true; - wordDef[rnd].GetWords(sex, age, flags, level, outStr); + unsigned int i = 0, wordInd; + while ((outStr == "") && i < numOfWordDefs) { + wordInd = UT2Utils::Randomize(numOfWordDefs); + if (!seenArray[wordInd]) { + seenArray[wordInd] = true; + theWordDef[wordInd].GetWords(sex, age, flags, level, outStr); } else { - for (i = 0; i < numOfWordDef; i++) { - if (!seen[i]) + for (i = 0; i < numOfWordDefs; i++) { + if (!seenArray[i]) break; } } } - free(seen); + free(seenArray); } - delete[] wordDef; + delete[] theWordDef; } } diff --git a/src/T2DLL/T2WordDefArray.h b/src/T2DLL/T2WordDefArray.h index e37bd5b..415c0d0 100644 --- a/src/T2DLL/T2WordDefArray.h +++ b/src/T2DLL/T2WordDefArray.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class T2WordDefArray { +class AFX_CLASS_EXPORT T2WordDefArray { public: T2WordDefArray(HINSTANCE instance); virtual ~T2WordDefArray(); diff --git a/src/T2DLL/T2WorldDef.h b/src/T2DLL/T2WorldDef.h index d1e9092..6aa3ee6 100644 --- a/src/T2DLL/T2WorldDef.h +++ b/src/T2DLL/T2WorldDef.h @@ -13,19 +13,29 @@ struct GradeDef { int m14; // grade up animation start frame }; -class AFX_EXT_CLASS T2WorldDef : public T2TemplatePlugin { +class AFX_CLASS_EXPORT T2WorldDef : public T2TemplatePlugin { public: T2WorldDef(DWORD inType, T2PluginSpecifier& inSpecifier, CResFile* inResFile, T2WorldPlugin* inPlugin); public: virtual ~T2WorldDef(); virtual void GetName(CString& outStr); virtual int GetSortKey() { return mWorldType; } + CPalette* GetPalette() { return GetPaletteAnimeDef()->GetTowerPalette(); } + BOOL IsUseMatterObject() const { return false; } + int GetOutViewKind() const { return mOutViewKind; } + T2PaletteAnimeDef* GetPaletteAnimeDef() const { return mPaletteAnimeDef; } + T2SeasonParamDef* GetSeasonParamDef() const { return mSeasonParamDef; } virtual int GetInitialFunds() const { return mInitialFunds; } + int GetHeight() const { return mHeight; } + int GetWidth() const { return mWidth; } + void GetBuildArea(RECT& rect) const { rect = mBuildArea; } virtual BOOL IsHoliday(T2DateTime* inDateTime) const { return false; } virtual BOOL IsRainyDay(T2DateTime* inDateTime) const { return false; } - virtual int ExchangeMoney(int v) const { - return (mMoneyNumerator == 1 && mMoneyDenominator == 1) ? v : ((v / mMoneyDenominator) * mMoneyNumerator); - } + BOOL IsStoppableFloor(int y) { + return !((y >= (mGroundLine - mLobbyHeight) && y < (mGroundLine - 1))); + } + int GetLobbyHeight() { return mLobbyHeight; } + virtual int ExchangeMoney(int v) const; virtual void DrawWorld(T2TowerDoc* inDoc); virtual void DoAnimate(T2TowerDoc* inDoc); virtual void DrawBkgnd(const RECT& inRect, T2TowerDoc* inDoc); @@ -39,6 +49,7 @@ public: virtual void DrawCrane(T2TowerDoc* inDoc, const RECT& inRect); virtual const char* GetMoneyUnit() { return mMoneyUnit; } virtual T2EventItem* MakeXEvent(T2TowerEvent* inTowerEvent, CResFile*, unsigned long, int); + T2Maru_Reggae* GetReggae() { return NULL; } virtual T2Transport* GetCruise(T2TowerEvent* inTowerEvent) { return NULL; } virtual void InitializeBkgndInfo(BkgndInfo* inBkgndInfoPtr); virtual void InitializeFloorInfo(T2FloorInfo* inFloorInfo); @@ -59,8 +70,8 @@ public: virtual void ViewModeChanged(T2TowerDoc* inDoc, VIEWMODE); virtual void ReplaceSkyOffscreen(int inResID); virtual BOOL3 ChangeFastSEProc(T2PaletteAnime* inPaletteAnime) { return BOOL3_NEG1; } + virtual BOOL3 ChangeSEProc(T2PaletteAnime* inPaletteAnime) { return BOOL3_NEG1; } virtual BOOL3 ChangeFastSEProc(T2PaletteAnime* inPaletteAnime, T2DateTime* inDateTime) { return BOOL3_NEG1; } - virtual BOOL3 ChangeSEProc(T2PaletteAnime* inPaletteAnime) { return BOOL3_NEG1; } virtual BOOL3 ChangeSkyColorProc(T2PaletteAnime* inPaletteAnime) { return BOOL3_NEG1; } virtual BOOL3 AdjustSkyStateProc(T2PaletteAnime* inPaletteAnime, T2DateTime* inDateTime) { return BOOL3_NEG1; } virtual BOOL UseOwnSkyPaletteFunction() { return false; } @@ -68,7 +79,10 @@ public: virtual void WriteStatisticsProc(T2TowerDoc* inDoc, T2Archive& inArchive); virtual void ReadStatisticsProc(T2TowerDoc* inDoc, T2Archive& inArchive); virtual BOOL CheckTreasure(T2TowerDoc* inDoc, T2TreasureStatus* inTreasureStatus); - virtual unsigned long OptionProc(unsigned long, void*) { return 0; } + int GetCashAmount(int i) const { + return (i >= 0 && i < 8) ? mCashAmount[i] : 0; + } + virtual unsigned long OptionProc(unsigned long, void*) { return 0; } unsigned int GetToiletDenomi(unsigned int inVal) const; unsigned int GetColdDenomi(unsigned int inVal1, unsigned int inVal2) const; @@ -86,23 +100,6 @@ public: T2BlackOut* GetBlackOut(); BOOL IsBlackOut(); - CPalette* GetPalette() { return GetPaletteAnimeDef()->GetTowerPalette(); } - BOOL IsUseMatterObject() const { return false; } - int GetOutViewKind() const { return mOutViewKind; } - T2PaletteAnimeDef* GetPaletteAnimeDef() const { return mPaletteAnimeDef; } - T2SeasonParamDef* GetSeasonParamDef() const { return mSeasonParamDef; } - int GetHeight() const { return mHeight; } - int GetWidth() const { return mWidth; } - void GetBuildArea(RECT& rect) const { rect = mBuildArea; } - BOOL IsStoppableFloor(int y) { - return !((y >= (mGroundLine - mLobbyHeight) && y < (mGroundLine - 1))); - } - int GetLobbyHeight() { return mLobbyHeight; } - T2Maru_Reggae* GetReggae() { return NULL; } - int GetCashAmount(int i) const { - return (i >= 0 && i < 8) ? mCashAmount[i] : 0; - } - protected: virtual void DrawClock(T2MWControl* inControl, T2DateTime& inDateTime); virtual void DrawCalendar(T2MWControl* inControl, T2DateTime& inDateTime, T2TowerDoc* inDoc); @@ -226,3 +223,7 @@ protected: CString mMoneyUnit; T2TowerEvent *mTowerEvent; }; + +inline /*virtual*/ int T2WorldDef::ExchangeMoney(int v) const { + return (mMoneyNumerator == 1 && mMoneyDenominator == 1) ? v : ((v / mMoneyDenominator) * mMoneyNumerator); +} diff --git a/src/T2DLL/T2WorldPlugin.h b/src/T2DLL/T2WorldPlugin.h index a778481..1db1bea 100644 --- a/src/T2DLL/T2WorldPlugin.h +++ b/src/T2DLL/T2WorldPlugin.h @@ -2,10 +2,13 @@ #include "common.h" #include "CProgramPlugin.h" -class AFX_EXT_CLASS T2WorldPlugin : public CProgramPlugin { +class AFX_CLASS_EXPORT T2WorldPlugin : public CProgramPlugin { public: T2WorldPlugin(DWORD inType, T2PluginSpecifier& inSpecifier); virtual ~T2WorldPlugin(); + + int GetNumOfClockStyle() { return mNumOfClockStyle; } + virtual T2WorldDef* LoadT2WorldDef(); virtual BOOL LoadAllTemplatePlugin(T2WorldDef* inWorldDef, T2TemplatePluginDB* inDB); virtual void InitFloorInfoProc(T2WorldDef* inWorldDef, T2FloorInfo& inFloorInfo); @@ -26,8 +29,6 @@ public: virtual void XEventRead(T2XEvent* inXEvent, T2Archive& inArchive); virtual int XEventDlgHook(T2XEvent* inXEvent, T2TowerDoc* inDoc, T2EventDialog*, unsigned int inResult) { return inResult; } - int GetNumOfClockStyle() { return mNumOfClockStyle; } - protected: void _DrawClock(CWnd*, unsigned int); void _DrawCalendar(CWnd*, unsigned int); diff --git a/src/T2DLL/T2XEvent.h b/src/T2DLL/T2XEvent.h index e556aaa..b61a545 100644 --- a/src/T2DLL/T2XEvent.h +++ b/src/T2DLL/T2XEvent.h @@ -3,7 +3,7 @@ #include "LArray.h" #include "T2EventItem.h" -class AFX_EXT_CLASS T2XEvent : public T2EventItem { +class AFX_CLASS_EXPORT T2XEvent : public T2EventItem { public: T2XEvent(T2TowerEvent* inTowerEvent, CResFile* inResFile, DWORD inID, int inSubID); T2XEvent(T2XEvent* inXEvent, int inSubID); diff --git a/src/T2DLL/TenantSearchDlg.cpp b/src/T2DLL/TenantSearchDlg.cpp index 5ff4c03..b0845c0 100644 --- a/src/T2DLL/TenantSearchDlg.cpp +++ b/src/T2DLL/TenantSearchDlg.cpp @@ -9,6 +9,12 @@ #include "TenantSearchDlg.h" #include "UT2Utils.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + TenantSearchDlg::TenantSearchDlg() { mDeleteOnClose = true; } @@ -29,71 +35,71 @@ void TenantSearchDlg::Create(T2TowerDoc *inDoc, HINSTANCE inInstance, CWnd *inPa } void TenantSearchDlg::DoFind() { - T2DlgItemListBox *theListBox = (T2DlgItemListBox *) GetDlgItem(1000); - if (!theListBox) + T2DlgItemListBox *listBox = (T2DlgItemListBox *) GetDlgItem(1000); + if (!listBox) return; - int curSel = theListBox->GetCurSel(); - if (curSel == -1) + int sel = listBox->GetCurSel(); + if (sel == -1) return; - T2Name *theName = (T2Name *) theListBox->GetItemDataPtr(curSel); + T2Name *theName = (T2Name *) listBox->GetItemDataPtr(sel); mDocument->towerDoc_vf238(theName); } void TenantSearchDlg::DoDelete() { - T2DlgItemListBox *theListBox = (T2DlgItemListBox *) GetDlgItem(1000); - if (!theListBox) + T2DlgItemListBox *listBox = (T2DlgItemListBox *) GetDlgItem(1000); + if (!listBox) return; - int curSel = theListBox->GetCurSel(); - if (curSel == -1) + int sel = listBox->GetCurSel(); + if (sel == -1) return; - T2Name *theName = (T2Name *) theListBox->GetItemDataPtr(curSel); + T2Name *theName = (T2Name *) listBox->GetItemDataPtr(sel); mDocument->mNameDB->RemoveName(theName); - theListBox->DeleteString(curSel); + listBox->DeleteString(sel); } /*virtual*/ void TenantSearchDlg::OnT2Create() { - T2DlgItemListBox *theListBox = (T2DlgItemListBox *) GetDlgItem(1000); - T2TenantArrayList *theList = mDocument->mFloorInfo->GetTenantArrayList(); + T2DlgItemListBox *listBox = (T2DlgItemListBox *) GetDlgItem(1000); + T2TenantArrayList *theTenantArrayList = mDocument->mFloorInfo->GetTenantArrayList(); - if (!theListBox) + if (!listBox) return; - if (!theList) + if (!theTenantArrayList) return; HFONT theFont = GetFont(); if (theFont) - theListBox->SetFont(theFont); + listBox->SetFont(theFont); - theListBox->ResetContent(); + listBox->ResetContent(); - T2NameList *theNameDB = mDocument->mNameDB; + T2NameList *theNameList = mDocument->mNameDB; T2Name *theName; - LArrayIterator iterator(*theNameDB); + LArrayIterator iter(*theNameList); - while (iterator.Next(&theName)) { + while (iter.Next(&theName)) { int type = theName->GetType(); if (type == kTenantNameType) { - CString nameStr; - unsigned int tenantID; - theName->GetName(nameStr, tenantID); + CString name; + unsigned int id; + theName->GetName(name, id); - CString str; - CString roomNumberStr; + CString text; + CString roomNum; - T2Tenant *theTenant = theList->GetTenantByID(tenantID); + T2Tenant *theTenant = theTenantArrayList->GetTenantByID(id); if (theTenant) - UT2Utils::GetRoomNumberString(theTenant->GetRoomNumber(mDocument->mFloorInfo), roomNumberStr); + UT2Utils::GetRoomNumberString(theTenant->GetRoomNumber(mDocument->mFloorInfo), roomNum); - roomNumberStr += " "; - str = roomNumberStr.Left(7); - str += nameStr; + roomNum += " "; + text = roomNum.Left(7); + text += name; - int theIndex = theListBox->AddString(str); - theListBox->SetItemDataPtr(theIndex, theName); + int ind = listBox->AddString(text); + listBox->SetItemDataPtr(ind, theName); } } } diff --git a/src/T2DLL/UPoint.h b/src/T2DLL/UPoint.h index dd4c619..544b257 100644 --- a/src/T2DLL/UPoint.h +++ b/src/T2DLL/UPoint.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS UPoint { +class AFX_CLASS_EXPORT UPoint { public: static void MappingInRect(Point& ioPt, const RECT& inRect); static void MappingInRect(POINT& ioPt, const RECT& inRect); diff --git a/src/T2DLL/URect.cpp b/src/T2DLL/URect.cpp index ad2b552..0bf07c6 100644 --- a/src/T2DLL/URect.cpp +++ b/src/T2DLL/URect.cpp @@ -28,15 +28,15 @@ ioRect.bottom = ioRect.top + height2; } -/*static*/ int URect::Width(const RECT& inRect) { +inline /*static*/ int URect::Width(const RECT& inRect) { return inRect.right - inRect.left; } -/*static*/ int URect::Height(const RECT& inRect) { +inline /*static*/ int URect::Height(const RECT& inRect) { return inRect.bottom - inRect.top; } -/*static*/ void URect::Union(const RECT& inRect1, const RECT& inRect2, RECT& outRect) { +inline /*static*/ void URect::Union(const RECT& inRect1, const RECT& inRect2, RECT& outRect) { if (::IsRectEmpty(&inRect1)) { outRect = inRect2; } else if (::IsRectEmpty(&inRect2)) { @@ -48,7 +48,7 @@ } } -/*static*/ POINT URect::Center(const RECT& inRect) { +inline /*static*/ POINT URect::Center(const RECT& inRect) { POINT pt; pt.x = (inRect.left + inRect.right) / 2; pt.y = (inRect.top + inRect.bottom) / 2; diff --git a/src/T2DLL/URect.h b/src/T2DLL/URect.h index f2fdaaa..7badbd4 100644 --- a/src/T2DLL/URect.h +++ b/src/T2DLL/URect.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS URect : public CRect { +class AFX_CLASS_EXPORT URect : public CRect { public: static void SetEmpty(RECT& outRect); static void Center(const RECT& inRect, RECT& ioRect, BOOL inFlag = false); diff --git a/src/T2DLL/UT2BkgndInfo.cpp b/src/T2DLL/UT2BkgndInfo.cpp index b62afaf..14e62aa 100644 --- a/src/T2DLL/UT2BkgndInfo.cpp +++ b/src/T2DLL/UT2BkgndInfo.cpp @@ -1,31 +1,32 @@ #include "UT2BkgndInfo.h" /*static*/ BkgndInfo* UT2BkgndInfo::SetupBkgndInfo(const RECT& rect, int z) { - BkgndInfo *bkgndInfo = NULL; + BkgndInfo *bkgndInfoPtr = NULL; + int size; int vRange = (rect.bottom - rect.top) / 2; int hRange = (rect.right - rect.left) / 8; int zRange = z / 2; if (vRange > 0 && hRange > 0) { - int size = sizeof(BkgndInfo) + sizeof(void *) * (vRange - 1); - bkgndInfo = (BkgndInfo *) malloc(size); - memset(bkgndInfo, 0, size); + size = sizeof(BkgndInfo) + sizeof(void *) * (vRange - 1); + bkgndInfoPtr = (BkgndInfo *) malloc(size); + memset(bkgndInfoPtr, 0, size); - bkgndInfo->vRange = vRange; - bkgndInfo->hRange = hRange; - bkgndInfo->zRange = zRange; + bkgndInfoPtr->vRange = vRange; + bkgndInfoPtr->hRange = hRange; + bkgndInfoPtr->zRange = zRange; - for (int i = 0; i < vRange && bkgndInfo; i++) { + for (int i = 0; i < vRange && bkgndInfoPtr; i++) { size = sizeof(unsigned int) * hRange; - bkgndInfo->arrays[i] = (unsigned int *) malloc(size); - memset(bkgndInfo->arrays[i], 0, size); - if (!bkgndInfo->arrays[i]) - DisposeBkgndInfo(bkgndInfo); + bkgndInfoPtr->arrays[i] = (unsigned int *) malloc(size); + memset(bkgndInfoPtr->arrays[i], 0, size); + if (!bkgndInfoPtr->arrays[i]) + DisposeBkgndInfo(bkgndInfoPtr); } } - return bkgndInfo; + return bkgndInfoPtr; } /*static*/ void UT2BkgndInfo::DisposeBkgndInfo(BkgndInfo*& info) { diff --git a/src/T2DLL/UT2BkgndInfo.h b/src/T2DLL/UT2BkgndInfo.h index 13c614d..ec23fb9 100644 --- a/src/T2DLL/UT2BkgndInfo.h +++ b/src/T2DLL/UT2BkgndInfo.h @@ -8,7 +8,7 @@ struct BkgndInfo { unsigned int *arrays[1]; }; -class AFX_EXT_CLASS UT2BkgndInfo { +class AFX_CLASS_EXPORT UT2BkgndInfo { public: static BkgndInfo* SetupBkgndInfo(const RECT&, int); static void DisposeBkgndInfo(BkgndInfo*&); diff --git a/src/T2DLL/UT2Coordinate.h b/src/T2DLL/UT2Coordinate.h index d3cfbcb..b2d319d 100644 --- a/src/T2DLL/UT2Coordinate.h +++ b/src/T2DLL/UT2Coordinate.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS UT2Coordinate { +class AFX_CLASS_EXPORT UT2Coordinate { public: static void UnitToQD(int& ioV, int& ioH, int inZoomLevel = 0); static void UnitToQD(POINT& ioPoint, int inZoomLevel = 0, BOOL inExcludeRoof = false); diff --git a/src/T2DLL/UT2Utils.h b/src/T2DLL/UT2Utils.h index 37bc43b..32e1cfa 100644 --- a/src/T2DLL/UT2Utils.h +++ b/src/T2DLL/UT2Utils.h @@ -1,7 +1,7 @@ #pragma once #include "common.h" -class AFX_EXT_CLASS UT2Utils { +class AFX_CLASS_EXPORT UT2Utils { public: static unsigned int Float2Int(float inValue); static void GetRoomNumberString(int inNumber, CString& outStr); diff --git a/src/T2DLL/WalkerDlg.cpp b/src/T2DLL/WalkerDlg.cpp index f93a376..fdd7e63 100644 --- a/src/T2DLL/WalkerDlg.cpp +++ b/src/T2DLL/WalkerDlg.cpp @@ -7,6 +7,12 @@ #include "T2WorldDef.h" #include "WalkerDlg.h" +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + WalkerDlg::WalkerDlg() { mDeleteOnClose = true; } diff --git a/src/T2DLL/Wave.cpp b/src/T2DLL/Wave.cpp index 5523057..d3ed274 100644 --- a/src/T2DLL/Wave.cpp +++ b/src/T2DLL/Wave.cpp @@ -94,7 +94,7 @@ BOOL CWave::Create(UINT uiResID, HMODULE hmod) CString idStr; idStr.Format("%d", uiResID); - CString error = "CWave::Create ERROR : " + idStr + " " + GetModuleName(hmod) + "\n"; + CString error = "CWave::Create ERROR : " + idStr + "\x20\x40" + GetModuleName(hmod) + "\n"; OutputDebugString(error); _ASSERT(0); } diff --git a/src/T2DLL/Wave.h b/src/T2DLL/Wave.h index 4febc3b..0acfcd3 100644 --- a/src/T2DLL/Wave.h +++ b/src/T2DLL/Wave.h @@ -15,7 +15,7 @@ //----------------------------------------------------------------- // CWave Class - Wave Object //----------------------------------------------------------------- -class AFX_EXT_CLASS CWave : public CObject { +class AFX_CLASS_EXPORT CWave : public CObject { // Public Constructor(s)/Destructor public: CWave(); |