diff options
author | Ash Wolf <ninji@wuffs.org> | 2023-07-01 23:04:04 +0100 |
---|---|---|
committer | Ash Wolf <ninji@wuffs.org> | 2023-07-01 23:04:04 +0100 |
commit | c2efba6907fab934a04959b9bb644cf7141cc955 (patch) | |
tree | c047244f99870e44a7a5d7e733c2857434c03765 /src | |
parent | 1eb8da84d77d0c865623421069ec38bfc7b0d461 (diff) | |
download | t2win-c2efba6907fab934a04959b9bb644cf7141cc955.tar.gz t2win-c2efba6907fab934a04959b9bb644cf7141cc955.zip |
matched T2DLL as well as i can
Diffstat (limited to 'src')
82 files changed, 1059 insertions, 1006 deletions
diff --git a/src/T2DLL/LComparator.cpp b/src/T2DLL/LComparator.cpp index 649075d..16e25cd 100644 --- a/src/T2DLL/LComparator.cpp +++ b/src/T2DLL/LComparator.cpp @@ -12,16 +12,16 @@ LComparator::LComparator() { /*virtual*/ int LComparator::Compare(const void* inItemOne, const void* inItemTwo, unsigned int inSizeOne, unsigned int inSizeTwo) const { const unsigned char *a = (const unsigned char *) inItemOne; const unsigned char *b = (const unsigned char *) inItemTwo; - unsigned int size = inSizeOne; + unsigned int theSize = inSizeOne; if (inSizeTwo < inSizeOne) - size = inSizeTwo; + theSize = inSizeTwo; - while (size > 0) { + while (theSize > 0) { if (*a != *b) return *a - *b; a++; b++; - size--; + theSize--; } return inSizeOne - inSizeTwo; @@ -75,5 +75,5 @@ LLongComparator* LLongComparator::GetComparator() { } /*virtual*/ LComparator* LLongComparator::Clone() { - return new LLongComparator; + return new LComparator; } diff --git a/src/T2DLL/SoundDlg.cpp b/src/T2DLL/SoundDlg.cpp index 20db73d..705bd70 100644 --- a/src/T2DLL/SoundDlg.cpp +++ b/src/T2DLL/SoundDlg.cpp @@ -34,14 +34,17 @@ void SoundDlg::Setup(T2TowerDoc *inDoc, HINSTANCE inInstance, CWnd *inParentWnd, } void SoundDlg::Revert() { - T2DlgItem *theCheck = GetT2DlgItem(100); + T2DlgItemText *theText; + T2DlgItem *theCheck, *theICheck; + + theCheck = GetT2DlgItem(100); theCheck->SetValue(1); for (int i = 0; i < 4; i++) { - T2DlgItem *theICheck = GetT2DlgItem(101 + i); + theICheck = GetT2DlgItem(101 + i); theICheck->SetValue(1); - T2DlgItemText *theText = (T2DlgItemText *) GetT2DlgItem(111 + i); + theText = (T2DlgItemText *) GetT2DlgItem(111 + i); theText->SetTextColor(RGB(0, 0, 0)); } @@ -74,22 +77,25 @@ void SoundDlg::Save() { } /*virtual*/ void SoundDlg::OnT2Create() { + T2DlgItem *theCheck, *theICheck; T2SoundPlayer *theSoundPlayer = mDocument->towerDoc_vf134(); - T2DlgItem *theCheck = GetT2DlgItem(100); + theCheck = GetT2DlgItem(100); if (theSoundPlayer->IsSoundOn()) { theCheck->SetValue(1); } else { theCheck->SetValue(0); + + T2DlgItemText *theText; for (int i = 0; i < 4; i++) { - T2DlgItemText *theText = (T2DlgItemText *) GetT2DlgItem(111 + i); + theText = (T2DlgItemText *) GetT2DlgItem(111 + i); theText->SetTextColor(RGB(128, 128, 128)); } } unsigned int theMask = theSoundPlayer->GetSEMask(); for (int i = 0; i < 4; i++) { - T2DlgItem *theICheck = GetT2DlgItem(101 + i); + theICheck = GetT2DlgItem(101 + i); if (theMask & masks[i]) theICheck->SetValue(1); else @@ -97,28 +103,29 @@ void SoundDlg::Save() { } } -/*virtual*/ int SoundDlg::OnT2DialogCommand(UINT cmd, long data) { - int result = 1; +/*virtual*/ BOOL SoundDlg::OnT2DialogCommand(WPARAM inWParam, LPARAM inLParam) { + COLORREF col; + BOOL done = true; T2DlgItem *theCheck = GetT2DlgItem(100); - BOOL isSoundOn = theCheck->GetValue(); - WORD w = LOWORD(cmd); + BOOL value = theCheck->GetValue(); + WORD id = LOWORD(inWParam); - if (w == 100) { - COLORREF col; - if (isSoundOn) + if (id == 100) { + if (value) col = RGB(0, 0, 0); else col = RGB(128, 128, 128); + T2DlgItemText *theText; for (int i = 0; i < 4; i++) { - T2DlgItemText *theText = (T2DlgItemText *) GetT2DlgItem(111 + i); + theText = (T2DlgItemText *) GetT2DlgItem(111 + i); theText->SetTextColor(col); } Invalidate(); - } else if (w >= 101 && w < 105) { - if (!isSoundOn) { - T2DlgItem *theICheck = GetT2DlgItem(w); + } else if (id >= 101 && id < 105) { + if (!value) { + T2DlgItem *theICheck = GetT2DlgItem(id); int oldValue = theICheck->GetValue(); if (oldValue) theICheck->SetValue(0); @@ -126,8 +133,8 @@ void SoundDlg::Save() { theICheck->SetValue(1); } } else { - result = T2Dialog::OnT2DialogCommand(cmd, data); + done = T2Dialog::OnT2DialogCommand(inWParam, inLParam); } - return result; + return done; } diff --git a/src/T2DLL/SoundDlg.h b/src/T2DLL/SoundDlg.h index 157d004..38347c2 100644 --- a/src/T2DLL/SoundDlg.h +++ b/src/T2DLL/SoundDlg.h @@ -11,7 +11,7 @@ public: void Save(); protected: - virtual int OnT2DialogCommand(UINT cmd, long data); + virtual BOOL OnT2DialogCommand(WPARAM inWParam, LPARAM inLParam); virtual void OnT2Create(); T2TowerDoc *mDocument; diff --git a/src/T2DLL/SpeedDlg.cpp b/src/T2DLL/SpeedDlg.cpp index 88c0805..37d5441 100644 --- a/src/T2DLL/SpeedDlg.cpp +++ b/src/T2DLL/SpeedDlg.cpp @@ -57,11 +57,11 @@ void SpeedDlg::Save() { mCurrentIndex = -1; T2DlgItem *theRadio; - T2DlgItem *theText; + T2DlgItem *theTopSpeedText; - for (int i = 0; i < 5; i++) { - if (mCurrentSpeed == speedValues[i]) { - mCurrentIndex = i; + for (int index = 0; index < 5; index++) { + if (mCurrentSpeed == speedValues[index]) { + mCurrentIndex = index; theRadio = GetT2DlgItem(105 + mCurrentIndex); theRadio->SetValue(1); break; @@ -69,48 +69,48 @@ void SpeedDlg::Save() { } if (mCurrentIndex != 4) { - theText = GetT2DlgItem(104); + theTopSpeedText = GetT2DlgItem(104); theRadio = GetT2DlgItem(109); - theText->ShowWindow(SW_HIDE); + theTopSpeedText->ShowWindow(SW_HIDE); theRadio->ShowWindow(SW_HIDE); } } -/*virtual*/ int SpeedDlg::OnT2DialogCommand(UINT cmd, long data) { - int result = 1; - WORD w = LOWORD(cmd); +/*virtual*/ BOOL SpeedDlg::OnT2DialogCommand(WPARAM inWParam, LPARAM inLParam) { + BOOL theRes = true; + WORD id = LOWORD(inWParam); T2DlgItem *theRadio; - T2DlgItem *theText; + T2DlgItem *theTopSpeedText; - switch (w) { + switch (id) { case 105: case 106: case 107: case 108: case 109: - mCurrentSpeed = speedValues[w - 105]; + mCurrentSpeed = speedValues[id - 105]; if (mCurrentIndex != -1) { theRadio = GetT2DlgItem(105 + mCurrentIndex); theRadio->SetValue(0); } - mCurrentIndex = w - 105; + mCurrentIndex = id - 105; theRadio = GetT2DlgItem(105 + mCurrentIndex); theRadio->SetValue(1); break; case 110: - theText = GetT2DlgItem(104); + theTopSpeedText = GetT2DlgItem(104); theRadio = GetT2DlgItem(109); - theText->ShowWindow(SW_SHOW); + theTopSpeedText->ShowWindow(SW_SHOW); theRadio->ShowWindow(SW_SHOW); break; default: - result = T2Dialog::OnT2DialogCommand(cmd, data); + theRes = T2Dialog::OnT2DialogCommand(inWParam, inLParam); } - return result; + return theRes; } diff --git a/src/T2DLL/SpeedDlg.h b/src/T2DLL/SpeedDlg.h index 79588c2..751fdc2 100644 --- a/src/T2DLL/SpeedDlg.h +++ b/src/T2DLL/SpeedDlg.h @@ -11,7 +11,7 @@ public: void Save(); protected: - virtual int OnT2DialogCommand(UINT cmd, long data); + virtual BOOL OnT2DialogCommand(WPARAM inWParam, LPARAM inLParam); virtual void OnT2Create(); T2TowerDoc *mDocument; diff --git a/src/T2DLL/T2AdvertiseTable.cpp b/src/T2DLL/T2AdvertiseTable.cpp index 0f353bf..e841425 100644 --- a/src/T2DLL/T2AdvertiseTable.cpp +++ b/src/T2DLL/T2AdvertiseTable.cpp @@ -34,11 +34,12 @@ void T2AdvertiseTable::Add(T2AdvertisePlugin* inPlugin, BOOL inSelect) { } void T2AdvertiseTable::Add(CFilePluginList* inPluginList) { + T2AdvertisePlugin *thePlugin; int theSubType = GetUserCon(); POSITION pos = inPluginList->GetHeadPosition(); while (pos) { - T2AdvertisePlugin *thePlugin = (T2AdvertisePlugin *) inPluginList->GetNext(pos); + thePlugin = (T2AdvertisePlugin *) inPluginList->GetNext(pos); if (thePlugin->GetSubType() == theSubType && !thePlugin->IsTieupFinish()) Add(thePlugin, false); } @@ -51,14 +52,14 @@ void T2AdvertiseTable::Add(CFilePluginList* inPluginList) { CFont font; CPen pen; - CBrush brush; + CBrush theBrush; RECT cellRect; if (FetchLocalCellFrame(inCell, cellRect) && inCell.col == 1) { T2AdvertisePlugin *thePlugin; GetCellData(inCell, &thePlugin); if (thePlugin) { - DWORD theSubType = GetUserCon(); + DWORD pluginType = GetUserCon(); int x = cellRect.left + 4; int y = cellRect.bottom - 12; @@ -66,7 +67,7 @@ void T2AdvertiseTable::Add(CFilePluginList* inPluginList) { pDC->SelectObject(&font); pDC->SetBkMode(TRANSPARENT); - if (theSubType == 'CFPI') { + if (pluginType == 'CFPI') { if (IsMark(inCell.row)) { RECT rect; rect.left = x; @@ -75,9 +76,9 @@ void T2AdvertiseTable::Add(CFilePluginList* inPluginList) { rect.bottom = y + 4; pen.CreateStockObject(BLACK_PEN); - brush.CreateStockObject(WHITE_BRUSH); + theBrush.CreateStockObject(WHITE_BRUSH); pDC->SelectObject(&pen); - pDC->SelectObject(&brush); + pDC->SelectObject(&theBrush); pDC->MoveTo(rect.left + 2, rect.top + 3); pDC->LineTo((rect.right + rect.left) / 2 - 2, rect.bottom - 1); @@ -88,9 +89,9 @@ void T2AdvertiseTable::Add(CFilePluginList* inPluginList) { y = cellRect.bottom - 12; } - CString text; - thePlugin->GetName(text); - pDC->TextOutA(x, y, text, strlen(text)); + CString pluginName; + thePlugin->GetName(pluginName); + pDC->TextOutA(x, y, pluginName, strlen(pluginName)); } } @@ -109,30 +110,30 @@ void T2AdvertiseTable::ClickCell(const TableCellT& inCell, const CPoint& inPt) { } BOOL T2AdvertiseTable::IsMark(unsigned int inRow) { - void *data = NULL; + void *theData = NULL; - TableCellT cell; - cell.row = inRow; - cell.col = 2; - GetCellData(cell, &data); + TableCellT theCell; + theCell.row = inRow; + theCell.col = 2; + GetCellData(theCell, &theData); - return (data != NULL); + return (theData != NULL); } void T2AdvertiseTable::SetMark(unsigned int inRow, BOOL inValue) { - void *data = inValue ? this : NULL; + void *theData = inValue ? this : NULL; - TableCellT cell; - cell.row = inRow; - cell.col = 2; - SetCellData(cell, &data); + TableCellT theCell; + theCell.row = inRow; + theCell.col = 2; + SetCellData(theCell, &theData); InvalidateRect(NULL); } /*virtual*/ void T2AdvertiseTable::OnT2DlgItemLButtonDown(UINT inFlags, CPoint inPt) { POINT pt = inPt; - ClientToView(&inPt, 1); + ClientToView(&pt, 1); TableCellT cell; FetchCellHitBy(pt, cell); @@ -144,14 +145,14 @@ void T2AdvertiseTable::SetMark(unsigned int inRow, BOOL inValue) { /*virtual*/ BOOL T2AdvertiseTable::OnT2DlgItemEraseBkgnd(CDC* pDC) { T2VerticalTable::OnT2DlgItemEraseBkgnd(pDC); - unsigned int rows, cols; - GetTableSize(rows, cols); + unsigned int numOfRows, numOfColumns, theRow, theColumn; - for (unsigned int col = 1; col <= cols; col++) { - for (unsigned int row = 1; row <= rows; row++) { + GetTableSize(numOfRows, numOfColumns); + for (theColumn = 1; theColumn <= numOfColumns; theColumn++) { + for (theRow = 1; theRow <= numOfRows; theRow++) { TableCellT cell; - cell.row = row; - cell.col = col; + cell.row = theRow; + cell.col = theColumn; DrawCell(pDC, cell); } } diff --git a/src/T2DLL/T2Animation.cpp b/src/T2DLL/T2Animation.cpp index 88f6abe..9031777 100644 --- a/src/T2DLL/T2Animation.cpp +++ b/src/T2DLL/T2Animation.cpp @@ -23,7 +23,7 @@ T2Animation::T2Animation(T2TowerDoc* inDoc, short inNumOfFrame, short inNumOfSpr maxCount = inSpriteDef[i].count; } - HINSTANCE theModuleHandle = inDoc->mWorldPluginSpecifier->mInstance; + HINSTANCE theWorldModule = inDoc->mWorldPluginSpecifier->mInstance; mSpriteIndices = new int[inNumOfSprite]; #line 41 @@ -44,18 +44,18 @@ T2Animation::T2Animation(T2TowerDoc* inDoc, short inNumOfFrame, short inNumOfSpr T2ImageObj *theImageObj = new T2ImageObj; mImageObjs[i] = theImageObj; - T2BitImage *theImage = new T2BitImage(theModuleHandle, inSpriteDef[i].resID, true); - mImages[i] = theImage; + T2BitImage *theBitImage = new T2BitImage(theWorldModule, inSpriteDef[i].resID, true); + mImages[i] = theBitImage; - RECT rect; - rect.left = 0; - rect.top = 0; - rect.right = inSpriteDef[i].width; - rect.bottom = inSpriteDef[i].height; + RECT theFrameRect; + theFrameRect.left = 0; + theFrameRect.top = 0; + theFrameRect.right = inSpriteDef[i].width; + theFrameRect.bottom = inSpriteDef[i].height; for (short j = 0; j < inSpriteDef[i].count; j++) { - theImageObj->AddObject(name, j + 1, *theImage, &rect, true, false); - OffsetRect(&rect, 0, inSpriteDef[i].height); + theImageObj->AddObject(name, j + 1, *theBitImage, &theFrameRect, true, false); + OffsetRect(&theFrameRect, 0, inSpriteDef[i].height); } mSpriteIndices[i] = mDocument->mSprite.NewSprite(*theImageObj, name, inLayer); @@ -106,8 +106,8 @@ BOOL T2Animation::Idle() { void T2Animation::Play(POINT inPt, int inLen) { mPoint = inPt; - int delay = 60 / inLen; - int endTick = GetTickCount() + delay; + int interval = 60 / inLen; + int endTick = GetTickCount() + interval; BOOL playing = mFrame < mNumOfFrame; while (playing) { @@ -119,7 +119,7 @@ void T2Animation::Play(POINT inPt, int inLen) { // nothing there! } - endTick = now + delay; + endTick = now + interval; } } @@ -132,12 +132,12 @@ BOOL T2Animation::Step() { void T2Animation::Draw() { if (HasNextStep()) { for (int i = 0; i < mNumOfSprite; i++) { - const AnimationDef *def = mAnimationDef + (mFrame * mNumOfSprite) + i; + const AnimationDef *theAnimationDef = mAnimationDef + (mFrame * mNumOfSprite) + i; CPoint pt = mPoint; - pt.Offset(def->position); + pt.Offset(theAnimationDef->position); mDocument->mSprite.MoveSprite(mSpriteIndices[i], pt); - mDocument->mSprite.ChangePattern(mSpriteIndices[i], def->pattern); + mDocument->mSprite.ChangePattern(mSpriteIndices[i], theAnimationDef->pattern); mDocument->mSprite.ShowSprite(mSpriteIndices[i], true); } } diff --git a/src/T2DLL/T2Archive.cpp b/src/T2DLL/T2Archive.cpp index 8aac959..2431a27 100644 --- a/src/T2DLL/T2Archive.cpp +++ b/src/T2DLL/T2Archive.cpp @@ -238,22 +238,22 @@ BOOL T2Archive::operator<<(RECT v) { } BOOL T2Archive::operator>>(CString& v) { - int maxSize = 16; + int maxLen = 16; char buf[17]; v = ""; - int sz = Read(buf, maxSize); - while (strlen(buf) == sz) { - buf[sz] = 0; + int amountRead = Read(buf, maxLen); + while (strlen(buf) == amountRead) { + buf[amountRead] = 0; v += buf; - if (sz < maxSize) + if (amountRead < maxLen) return false; - sz = Read(buf, maxSize); + amountRead = Read(buf, maxLen); } int len = strlen(buf); - mFile->Seek(len - sz + 1, CFile::current); + mFile->Seek(len - amountRead + 1, CFile::current); v += buf; return true; @@ -267,22 +267,22 @@ BOOL T2Archive::operator<<(CString& v) { } BOOL T2Archive::operator>>(char* v) { - int maxSize = 16; + int maxLen = 16; char buf[17]; v = ""; // BUG!! - int sz = Read(buf, maxSize); - while (strlen(buf) == sz) { - buf[sz] = 0; + int amountRead = Read(buf, maxLen); + while (strlen(buf) == amountRead) { + buf[amountRead] = 0; strcat(v, buf); - if (sz < maxSize) + if (amountRead < maxLen) return false; - sz = Read(buf, maxSize); + amountRead = Read(buf, maxLen); } int len = strlen(buf); - mFile->Seek(len - sz + 1, CFile::current); + mFile->Seek(len - amountRead + 1, CFile::current); strcat(v, buf); return true; @@ -329,20 +329,20 @@ BOOL T2Archive::WritePStr(const char* v) { } /*virtual*/ BOOL T2Archive::Skip(unsigned long v) { - int size; + int bufSize; BOOL result = true; if (v > 1000) - size = 1000; + bufSize = 1000; else - size = v; + bufSize = v; - void *buf = malloc(size); + void *buf = malloc(bufSize); while (v > 0) { - int howMuch = Read(buf, size); + int howMuch = Read(buf, bufSize); v -= howMuch; - if (howMuch < size && v > 0) { + if (howMuch < bufSize && v > 0) { result = false; break; } diff --git a/src/T2DLL/T2BalloonWnd.cpp b/src/T2DLL/T2BalloonWnd.cpp index c995100..549ebd1 100644 --- a/src/T2DLL/T2BalloonWnd.cpp +++ b/src/T2DLL/T2BalloonWnd.cpp @@ -9,6 +9,7 @@ static char THIS_FILE[] = __FILE__; #endif +#line 16 IMPLEMENT_DYNCREATE(T2BalloonWnd, CFrameWnd); T2BalloonWnd::T2BalloonWnd() { diff --git a/src/T2DLL/T2DayLightFilter.cpp b/src/T2DLL/T2DayLightFilter.cpp index 696df67..cf76d48 100644 --- a/src/T2DLL/T2DayLightFilter.cpp +++ b/src/T2DLL/T2DayLightFilter.cpp @@ -12,6 +12,7 @@ T2DayLightFilter::~T2DayLightFilter() { } void T2DayLightFilter::SetTime(int t1, int t2) { +#pragma var_order(base, low, high, time, midpoint) double time; double base = (sin(2.0 * (3.141592 * (t1 / 1000.0))) * 8.0) + 500.0; double midpoint = 1000.0 - base; @@ -51,6 +52,7 @@ void T2DayLightFilter::RefractionColor(RGBQUAD* rgb) { } void T2DayLightFilter::CalcDayLightColor(RGBQUAD* rgb) { +#pragma var_order(outB, outR, base, tint1, tint2, outG) double base = (0.5 * sin((3.141592 * mTime) / 180.0)) + 0.5; if (base < 0.0) base = 0.0; @@ -83,12 +85,13 @@ void T2DayLightFilter::CalcDayLightColor(RGBQUAD* rgb) { outG = min(max(outG, 0.0), 1.0); outB = min(max(outB, 0.0), 1.0); - rgb->rgbRed = outR * 255.0; - rgb->rgbGreen = outG * 255.0; - rgb->rgbBlue = outB * 255.0; + rgb->rgbRed = 255.0 * outR; + rgb->rgbGreen = 255.0 * outG; + rgb->rgbBlue = 255.0 * outB; } void T2DayLightFilter::SkyColor(RGBQUAD* rgb) { +#pragma var_order(outB, outR, inG, outG, inB, inR) double inR = mBaseCol.rgbRed / 255.0; double inG = mBaseCol.rgbGreen / 255.0; double inB = mBaseCol.rgbBlue / 255.0; @@ -101,9 +104,9 @@ void T2DayLightFilter::SkyColor(RGBQUAD* rgb) { outG *= (rgb->rgbGreen / 255.0); outB *= (rgb->rgbBlue / 255.0); - outR = (outR * 0.45) + (inR * 0.55); - outG = (outG * 0.6) + (inG * 0.4); - outB = (outB * 0.6) + (inB * 0.4); + outR = (0.45 * outR) + (0.55 * inR); + outG = (0.6 * outG) + (0.4 * inG); + outB = (0.6 * outB) + (0.4 * inB); rgb->rgbRed = 255.0 * outR; rgb->rgbGreen = 255.0 * outG; diff --git a/src/T2DLL/T2DlgItemAPTable.cpp b/src/T2DLL/T2DlgItemAPTable.cpp index 11282ff..029df73 100644 --- a/src/T2DLL/T2DlgItemAPTable.cpp +++ b/src/T2DLL/T2DlgItemAPTable.cpp @@ -37,10 +37,10 @@ T2DlgItemAPTable::T2DlgItemAPTable(int inRows, int inCols, int inRowHeight, int pDC->Rectangle(rect); - char *text = new char[128]; - GetCellData(inCell, text); - pDC->DrawText(text, rect, DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX); - delete[] text; + char *theString = new char[128]; + GetCellData(inCell, theString); + pDC->DrawText(theString, rect, DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX); + delete[] theString; pDC->RestoreDC(save); } diff --git a/src/T2DLL/T2DlgItemArrows.cpp b/src/T2DLL/T2DlgItemArrows.cpp index 06cc7e8..a27fce6 100644 --- a/src/T2DLL/T2DlgItemArrows.cpp +++ b/src/T2DLL/T2DlgItemArrows.cpp @@ -18,34 +18,34 @@ T2DlgItemArrows::T2DlgItemArrows(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPal /*virtual*/ T2DlgItemArrows::~T2DlgItemArrows() { } -/*virtual*/ BOOL T2DlgItemArrows::Create(const char* windowName, DWORD style, const RECT& rect, CWnd* parentWnd, UINT nId) { - CRect rectToUse = rect; - CRect imageRect; - T2BitImage *image = GetObjectImage(imageRect, "DLGITEM:Arrows"); - if (image) { - rectToUse.right = rectToUse.left + imageRect.Width(); - rectToUse.bottom = rectToUse.top + imageRect.Height(); +/*virtual*/ BOOL T2DlgItemArrows::Create(const char* windowName, DWORD style, const RECT& inRect, CWnd* parentWnd, UINT nId) { + CRect rect = inRect; + CRect theImageArea; + T2BitImage *theImage = GetObjectImage(theImageArea, "DLGITEM:Arrows"); + if (theImage) { + rect.right = rect.left + theImageArea.Width(); + rect.bottom = rect.top + theImageArea.Height(); } - return T2DlgItem::Create(windowName, style, rectToUse, parentWnd, nId); + return T2DlgItem::Create(windowName, style, rect, parentWnd, nId); } -/*virtual*/ void T2DlgItemArrows::OnT2DlgItemLButtonDown(UINT nFlags, CPoint pt) { - CRect clientRect; - GetClientRect(clientRect); +/*virtual*/ void T2DlgItemArrows::OnT2DlgItemLButtonDown(UINT inFlags, CPoint inPt) { + CRect rect; + GetClientRect(rect); CRect imageRect; if (GetObjectImage(imageRect, "DLGITEM:Arrows")) { CRect upRect = imageRect; - upRect.bottom = upRect.top + (imageRect.Height() / 2); - upRect.OffsetRect(-upRect.left + clientRect.left, -upRect.top + clientRect.top); + upRect.bottom = upRect.top + (upRect.Height() / 2); + upRect.OffsetRect(-upRect.left + rect.left, -upRect.top + rect.top); - CRect dnRect = imageRect; - dnRect.OffsetRect(-dnRect.left + clientRect.left, -dnRect.top + clientRect.top + upRect.Height() + 1); + CRect dnRect = upRect; + dnRect.OffsetRect(-dnRect.left + rect.left, -dnRect.top + rect.top + upRect.Height() + 1); - if (upRect.PtInRect(pt)) { + if (upRect.PtInRect(inPt)) { SetPattern(100); mMouseRect = upRect; - } else if (dnRect.PtInRect(pt)) { + } else if (dnRect.PtInRect(inPt)) { SetPattern(101); mMouseRect = dnRect; } @@ -90,25 +90,20 @@ T2DlgItemArrows::T2DlgItemArrows(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPal } /*virtual*/ BOOL T2DlgItemArrows::OnT2DlgItemEraseBkgnd(CDC* pDC) { - CRect clientRect; - GetClientRect(clientRect); + CRect theFrameRect; + GetClientRect(theFrameRect); int save = pDC->SaveDC(); pDC->SelectPalette(mPalette, false); pDC->RealizePalette(); - CRect imageRect; - int pattern; - if (!m74) - pattern = 0; - else - pattern = GetPattern(); - T2BitImage *image = GetObjectImage(imageRect, "DLGITEM:Arrows", pattern); - - if (image) { - CRect drawRect = imageRect; - drawRect.OffsetRect(-drawRect.left + clientRect.left, -drawRect.top + clientRect.top); - image->CopyImage(pDC, imageRect, drawRect, 0, NULL); + CRect theImageArea; + T2BitImage *theImage = GetObjectImage(theImageArea, "DLGITEM:Arrows", !m74 ? 0 : GetPattern()); + + if (theImage) { + CRect drawRect = theImageArea; + drawRect.OffsetRect(-drawRect.left + theFrameRect.left, -drawRect.top + theFrameRect.top); + theImage->CopyImage(pDC, theImageArea, drawRect, 0, NULL); } pDC->RestoreDC(save); diff --git a/src/T2DLL/T2DlgItemArrows.h b/src/T2DLL/T2DlgItemArrows.h index 7836c35..313cb69 100644 --- a/src/T2DLL/T2DlgItemArrows.h +++ b/src/T2DLL/T2DlgItemArrows.h @@ -6,13 +6,13 @@ class T2DlgItemArrows : public T2DlgItem { public: T2DlgItemArrows(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette); virtual ~T2DlgItemArrows(); - virtual BOOL Create(const char* windowName, DWORD style, const RECT& rect, CWnd* parentWnd, UINT nId); + virtual BOOL Create(const char* windowName, DWORD style, const RECT& inRect, CWnd* parentWnd, UINT nId); virtual void SetMinValue(int inValue); virtual void SetMaxValue(int inValue); virtual void SetValue(int value); protected: - virtual void OnT2DlgItemLButtonDown(UINT nFlags, CPoint pt); + virtual void OnT2DlgItemLButtonDown(UINT inFlags, CPoint inPt); virtual void OnT2DlgItemLButtonUp(UINT nFlags, CPoint pt); virtual void OnT2DlgItemMouseMove(UINT nFlags, CPoint pt); virtual BOOL OnT2DlgItemEraseBkgnd(CDC*); diff --git a/src/T2DLL/T2DlgItemBox.cpp b/src/T2DLL/T2DlgItemBox.cpp index fc49267..d4cd62a 100644 --- a/src/T2DLL/T2DlgItemBox.cpp +++ b/src/T2DLL/T2DlgItemBox.cpp @@ -21,7 +21,7 @@ T2DlgItemBox::T2DlgItemBox(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* greyPen.CreatePen(PS_SOLID, 0, PALETTERGB(133, 133, 133)); CBrush brush; - int save = pDC->SaveDC(); + int saveDC = pDC->SaveDC(); pDC->SelectPalette(mPalette, false); pDC->RealizePalette(); @@ -40,7 +40,7 @@ T2DlgItemBox::T2DlgItemBox(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* pDC->FrameRect(rect, &brush); } - pDC->RestoreDC(save); + pDC->RestoreDC(saveDC); return true; } diff --git a/src/T2DLL/T2DlgItemButtonBase.cpp b/src/T2DLL/T2DlgItemButtonBase.cpp index 2ef7362..bb2fc14 100644 --- a/src/T2DLL/T2DlgItemButtonBase.cpp +++ b/src/T2DLL/T2DlgItemButtonBase.cpp @@ -43,6 +43,7 @@ T2DlgItemButtonBase::T2DlgItemButtonBase(T2TowerDoc* inDoc, T2ImageObj* inImageO /*virtual*/ void T2DlgItemButtonBase::DrawButtonBase(CDC* pDC, const RECT& inRect, BOOL flag) { if (IsWindowEnabled() && flag) { +#pragma var_order(brush, penB, save, penA) int save = pDC->SaveDC(); pDC->SelectPalette(mPalette, false); pDC->RealizePalette(); @@ -65,6 +66,7 @@ T2DlgItemButtonBase::T2DlgItemButtonBase(T2TowerDoc* inDoc, T2ImageObj* inImageO pDC->RestoreDC(save); } else { +#pragma var_order(brush, penB, penC, save, penA) int save = pDC->SaveDC(); pDC->SelectPalette(mPalette, false); pDC->RealizePalette(); diff --git a/src/T2DLL/T2DlgItemCANCEL.cpp b/src/T2DLL/T2DlgItemCANCEL.cpp index 8b0a197..b75bcc9 100644 --- a/src/T2DLL/T2DlgItemCANCEL.cpp +++ b/src/T2DLL/T2DlgItemCANCEL.cpp @@ -5,12 +5,12 @@ T2DlgItemCANCEL::T2DlgItemCANCEL(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPal { } -/*virtual*/ BOOL T2DlgItemCANCEL::Create(const char* windowName, DWORD style, const RECT& rect, CWnd* parentWnd, UINT nId) { - CRect rectToUse = rect; +/*virtual*/ BOOL T2DlgItemCANCEL::Create(const char* windowName, DWORD style, const RECT& inRect, CWnd* parentWnd, UINT nId) { + CRect rect = inRect; CRect imageRect; GetObjectImage(imageRect, "DLGITEM:Cancel"); - rectToUse.right = rectToUse.left + imageRect.Width(); - rectToUse.bottom = rectToUse.top + imageRect.Height(); - return T2DlgItem::Create("DLGITEM:Cancel", style, rectToUse, parentWnd, nId); + rect.right = rect.left + imageRect.Width(); + rect.bottom = rect.top + imageRect.Height(); + return T2DlgItem::Create("DLGITEM:Cancel", style, rect, parentWnd, nId); } diff --git a/src/T2DLL/T2DlgItemCANCEL.h b/src/T2DLL/T2DlgItemCANCEL.h index df762e4..8dd6d61 100644 --- a/src/T2DLL/T2DlgItemCANCEL.h +++ b/src/T2DLL/T2DlgItemCANCEL.h @@ -5,5 +5,5 @@ 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); + virtual BOOL Create(const char* windowName, DWORD style, const RECT& inRect, CWnd* parentWnd, UINT nId); }; diff --git a/src/T2DLL/T2DlgItemGageBase.cpp b/src/T2DLL/T2DlgItemGageBase.cpp index fd39101..02ff085 100644 --- a/src/T2DLL/T2DlgItemGageBase.cpp +++ b/src/T2DLL/T2DlgItemGageBase.cpp @@ -12,18 +12,18 @@ T2DlgItemGageBase::T2DlgItemGageBase(T2TowerDoc* towerDoc, T2ImageObj* imageObj, } /*virtual*/ BOOL T2DlgItemGageBase::OnT2DlgItemEraseBkgnd(CDC* dc) { - CRect clientRect; - GetClientRect(clientRect); + CRect rect; + GetClientRect(rect); - int save = dc->SaveDC(); + int saved = dc->SaveDC(); dc->SelectPalette(mPalette, false); dc->RealizePalette(); - CRect interior = clientRect; + CRect theInterior = rect; if (IsDrawInterior()) - DrawInterior(dc, interior); + DrawInterior(dc, theInterior); - dc->RestoreDC(save); + dc->RestoreDC(saved); return true; } @@ -41,15 +41,15 @@ void T2DlgItemGageBase::DrawBorderLines(CDC* dc, const CRect& rect) { CPen pen; pen.CreatePen(PS_SOLID, 0, PALETTEINDEX(255)); - HPEN prevPen = *dc->SelectObject(&pen); + HPEN oldPenH = *dc->SelectObject(&pen); - int bluePos = CalcPos(rect, GetMinValue(), GetMaxValue(), GetBlueValue()); - dc->MoveTo(bluePos, rect.top); - dc->LineTo(bluePos, rect.bottom - 1); + int theBlue = CalcPos(rect, GetMinValue(), GetMaxValue(), GetBlueValue()); + dc->MoveTo(theBlue, rect.top); + dc->LineTo(theBlue, rect.bottom - 1); - int yellowPos = CalcPos(rect, GetMinValue(), GetMaxValue(), GetYellowValue()); - dc->MoveTo(yellowPos, rect.top); - dc->LineTo(yellowPos, rect.bottom - 1); + int theYellow = CalcPos(rect, GetMinValue(), GetMaxValue(), GetYellowValue()); + dc->MoveTo(theYellow, rect.top); + dc->LineTo(theYellow, rect.bottom - 1); dc->MoveTo(rect.left, rect.top); dc->LineTo(rect.left, rect.bottom - 1); @@ -57,19 +57,19 @@ void T2DlgItemGageBase::DrawBorderLines(CDC* dc, const CRect& rect) { dc->LineTo(rect.right - 1, rect.top); dc->LineTo(rect.left, rect.top); - dc->SelectObject(prevPen); + dc->SelectObject(oldPenH); } -void T2DlgItemGageBase::DrawValueByText(CDC* dc, const CRect& rect) { - CRect smallerRect = rect; - smallerRect.DeflateRect(2, 0); +void T2DlgItemGageBase::DrawValueByText(CDC* dc, const CRect& inRect) { + CRect theFrameRect = inRect; + theFrameRect.DeflateRect(2, 0); - CString text; - text.Format("%d", GetValue()); + CString theString; + theString.Format("%d", GetValue()); - CFont font; - font.CreateFont( - -(rect.Height() - 4), + CFont theFont; + theFont.CreateFont( + -(inRect.Height() - 4), 0, 0, 0, @@ -85,22 +85,22 @@ void T2DlgItemGageBase::DrawValueByText(CDC* dc, const CRect& rect) { "Arial" ); - HFONT prevFont = *dc->SelectObject(&font); + HFONT theOldFont = *dc->SelectObject(&theFont); dc->SetBkMode(TRANSPARENT); dc->SetTextColor(PALETTERGB(255, 255, 255)); for (int x = -1; x <= 1; x++) { for (int y = -1; y <= 1; y++) { - CRect shadowRect = smallerRect; + CRect shadowRect = theFrameRect; shadowRect.OffsetRect(x, y); - dc->DrawText(text, shadowRect, DT_RIGHT | DT_VCENTER | DT_SINGLELINE); + dc->DrawText(theString, shadowRect, DT_RIGHT | DT_VCENTER | DT_SINGLELINE); } } - CRect textRect = smallerRect; + CRect textRect = theFrameRect; dc->SetTextColor(PALETTEINDEX(255)); - dc->DrawText(text, textRect, DT_RIGHT | DT_VCENTER | DT_SINGLELINE); + dc->DrawText(theString, textRect, DT_RIGHT | DT_VCENTER | DT_SINGLELINE); - dc->SelectObject(prevFont); + dc->SelectObject(theOldFont); } int T2DlgItemGageBase::CalcPos(const CRect& rect, int minValue, int maxValue, int value) { diff --git a/src/T2DLL/T2DlgItemHScr.cpp b/src/T2DLL/T2DlgItemHScr.cpp index 98100c1..b230824 100644 --- a/src/T2DLL/T2DlgItemHScr.cpp +++ b/src/T2DLL/T2DlgItemHScr.cpp @@ -13,6 +13,7 @@ T2DlgItemHScr::T2DlgItemHScr(T2TowerDoc* towerDoc, T2ImageObj* imageObj, CPalett } /*virtual*/ BOOL T2DlgItemHScr::OnT2DlgItemEraseBkgnd(CDC* dc) { +#pragma var_order(imgRect, thumbSize, brush, rect, image, destRect, pen1, pen2, savedDC, pen3, thumbPosition) CRect rect; GetClientRect(rect); diff --git a/src/T2DLL/T2DlgItemOK.cpp b/src/T2DLL/T2DlgItemOK.cpp index 3f1cdf6..07a7d08 100644 --- a/src/T2DLL/T2DlgItemOK.cpp +++ b/src/T2DLL/T2DlgItemOK.cpp @@ -5,12 +5,12 @@ T2DlgItemOK::T2DlgItemOK(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* in { } -/*virtual*/ BOOL T2DlgItemOK::Create(const char* windowName, DWORD style, const RECT& rect, CWnd* parentWnd, UINT nId) { - CRect rectToUse = rect; +/*virtual*/ BOOL T2DlgItemOK::Create(const char* windowName, DWORD style, const RECT& inRect, CWnd* parentWnd, UINT nId) { + CRect rect = inRect; CRect imageRect; GetObjectImage(imageRect, "DLGITEM:OK"); - rectToUse.right = rectToUse.left + imageRect.Width(); - rectToUse.bottom = rectToUse.top + imageRect.Height(); - return T2DlgItem::Create("DLGITEM:OK", style, rectToUse, parentWnd, nId); + rect.right = rect.left + imageRect.Width(); + rect.bottom = rect.top + imageRect.Height(); + return T2DlgItem::Create("DLGITEM:OK", style, rect, parentWnd, nId); } diff --git a/src/T2DLL/T2DlgItemOK.h b/src/T2DLL/T2DlgItemOK.h index bce44ab..99a4e75 100644 --- a/src/T2DLL/T2DlgItemOK.h +++ b/src/T2DLL/T2DlgItemOK.h @@ -5,5 +5,5 @@ 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); + virtual BOOL Create(const char* windowName, DWORD style, const RECT& inRect, CWnd* parentWnd, UINT nId); }; diff --git a/src/T2DLL/T2DlgItemTable.cpp b/src/T2DLL/T2DlgItemTable.cpp index 4382ef4..1af0ee4 100644 --- a/src/T2DLL/T2DlgItemTable.cpp +++ b/src/T2DLL/T2DlgItemTable.cpp @@ -265,6 +265,7 @@ BOOL TableCellIterator::Next(TableCellT& newCurrent) { } /*virtual*/ BOOL T2DlgItemTable::OnT2DlgItemEraseBkgnd(CDC* dc) { +#pragma var_order(clipRect, bottomRightCell, bottomRight, pen, save, topLeft, topLeftCell, clientRect, i) int save = dc->SaveDC(); dc->SelectPalette(mPalette, false); @@ -276,8 +277,8 @@ BOOL TableCellIterator::Next(TableCellT& newCurrent) { if (mShowHScroller && mShowVScroller) { CRect insideRect; GetClientRect(insideRect); - insideRect.right -= 16; - insideRect.bottom -= 16; + insideRect.left = insideRect.right - 16; + insideRect.top = insideRect.bottom - 16; dc->SelectObject(pen); dc->MoveTo(insideRect.right - 1, insideRect.top); @@ -457,14 +458,14 @@ BOOL T2DlgItemTable::Resized() { clientRect.right -= mShowVScroller ? 16 : 0; clientRect.bottom -= mShowHScroller ? 16 : 0; - CRect tableRect; - tableRect.left = 0; - tableRect.top = 0; - tableRect.right = mColWidth * mCols; - tableRect.right = mRowHeight * mRows; + CRect interiorRect; + interiorRect.left = 0; + interiorRect.top = 0; + interiorRect.right = mColWidth * mCols; + interiorRect.bottom = mRowHeight * mRows; if ( - (mHScrollerStyle == ShowIfNeeded && tableRect.Width() > clientRect.Width()) || + (mHScrollerStyle == ShowIfNeeded && interiorRect.Width() > clientRect.Width()) || mHScrollerStyle == AlwaysShow ) { @@ -475,7 +476,7 @@ BOOL T2DlgItemTable::Resized() { } if ( - (mHScrollerStyle == ShowIfNeeded && tableRect.Width() <= clientRect.Width()) || + (mHScrollerStyle == ShowIfNeeded && interiorRect.Width() <= clientRect.Width()) || (mHScrollerStyle != ShowIfNeeded && mHScrollerStyle != AlwaysShow) ) { @@ -486,7 +487,7 @@ BOOL T2DlgItemTable::Resized() { } if ( - (mVScrollerStyle == ShowIfNeeded && tableRect.Height() > clientRect.Height()) || + (mVScrollerStyle == ShowIfNeeded && interiorRect.Height() > clientRect.Height()) || mVScrollerStyle == AlwaysShow ) { @@ -497,7 +498,7 @@ BOOL T2DlgItemTable::Resized() { } if ( - (mVScrollerStyle == ShowIfNeeded && tableRect.Height() <= clientRect.Height()) || + (mVScrollerStyle == ShowIfNeeded && interiorRect.Height() <= clientRect.Height()) || (mVScrollerStyle != ShowIfNeeded && mVScrollerStyle != AlwaysShow) ) { diff --git a/src/T2DLL/T2DlgItemText.cpp b/src/T2DLL/T2DlgItemText.cpp index 6466376..415a460 100644 --- a/src/T2DLL/T2DlgItemText.cpp +++ b/src/T2DLL/T2DlgItemText.cpp @@ -26,17 +26,17 @@ void T2DlgItemText::SetTextColor(COLORREF inColor) { str += inStr; SetWindowText(str); - CRect rect; - GetClientRect(rect); - MapWindowPoints(GetParent(), rect); - GetParent()->InvalidateRect(rect); + CRect clientRect; + GetClientRect(clientRect); + MapWindowPoints(GetParent(), clientRect); + GetParent()->InvalidateRect(clientRect); } /*virtual*/ BOOL T2DlgItemText::OnT2DlgItemEraseBkgnd(CDC* pDC) { CRect rect; GetClientRect(rect); - int save = pDC->SaveDC(); + int theSave = pDC->SaveDC(); pDC->SelectPalette(mPalette, false); pDC->RealizePalette(); @@ -47,23 +47,23 @@ void T2DlgItemText::SetTextColor(COLORREF inColor) { CString str; GetContentText(str); - char justification = GetJustification(); - UINT flags = DT_WORDBREAK | DT_NOPREFIX; + char just = GetJustification(); + UINT format = DT_WORDBREAK | DT_NOPREFIX; - if (isupper(justification)) { - flags |= DT_VCENTER; - justification = tolower(justification); + if (isupper(just)) { + format |= DT_VCENTER; + just = tolower(just); } - switch (justification) { - case 'c': flags |= DT_CENTER; break; - case 'l': flags |= DT_LEFT; break; - case 'r': flags |= DT_RIGHT; break; + switch (just) { + case 'c': format |= DT_CENTER; break; + case 'l': format |= DT_LEFT; break; + case 'r': format |= DT_RIGHT; break; } - pDC->DrawText(str, rect, flags); + pDC->DrawText(str, rect, format); - pDC->RestoreDC(save); + pDC->RestoreDC(theSave); return true; } diff --git a/src/T2DLL/T2ElevatorModule.cpp b/src/T2DLL/T2ElevatorModule.cpp index 33fc3af..5fa8438 100644 --- a/src/T2DLL/T2ElevatorModule.cpp +++ b/src/T2DLL/T2ElevatorModule.cpp @@ -136,33 +136,33 @@ BOOL T2ElevatorModule::IsPtInArea(POINT pt, const RECT& area) const { void T2ElevatorModule::Remove(T2TowerDoc* towerDoc, T2Mover* mover) { T2FloorInfo *theFloorInfo = towerDoc->towerDoc_vf12C(); - T2People *people = NULL; - BOOL flag = true; + T2People *theRemovePeople = NULL; + BOOL isDown = true; T2Request *theRequest; switch (mStatus) { case kElevatorStatus1: - flag = false; + isDown = false; case kElevatorStatus2: - theRequest = mover->GetRequest(theFloorInfo, mPosition, flag); + theRequest = mover->GetRequest(theFloorInfo, mPosition, isDown); #line 183 ASSERT(theRequest != NULL); - people = theRequest->RemoveOffPeople(); + theRemovePeople = theRequest->RemoveOffPeople(); break; case kElevatorStatus3: theRequest = GetAppointRequest(theFloorInfo, mover); #line 189 ASSERT(theRequest != NULL); - people = theRequest->RemoveOnPeople(); + theRemovePeople = theRequest->RemoveOnPeople(); break; } - if (people) { - POINT curPosition = people->GetCurPosition(); - T2Tenant *theFloor = theFloorInfo->GetFloor(curPosition.y, curPosition.x); + if (theRemovePeople) { + POINT curPos = theRemovePeople->GetCurPosition(); + T2Tenant *theFloor = theFloorInfo->GetFloor(curPos.y, curPos.x); #line 199 ASSERT(theFloor != NULL); - theFloor->Enter(people); + theFloor->Enter(theRemovePeople); } T2MoverModule::RemoveContents(towerDoc); @@ -173,52 +173,51 @@ void T2ElevatorModule::RemoveContents(T2TowerDoc* towerDoc, T2Mover* mover, int BOOL flag = false; if (mLink1) { - POINT stopPt = mover->PositionToStopPt(position, ERequestUpDown_0); + POINT theStopPos = mover->PositionToStopPt(position, ERequestUpDown_0); T2FloorInfo *theFloorInfo = towerDoc->towerDoc_vf12C(); #line 221 ASSERT(theFloorInfo != NULL); - T2Tenant *theDstFloor = theFloorInfo->GetFloor(stopPt.y, stopPt.x); + T2Tenant *theDstFloor = theFloorInfo->GetFloor(theStopPos.y, theStopPos.x); #line 224 ASSERT(theDstFloor != NULL); T2PeopleLinkIterator iterator((T2People *) mLink1); - T2People *people = NULL; - T2People *nextPeople = NULL; - iterator.Next(&people); - while (people) { - iterator.Next(&nextPeople); - - POINT destPos = people->GetCurrDestPos(); - if (destPos.y == stopPt.y) { - Leave(people); - theDstFloor->Enter(people); - people->IncEstimate(-100); + T2People *thePeople = NULL; + T2People *theNextPeople = NULL; + iterator.Next(&thePeople); + while (thePeople) { + iterator.Next(&theNextPeople); + + if (thePeople->GetCurrDestPos().y == theStopPos.y) { + Leave(thePeople); + theDstFloor->Enter(thePeople); + thePeople->IncEstimate(-100); flag = true; } - people = nextPeople; - nextPeople = NULL; + thePeople = theNextPeople; + theNextPeople = NULL; } if (flag && IsPatChanged(mover)) { - RECT rect; - CalcUintArea(mover, rect); + RECT theRect; + CalcUintArea(mover, theRect); T2TowerMainView *theView = towerDoc->GetTowerMainView(); #line 251 ASSERT(theView != NULL); - theView->tmv_vf128(rect); + theView->tmv_vf128(theRect); } } } BOOL T2ElevatorModule::HomePosRemoved(T2Mover* mover, int position) { BOOL done = false; - int length = mover->GetLength(); + int theLength = mover->GetLength(); - for (unsigned int i = position + 1; !done && i < length; i++) { + for (unsigned int i = position + 1; !done && i < theLength; i++) { if (mover->IsStopPosition(i)) { mHomePosition = i; done = true; @@ -241,9 +240,9 @@ void T2ElevatorModule::TopTurnPosRemoved(int position) { if (mDirection != kElevatorDirection0 && mTopTurn != mBottomTurn) { BOOL done = false; - for (int i = position; !done && i > mBottomTurn; i--) { - if (IsStopPos(i, ERequestUpDown_0) || IsStopPos(i, ERequestUpDown_1)) { - mTopTurn = i; + for (int p = position; !done && p > mBottomTurn; p--) { + if (IsStopPos(p, ERequestUpDown_0) || IsStopPos(p, ERequestUpDown_1)) { + mTopTurn = p; done = true; } } @@ -258,9 +257,9 @@ void T2ElevatorModule::TopTurnPosRemoved(int position) { void T2ElevatorModule::BottomTurnPosRemoved(int position) { BOOL done = false; - for (int i = position; !done && i < mTopTurn; i++) { - if (IsStopPos(i, ERequestUpDown_0) || IsStopPos(i, ERequestUpDown_1)) { - mBottomTurn = i; + for (int p = position; !done && p < mTopTurn; p++) { + if (IsStopPos(p, ERequestUpDown_0) || IsStopPos(p, ERequestUpDown_1)) { + mBottomTurn = p; done = true; } } @@ -307,8 +306,8 @@ void T2ElevatorModule::MoverExpanded(T2Mover* mover, EEquipPos pos, int count) { mStopInfoArray->Expand(pos, count); int length = mover->GetLength(); - BOOL flag1 = false; - BOOL flag2 = false; + BOOL isResetPosition = false; + BOOL isResetHomePosition = false; switch (pos) { case EEquipPos_2: @@ -316,15 +315,15 @@ void T2ElevatorModule::MoverExpanded(T2Mover* mover, EEquipPos pos, int count) { if (mPosition > (length - 1)) { mOffsetPos = 0; mPosition = length - 1; - flag1 = true; + isResetPosition = true; } else if (mPosition == (length - 1) && mOffsetPos > 0) { mOffsetPos = 0; - flag1 = true; + isResetPosition = true; } if (mHomePosition > (length - 1)) { mHomePosition = length - 1; - flag2 = true; + isResetHomePosition = true; } } break; @@ -340,18 +339,18 @@ void T2ElevatorModule::MoverExpanded(T2Mover* mover, EEquipPos pos, int count) { if (mPosition < 0) { mOffsetPos = 0; mPosition = 0; - flag1 = true; + isResetPosition = true; } if (mHomePosition < 0) { mHomePosition = 0; - flag2 = true; + isResetHomePosition = true; } } break; } - if (flag1) { + if (isResetPosition) { if (mPosition != mNextStop || mNumPeople == 0) { mStatus = kElevatorStatus0; } else { @@ -360,7 +359,7 @@ void T2ElevatorModule::MoverExpanded(T2Mover* mover, EEquipPos pos, int count) { } } - if (flag2) { + if (isResetHomePosition) { mTopTurn = mBottomTurn = mNextStop = mHomePosition; StartToHomePos(); } @@ -434,28 +433,28 @@ void T2ElevatorModule::SetNextStop() { if (mStopInfoArray) { switch (mDirection) { case kElevatorDirection1: { - BOOL done = false; - for (int i = mPosition + 1; i < mTopTurn && !done; i++) { - if (IsStopPos(i, ERequestUpDown_0)) { - mNextStop = i; - done = true; + BOOL isStop = false; + for (int p = mPosition + 1; p < mTopTurn && !isStop; p++) { + if (IsStopPos(p, ERequestUpDown_0)) { + mNextStop = p; + isStop = true; } } - if (!done) + if (!isStop) mNextStop = mTopTurn; break; } case kElevatorDirection2: { - BOOL done = false; - for (int i = mPosition - 1; i > mBottomTurn && !done; i--) { - if (IsStopPos(i, ERequestUpDown_1)) { - mNextStop = i; - done = true; + BOOL isStop = false; + for (int p = mPosition - 1; p > mBottomTurn && !isStop; p--) { + if (IsStopPos(p, ERequestUpDown_1)) { + mNextStop = p; + isStop = true; } } - if (!done) + if (!isStop) mNextStop = mBottomTurn; break; } @@ -468,30 +467,30 @@ void T2ElevatorModule::ChangeTurnPos() { switch (mDirection) { case kElevatorDirection1: if (mBottomTurn == mPosition) { - BOOL done = false; - for (int i = mPosition; i < mNextStop && !done; i++) { - if (IsStopPos(i, ERequestUpDown_0) || IsStopPos(i, ERequestUpDown_1)) { - mBottomTurn = i; - done = true; + BOOL isStop = false; + for (int p = mPosition; p < mNextStop && !isStop; p++) { + if (IsStopPos(p, ERequestUpDown_0) || IsStopPos(p, ERequestUpDown_1)) { + mBottomTurn = p; + isStop = true; } } - if (!done) + if (!isStop) mBottomTurn = mNextStop; } break; case kElevatorDirection2: if (mTopTurn == mPosition) { - BOOL done = false; - for (int i = mPosition; i > mNextStop && !done; i--) { - if (IsStopPos(i, ERequestUpDown_0) || IsStopPos(i, ERequestUpDown_1)) { - mTopTurn = i; - done = true; + BOOL isStop = false; + for (int p = mPosition; p > mNextStop && !isStop; p--) { + if (IsStopPos(p, ERequestUpDown_0) || IsStopPos(p, ERequestUpDown_1)) { + mTopTurn = p; + isStop = true; } } - if (!done) + if (!isStop) mTopTurn = mNextStop; } break; @@ -557,25 +556,25 @@ void T2ElevatorModule::CalcUintArea(const T2Mover* mover, int position, RECT& ou } BOOL T2ElevatorModule::IsPatChanged(T2Mover* mover) { - BOOL changed = false; + BOOL isChanged = false; - T2MoverDef *def = (T2MoverDef *) mover->GetEquipDef(); - if (def) { - int newIndex = def->CalcModulePatIndex(mNumPeople); + T2MoverDef *moverDef = (T2MoverDef *) mover->GetEquipDef(); + if (moverDef) { + int newIndex = moverDef->CalcModulePatIndex(mNumPeople); if (mPatIndex != newIndex) { mPatIndex = newIndex; - changed = true; + isChanged = true; } } - if (changed) { + if (isChanged) { T2MoverModuleMessageData data; data.moverModule = this; data.value = GetPosition(); BroadcastMessage(1001, &data); } - return changed; + return isChanged; } T2People* T2ElevatorModule::LeaveToDstFloor(int y) { diff --git a/src/T2DLL/T2ElvModuleList.cpp b/src/T2DLL/T2ElvModuleList.cpp index d1f2224..4fc835b 100644 --- a/src/T2DLL/T2ElvModuleList.cpp +++ b/src/T2DLL/T2ElvModuleList.cpp @@ -63,43 +63,43 @@ void T2ElvModuleList::CalcBaseQDRect(RECT& outRect) { } int T2ElvModuleList::DestructModule(T2TowerDoc* towerDoc, T2Mover* mover, POINT inPt) { - int result = -1; - int zoomLevel = towerDoc->towerDoc_vf108(); + RECT theBaseQDRect; + int theModuleIndex = -1; + int theZoomLevel = towerDoc->towerDoc_vf108(); POINT pt = inPt; - RECT baseQDRect; - CalcBaseQDRect(baseQDRect); + CalcBaseQDRect(theBaseQDRect); - T2ElevatorModule *foundModule = NULL; - LArrayIterator iterator(*this, GetCount() + 1); - T2ElevatorModule *elevatorModule; + T2ElevatorModule *theElevatorModuleToRemove = NULL; + LArrayIterator iter(*this, GetCount() + 1); + T2ElevatorModule *theModule; - while (!foundModule && iterator.Previous(&elevatorModule)) { - if (elevatorModule->IsPtInArea(pt, baseQDRect)) - foundModule = elevatorModule; + while (!theElevatorModuleToRemove && iter.Previous(&theModule)) { + if (theModule->IsPtInArea(pt, theBaseQDRect)) + theElevatorModuleToRemove = theModule; } - if (foundModule) { - result = foundModule->GetIndex(); - foundModule->Remove(towerDoc, mover); + if (theElevatorModuleToRemove) { + theModuleIndex = theElevatorModuleToRemove->GetIndex(); + theElevatorModuleToRemove->Remove(towerDoc, mover); mModuleCount--; } - return result; + return theModuleIndex; } BOOL T2ElvModuleList::IsHomePosition(int position) { - BOOL result = false; + BOOL isHomePosition = false; LArrayIterator iterator(*this); - T2ElevatorModule *elevatorModule = NULL; + T2ElevatorModule *theModule = NULL; - while (iterator.Next(&elevatorModule) && !result) { - if (elevatorModule && elevatorModule->GetHomePosition() == position) - result = true; + while (iterator.Next(&theModule) && !isHomePosition) { + if (theModule && theModule->GetHomePosition() == position) + isHomePosition = true; } - return result; + return isHomePosition; } void T2ElvModuleList::MoverExpanded(T2Mover* mover, EEquipPos pos, int count) { @@ -138,13 +138,13 @@ void T2ElvModuleList::MoverExpanded(T2Mover* mover, EEquipPos pos, int count) { /*virtual*/ void T2ElvModuleList::Read(T2Archive& archive, T2TowerDoc* towerDoc) { T2MoverModuleList::Read(archive, towerDoc); - int count; - archive >> count; - mMaxModule = count; + int numOfModules; + archive >> numOfModules; + mMaxModule = numOfModules; BOOL ok = true; - for (int i = 0; i < count && ok; i++) { + for (int i = 0; i < numOfModules && ok; i++) { T2ElevatorModule *elevatorModule = new T2ElevatorModule(i); if (elevatorModule) { elevatorModule->Load(archive, towerDoc); @@ -152,11 +152,11 @@ void T2ElvModuleList::MoverExpanded(T2Mover* mover, EEquipPos pos, int count) { } } - LArrayIterator iterator(*this); - T2ElevatorModule *elevatorModule; + LArrayIterator iter(*this); + T2ElevatorModule *theModule; - while (iterator.Next(&elevatorModule)) { - if (elevatorModule->IsUsed()) + while (iter.Next(&theModule)) { + if (theModule->IsUsed()) mModuleCount++; } diff --git a/src/T2DLL/T2Equip.cpp b/src/T2DLL/T2Equip.cpp index ebebcda..d42cf4e 100644 --- a/src/T2DLL/T2Equip.cpp +++ b/src/T2DLL/T2Equip.cpp @@ -115,6 +115,7 @@ void T2Equip::ReplaceCEID(unsigned int oldID, unsigned int newID) { T2Object::LoadSelf(archive, towerDoc); if (IsUsed()) { +#pragma var_order(uc, s, us) unsigned short us; short s; unsigned char uc; @@ -147,6 +148,7 @@ void T2Equip::ReplaceCEID(unsigned int oldID, unsigned int newID) { T2Object::SaveSelf(archive); if (IsUsed()) { +#pragma var_order(uc, s, us) unsigned short us; short s; unsigned char uc; @@ -179,22 +181,22 @@ void T2Equip::ReplaceCEID(unsigned int oldID, unsigned int newID) { return GetEquipDef()->ShowInfoDialog(towerDoc, this); } -/*virtual*/ void T2Equip::PlaySound(T2TowerDoc* towerDoc, int id, unsigned int inMask, unsigned int inFlags) const { - if (towerDoc->towerDoc_vf15C(mArea)) { +/*virtual*/ void T2Equip::PlaySound(T2TowerDoc* inDoc, int id, unsigned int inMask, unsigned int inFlags) const { + if (inDoc->towerDoc_vf15C(mArea)) { T2EquipDef *equipDef = GetEquipDef(); - T2SoundPlayer *soundPlayer = towerDoc->towerDoc_vf134(); + T2SoundPlayer *soundPlayer = inDoc->towerDoc_vf134(); if (equipDef && soundPlayer) { - CRect rect; - GetEquipArea(rect); - CPoint pt = rect.CenterPoint(); - CString name = equipDef->CalcSoundID(id); + CRect theArea; + GetEquipArea(theArea); + CPoint pt = theArea.CenterPoint(); + CString theName = equipDef->CalcSoundID(id); soundPlayer->Play( - name, - inMask, - inFlags, - &pt, - PlayMode_0, - 100 + theName, + inMask, + inFlags, + &pt, + PlayMode_0, + 100 ); } } diff --git a/src/T2DLL/T2FireBurning.cpp b/src/T2DLL/T2FireBurning.cpp index 3ec86e0..eee04c3 100644 --- a/src/T2DLL/T2FireBurning.cpp +++ b/src/T2DLL/T2FireBurning.cpp @@ -114,18 +114,18 @@ T2FireBurning::T2FireBurning(T2TowerEvent* inTowerEvent, CResFile* inResFile, in return 0; } -/*virtual*/ void T2FireBurning::StartEvent(T2TowerDoc* inDoc, POINT inPt, const T2Tenant* inTenant) { - T2FloorInfo *theFloorInfo = inDoc->towerDoc_vf12C(); +/*virtual*/ void T2FireBurning::StartEvent(T2TowerDoc* inTowerDoc, POINT inPt, const T2Tenant* inTenant) { + T2FloorInfo *theFloorInfo = inTowerDoc->towerDoc_vf12C(); mFightAction = kFireFightNull; mFireArray = new LArray; - inDoc->towerDoc_vf144(ViewMode_0); - inDoc->towerDoc_vf2A8(25); - inDoc->SetFireBurning(true); - inDoc->towerDoc_vf1A0(true); - inDoc->towerDoc_vf2A0()->EnableIcon(false); - inDoc->GetTowerMainView()->tmv_vf154(); - inDoc->towerDoc_vf1B4(); + inTowerDoc->towerDoc_vf144(ViewMode_0); + inTowerDoc->towerDoc_vf2A8(25); + inTowerDoc->SetFireBurning(true); + inTowerDoc->towerDoc_vf1A0(true); + inTowerDoc->towerDoc_vf2A0()->EnableIcon(false); + inTowerDoc->GetTowerMainView()->tmv_vf154(); + inTowerDoc->towerDoc_vf1B4(); Sounds->FadeOut(); Sounds->AddSound("FIREBURNING:", SoundPriority_1, 8100, GetWorldModuleHandle()); @@ -134,25 +134,26 @@ T2FireBurning::T2FireBurning(T2TowerEvent* inTowerEvent, CResFile* inResFile, in Sounds->Play("FIREBURNING:", SoundMask_10, SoundFlags_10 | SoundFlags_10000, NULL, PlayMode_0, 100); CString dialogText; - dialogText.Format("%d", inDoc->towerDoc_vf12C()->UnitToFloor(inPt.y)); + dialogText.Format("%d", inTowerDoc->towerDoc_vf12C()->UnitToFloor(inPt.y)); dialogText += LoadStringTable(GetWorldModuleHandle(), 8100, 3); - DoDialog(inDoc, 8100, 5100, 3, dialogText); + DoDialog(inTowerDoc, 8100, 5100, 3, dialogText); if (!mImage) - mImage = new T2BitImage(inDoc->mWorldDef->mModuleHandle, 5000, true); + mImage = new T2BitImage(inTowerDoc->mWorldDef->mModuleHandle, 5000, true); if (!mImageObj) { mImageObj = new T2ImageObj; - mImageObj->AddObject(inDoc->mWorldDef->mModuleHandle, 5000, mImage); + mImageObj->AddObject(inTowerDoc->mWorldDef->mModuleHandle, 5000, mImage); SIZE size; mImageObj->GetObjectSize(mImageObj->FindObject("FIRE", 0), &size); mFireWidth = size.cx / 8; } - MakeFire(inPt, inDoc); + MakeFire(inPt, inTowerDoc); - T2TowerMainView *theTowerMainView = inDoc->GetTowerMainView(); + // should this be called theView? as per Mac asserts + T2TowerMainView *theTowerMainView = inTowerDoc->GetTowerMainView(); CRect area; inTenant->GetEquipArea(area); @@ -163,13 +164,13 @@ T2FireBurning::T2FireBurning(T2TowerEvent* inTowerEvent, CResFile* inResFile, in Sounds->Play("FIREBURNING:FIRE", SoundMask_10, SoundFlags_10 | SoundFlags_10000, NULL, PlayMode_3, 100); dialogText = LoadStringTable(GetWorldModuleHandle(), 8100, 4); - switch (DoDialog(inDoc, 8110, 5101, 1, dialogText)) { + switch (DoDialog(inTowerDoc, 8110, 5101, 1, dialogText)) { case 8114: - mHelicopter = new T2Helicopter(inDoc, inTenant); + mHelicopter = new T2Helicopter(inTowerDoc, inTenant); mFightAction = kFireFightHelicopter; break; case 8115: - CallFireman(inDoc, inTenant); + CallFireman(inTowerDoc, inTenant); mFightAction = kFireFightFireman; break; case 8116: @@ -636,6 +637,7 @@ BOOL T2Fire::ExtinguishByFireman(T2TowerDoc* inDoc, T2PeoplePtrList* inPeopleLis mSprite->GetSpriteRect(mFireSpriteID, rect); CPoint theFirePos = rect.TopLeft(); + // should this be theFirePt? as per Mac asserts theFirePos.x += rect.Width() / 2; UT2Coordinate::QDToUnit(theFirePos, 0); diff --git a/src/T2DLL/T2FireBurning.h b/src/T2DLL/T2FireBurning.h index 6aca35c..1f0bec8 100644 --- a/src/T2DLL/T2FireBurning.h +++ b/src/T2DLL/T2FireBurning.h @@ -25,7 +25,7 @@ public: virtual int Exec(T2TowerDoc* inDoc); virtual void StopEvent(T2TowerDoc* inDoc); virtual unsigned int DialogHook(T2EventDialog* inDialog, unsigned int inResult, T2TowerDoc* inDoc); - virtual void StartEvent(T2TowerDoc* inDoc, POINT inPt, const T2Tenant* inTenant); + virtual void StartEvent(T2TowerDoc* inTowerDoc, POINT inPt, const T2Tenant* inTenant); virtual void IdleEvent(T2TowerDoc* inDoc); BOOL MakeFire(POINT inPt, T2TowerDoc* inDoc); void Extinguish(T2Fire* inFire); diff --git a/src/T2DLL/T2FireWork.cpp b/src/T2DLL/T2FireWork.cpp index 0929af8..11bb86f 100644 --- a/src/T2DLL/T2FireWork.cpp +++ b/src/T2DLL/T2FireWork.cpp @@ -101,7 +101,7 @@ BOOL T2FireWork::Idle() { for (ind = 0; ind < 20; ind++) { if (!mUsed[ind]) { #pragma var_order(var24, var28, var2C, bufferSize, var34, var38) - float var24 = (((rand() % 40) - 20) / 100.0f) + 0.0f; + float var24 = (((rand() % 40) - 20) / 100.0f) + 0.8f; float var38 = var24; float var28 = int((var38 * 6.283186) / 0.18) / 4; int var34 = 1; @@ -212,7 +212,7 @@ BOOL T2FireWork::Idle() { float var68 = int((var84 * 6.283186) / 0.18) / 4; int var80 = 1; - float var7C = mRect.bottom * 0.016; + float var7C = mRect.bottom * 0.016f; for (float var70 = 0.0f; var70 <= var68; var70 += 1.0f) { #pragma var_order(var8C, var90, var94) diff --git a/src/T2DLL/T2InfoDialog.cpp b/src/T2DLL/T2InfoDialog.cpp index 60ba8e8..8f9b155 100644 --- a/src/T2DLL/T2InfoDialog.cpp +++ b/src/T2DLL/T2InfoDialog.cpp @@ -11,20 +11,20 @@ T2InfoDialog::T2InfoDialog(T2DrawableObject* object) { } /*virtual*/ void T2InfoDialog::GetCommentString(unsigned int id, CString& outStr) const { - char buf[256]; - int size = 256; - HINSTANCE hInstance = NULL; + int bufLen = 256; + HINSTANCE theInstance = NULL; + char buffer[256]; if (id < 0x10000001) { - hInstance = AfxGetInstanceHandle(); + theInstance = AfxGetInstanceHandle(); } else { - hInstance = ((T2Equip *) mObject)->GetEquipDef()->GetModuleHandle(); + theInstance = ((T2Equip *) mObject)->GetEquipDef()->GetModuleHandle(); id -= 0x10000001; } - int result = LoadString(hInstance, id + 1023, buf, size); - if (result) - outStr = buf; + int len = LoadString(theInstance, id + 1023, buffer, bufLen); + if (len) + outStr = buffer; else outStr = "調整中です。"; } diff --git a/src/T2DLL/T2Matter.cpp b/src/T2DLL/T2Matter.cpp index 4af52e5..b97f410 100644 --- a/src/T2DLL/T2Matter.cpp +++ b/src/T2DLL/T2Matter.cpp @@ -108,13 +108,13 @@ BOOL T2Matter::PopReturn(unsigned int& outTenant, unsigned int& outTime) { } BOOL T2Matter::SetReturnToDestination() { - BOOL result = false; - unsigned int tenant, time; - if (mReturnStack->Pop(tenant, time)) { - SetDestination(tenant, time); - result = true; + BOOL isReturn = false; + unsigned int tenantID, startTime; + if (mReturnStack->Pop(tenantID, startTime)) { + SetDestination(tenantID, startTime); + isReturn = true; } - return result; + return isReturn; } BOOL T2Matter::SetDestinationToReturn() { @@ -142,6 +142,7 @@ BOOL T2Matter::RemoveReturn(unsigned int tenant) { T2Object::LoadSelf(archive, towerDoc); if (IsUsed()) { +#pragma var_order(c, s, us, code) unsigned short us; short s; char c; @@ -188,6 +189,7 @@ BOOL T2Matter::RemoveReturn(unsigned int tenant) { T2Object::SaveSelf(archive); if (IsUsed()) { +#pragma var_order(c, s, us, code) unsigned short us; short s; char c; diff --git a/src/T2DLL/T2MatterDef.cpp b/src/T2DLL/T2MatterDef.cpp index 298c851..3021754 100644 --- a/src/T2DLL/T2MatterDef.cpp +++ b/src/T2DLL/T2MatterDef.cpp @@ -19,8 +19,8 @@ T2MatterDef::T2MatterDef(DWORD type, T2PluginSpecifier& specifier, CResFile* res } /*virtual*/ void T2MatterDef::AssignSilhouette(T2TemplatePluginList* list) { - T2SilhouetteDef *silhouetteDef = list->FindSilhouette(mSilhouetteID); + T2SilhouetteDef *theSilhouetteDef = list->FindSilhouette(mSilhouetteID); #line 31 - _ASSERT(silhouetteDef); - mSilhouetteDef = silhouetteDef; + _ASSERT(theSilhouetteDef != NULL); + mSilhouetteDef = theSilhouetteDef; } diff --git a/src/T2DLL/T2Message.cpp b/src/T2DLL/T2Message.cpp index f8cf66f..15876af 100644 --- a/src/T2DLL/T2Message.cpp +++ b/src/T2DLL/T2Message.cpp @@ -7,16 +7,17 @@ static char THIS_FILE[] = __FILE__; #endif -static BOOL s100E3E08; - // unknown name - 100E3E0C static BOOL sVisible; +static BOOL s100E3E08; + T2Message::T2Message() { } void T2Message::ShowMessage(const CString& str) { if (!sVisible) { +#pragma var_order(rect, bmi, pixels, brushResult, y, pattern, cols, buffer, x) sVisible = true; s100E3E08 = true; @@ -44,26 +45,27 @@ void T2Message::ShowMessage(const CString& str) { cols[1].rgbBlue = 0; unsigned char *pixels = ((unsigned char *) buffer) + sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * 2; - unsigned char row[8]; - row[0] = 1; - row[1] = 1; - row[2] = 1; - row[3] = 1; - row[4] = 0; - row[5] = 0; - row[6] = 0; - row[7] = 0; - - for (int y = 0; y < 8; y++) { - for (int x = 0; x < 8; x++) { - pixels[x + y * 8] = row[(x + y) % 8]; + unsigned char pattern[8]; + pattern[0] = 1; + pattern[1] = 1; + pattern[2] = 1; + pattern[3] = 1; + pattern[4] = 0; + pattern[5] = 0; + pattern[6] = 0; + pattern[7] = 0; + + int x, y; + for (y = 0; y < 8; y++) { + for (x = 0; x < 8; x++) { + pixels[x + y * 8] = pattern[(x + y) % 8]; } } - int result = mBrush.CreateDIBPatternBrush((const void *) buffer, DIB_RGB_COLORS); + BOOL brushResult = mBrush.CreateDIBPatternBrush((const void *) buffer, DIB_RGB_COLORS); free(buffer); #line 64 - _ASSERT(result != 0); + _ASSERT(brushResult != false); mString = AfxRegisterWndClass(CS_VREDRAW | CS_HREDRAW | CS_NOCLOSE, NULL, (HBRUSH) GetStockObject(WHITE_BRUSH)); @@ -103,6 +105,7 @@ int T2Message::OnCreate(CREATESTRUCT* cs) { if (CWnd::OnCreate(cs) == -1) return -1; +#pragma var_order(desktopRect, save, str, cursorPos, clientRect, dc) CString str; GetWindowText(str); @@ -229,7 +232,8 @@ void T2Message::OnDestroy() { KillTimer(1); } -int T2Message::OnEraseBkgnd(CDC* dc) { +BOOL T2Message::OnEraseBkgnd(CDC* dc) { +#pragma var_order(rect2, brush, pen, save, rect1, brush2) CRect rect1; GetClientRect(rect1); @@ -282,6 +286,7 @@ int T2Message::OnEraseBkgnd(CDC* dc) { dc->SetBkMode(TRANSPARENT); dc->SelectObject(mFont); +#pragma var_order(textRect, str) CString str; GetWindowText(str); diff --git a/src/T2DLL/T2Message.h b/src/T2DLL/T2Message.h index bfd3a0c..7a6bb85 100644 --- a/src/T2DLL/T2Message.h +++ b/src/T2DLL/T2Message.h @@ -16,7 +16,7 @@ protected: void OnRButtonDown(UINT, CPoint); void OnKeyDown(UINT, UINT, UINT); void OnDestroy(); - int OnEraseBkgnd(CDC*); + BOOL OnEraseBkgnd(CDC*); protected: CString mString; diff --git a/src/T2DLL/T2MetroRailway.cpp b/src/T2DLL/T2MetroRailway.cpp index 89b44a5..5653e83 100644 --- a/src/T2DLL/T2MetroRailway.cpp +++ b/src/T2DLL/T2MetroRailway.cpp @@ -135,7 +135,7 @@ void T2MetroRailway::Init(T2Transport* inParent, CResFile* inResFile) { whichSound = 1; var1C = 0; } else { - var1C += theNow->mSeconds * 4; + var1C = var1C * 4 + theNow->mSeconds; } } diff --git a/src/T2DLL/T2Mover.cpp b/src/T2DLL/T2Mover.cpp index f62f502..65120c1 100644 --- a/src/T2DLL/T2Mover.cpp +++ b/src/T2DLL/T2Mover.cpp @@ -300,9 +300,9 @@ void T2Mover::RemoveUnstoppable(T2TowerDoc* towerDoc) { T2MoverDef *theMoverDef = (T2MoverDef *) GetEquipDef(); BOOL changed = false; - for (int i = 0; i < mLength; i++) { - if (IsStopPosition(i) && !theMoverDef->IsaKindOfStopProc(towerDoc, this, i, 0)) { - RemoveStopBoth(towerDoc, i); + for (int p = 0; p < mLength; p++) { + if (IsStopPosition(p) && !theMoverDef->IsaKindOfStopProc(towerDoc, this, p, 0)) { + RemoveStopBoth(towerDoc, p); changed = true; } } @@ -321,21 +321,23 @@ void T2Mover::AddCrossEquipID(T2FloorInfo* floorInfo, int position) { } void T2Mover::AddCEFloorID(T2FloorInfo* floorInfo, int position) { - POINT stopPt = PositionToStopPt(position, ERequestUpDown_0); - unsigned int floorID = floorInfo->GetFloorID(stopPt.y, stopPt.x); + POINT thePt = PositionToStopPt(position, ERequestUpDown_0); + unsigned int theOldFloorID; + unsigned int theFloorID = floorInfo->GetFloorID(thePt.y, thePt.x); - if (floorID != 0) { + if (theFloorID != 0) { int i; for (i = position - 1; i >= 0; i--) { if (IsStopPosition(i)) break; } - unsigned int idA = 0; + // BUG? The result of this GetFloorID call is assigned to theOldFloorID in the Mac version + theOldFloorID = 0; if (i >= 0) - floorInfo->GetFloorID(stopPt.y, stopPt.x - (position - i)); + floorInfo->GetFloorID(thePt.y, thePt.x - (position - i)); - InsertCEID(idA, floorID); + InsertCEID(theOldFloorID, theFloorID); } } @@ -349,10 +351,10 @@ POINT T2Mover::PositionToStopPt(int position, ERequestUpDown upDown) { result.x = 0; result.y = 0; - T2MoverDef *theMoverDef = (T2MoverDef *) GetEquipDef(); - if (theMoverDef) { + T2MoverDef *moverDef = (T2MoverDef *) GetEquipDef(); + if (moverDef) { RECT addSize; - theMoverDef->GetAddSize(addSize); + moverDef->GetAddSize(addSize); result.y = mArea.bottom - 1 - addSize.bottom - position; if (upDown == ERequestUpDown_0) @@ -378,10 +380,10 @@ int T2Mover::UnitToPosition(int unit) const { int T2Mover::PositionToUnit(int position) const { int result = mArea.bottom - 1 - position; - T2MoverDef *theMoverDef = (T2MoverDef *) GetEquipDef(); - if (theMoverDef) { + T2MoverDef *theDef = (T2MoverDef *) GetEquipDef(); + if (theDef) { RECT addSize; - theMoverDef->GetAddSize(addSize); + theDef->GetAddSize(addSize); result -= addSize.bottom; } @@ -443,16 +445,16 @@ int T2Mover::GetModuleCount() const { } BOOL T2Mover::FindStairModule(T2TowerDoc* towerDoc, POINT pt, T2MoverModule*& module1, T2MoverModule*& module2) { - int var; - PARTCODE partCode = GetPartFromPoint(towerDoc, pt, &var); - BOOL result = (partCode == PartCode_2 && var >= 0); + int index; + PARTCODE thePartCode = GetPartFromPoint(towerDoc, pt, &index); + BOOL found = (thePartCode == PartCode_2 && index >= 0); - if (result) { - if (!mModuleList->FetchItemAt(var, &module1) || !mModuleList->FetchItemAt(var + 1, &module2)) - result = false; + if (found) { + if (!mModuleList->FetchItemAt(index, &module1) || !mModuleList->FetchItemAt(index + 1, &module2)) + found = false; } - return result; + return found; } int T2Mover::CalcModuleRect(const T2MoverModule* module, RECT& rect, int& unk) const { @@ -460,21 +462,21 @@ int T2Mover::CalcModuleRect(const T2MoverModule* module, RECT& rect, int& unk) c } T2MoverModule* T2Mover::FindPeople(const T2People* inPeople) const { - T2MoverModule *result = NULL; - T2MoverModuleList *theList = GetModuleList(); + T2MoverModule *theMoverModule = NULL; + T2MoverModuleList *theModuleList = GetModuleList(); - if (theList) { - LArrayIterator moduleIterator(*theList); + if (theModuleList) { + LArrayIterator moduleIterator(*theModuleList); T2MoverModule *moverModule; - while (!result && moduleIterator.Next(&moverModule)) { + while (!theMoverModule && moduleIterator.Next(&moverModule)) { if (moverModule->IsUsed() && moverModule->mLink1) { - T2PeopleLinkIterator peopleIterator((T2People *) moverModule->mLink1); - T2People *people; + T2PeopleLinkIterator peopleLinkIterator((T2People *) moverModule->mLink1); + T2People *thePeople; - while (peopleIterator.Next(&people)) { - if (people == inPeople) { - result = moverModule; + while (peopleLinkIterator.Next(&thePeople)) { + if (thePeople == inPeople) { + theMoverModule = moverModule; break; } } @@ -482,7 +484,7 @@ T2MoverModule* T2Mover::FindPeople(const T2People* inPeople) const { } } - return result; + return theMoverModule; } void T2Mover::CalcMachineArea(EEquipPos pos, RECT& rect) const { @@ -540,51 +542,51 @@ int T2Mover::CalcScore(int multiplier) const { return result; } -int T2Mover::ExpandArea(T2TowerDoc* towerDoc, EEquipPos pos, int count) { +int T2Mover::ExpandArea(T2TowerDoc* inDoc, EEquipPos inEquipPos, int inCount) { int result = 0; - T2FloorInfo *theFloorInfo = towerDoc->towerDoc_vf12C(); + T2FloorInfo *theFloorInfo = inDoc->towerDoc_vf12C(); - RECT area = mArea; + RECT theMoverArea = mArea; - RECT addSize; - ((T2MoverDef *) mToolDef)->GetAddSize(addSize); + RECT theAddSize; + ((T2MoverDef *) mToolDef)->GetAddSize(theAddSize); - switch (pos) { + switch (inEquipPos) { case EEquipPos_2: - if (count < 0) { - for (int i = 0; i < -count; i++) { - int position = mLength - 1 - i; - if (IsStopPosition(position)) { - RemoveStopBoth(towerDoc, position); + if (inCount < 0) { + for (int i = 0; i < -inCount; i++) { + int pos = mLength - 1 - i; + if (IsStopPosition(pos)) { + RemoveStopBoth(inDoc, pos); result = 2; } } } - mArea.top -= count; - mLength += count; - mReqIDArray->Expand(ReqIDArrayPos_1, count); - ((T2ElvModuleList *) mModuleList)->MoverExpanded(this, EEquipPos_2, count); + mArea.top -= inCount; + mLength += inCount; + mReqIDArray->Expand(ReqIDArrayPos_1, inCount); + ((T2ElvModuleList *) mModuleList)->MoverExpanded(this, EEquipPos_2, inCount); - if (count > 0) { - area.bottom = area.top; - area.top -= count; - theFloorInfo->MoverAreaAdded(area, mEquipID); - area.bottom += -addSize.top; + if (inCount > 0) { + theMoverArea.bottom = theMoverArea.top; + theMoverArea.top -= inCount; + theFloorInfo->MoverAreaAdded(theMoverArea, mEquipID); + theMoverArea.bottom += -theAddSize.top; } else { - area.bottom = area.top - count; - theFloorInfo->MoverAreaRemoved(area); - area.bottom += -addSize.top + 1; + theMoverArea.bottom = theMoverArea.top - inCount; + theFloorInfo->MoverAreaRemoved(theMoverArea); + theMoverArea.bottom += -theAddSize.top + 1; } - if (count > 0) { - RemoveUnstoppable(towerDoc); + if (inCount > 0) { + RemoveUnstoppable(inDoc); T2MoverDef *theMoverDef = (T2MoverDef *) GetEquipDef(); - for (int i = 0; i < count; i++) { - int position = mLength - 1 - i; + for (int i = 0; i < inCount; i++) { + int pos = mLength - 1 - i; if (theMoverDef->GetMaxStop() == 0 || GetNumStop() < theMoverDef->GetMaxStop()) { - if (theMoverDef->IsaKindOfStopProc(towerDoc, this, position, 1) && !IsStopPosition(position)) { - AddStopBoth(towerDoc, position); + if (theMoverDef->IsaKindOfStopProc(inDoc, this, pos, 1) && !IsStopPosition(pos)) { + AddStopBoth(inDoc, pos); result = 1; } } @@ -594,38 +596,38 @@ int T2Mover::ExpandArea(T2TowerDoc* towerDoc, EEquipPos pos, int count) { break; case EEquipPos_3: - if (count < 0) { - for (int position = 0; position < -count; position++) { - if (IsStopPosition(position)) { - RemoveStopBoth(towerDoc, position); + if (inCount < 0) { + for (int pos = 0; pos < -inCount; pos++) { + if (IsStopPosition(pos)) { + RemoveStopBoth(inDoc, pos); result = 2; } } } - mArea.bottom += count; - mLength += count; - mReqIDArray->Expand(ReqIDArrayPos_0, count); - ((T2ElvModuleList *) mModuleList)->MoverExpanded(this, EEquipPos_3, count); + mArea.bottom += inCount; + mLength += inCount; + mReqIDArray->Expand(ReqIDArrayPos_0, inCount); + ((T2ElvModuleList *) mModuleList)->MoverExpanded(this, EEquipPos_3, inCount); - if (count > 0) { - area.top = area.bottom; - area.bottom += count; - theFloorInfo->MoverAreaAdded(area, mEquipID); - area.top -= addSize.bottom; + if (inCount > 0) { + theMoverArea.top = theMoverArea.bottom; + theMoverArea.bottom += inCount; + theFloorInfo->MoverAreaAdded(theMoverArea, mEquipID); + theMoverArea.top -= theAddSize.bottom; } else { - area.top = area.bottom + count; - theFloorInfo->MoverAreaRemoved(area); - area.top -= addSize.bottom + 1; + theMoverArea.top = theMoverArea.bottom + inCount; + theFloorInfo->MoverAreaRemoved(theMoverArea); + theMoverArea.top -= theAddSize.bottom + 1; } - if (count > 0) { - RemoveUnstoppable(towerDoc); + if (inCount > 0) { + RemoveUnstoppable(inDoc); T2MoverDef *theMoverDef = (T2MoverDef *) GetEquipDef(); - for (int position = 0; position < count; position++) { + for (int pos = 0; pos < inCount; pos++) { if (theMoverDef->GetMaxStop() == 0 || GetNumStop() < theMoverDef->GetMaxStop()) { - if (theMoverDef->IsaKindOfStopProc(towerDoc, this, position, 1) && !IsStopPosition(position)) { - AddStopBoth(towerDoc, position); + if (theMoverDef->IsaKindOfStopProc(inDoc, this, pos, 1) && !IsStopPosition(pos)) { + AddStopBoth(inDoc, pos); result = 1; } } @@ -635,8 +637,8 @@ int T2Mover::ExpandArea(T2TowerDoc* towerDoc, EEquipPos pos, int count) { break; } - if (count != 0) - towerDoc->GetTowerMainView()->tmv_vf128(area, true); + if (inCount != 0) + inDoc->GetTowerMainView()->tmv_vf128(theMoverArea, true); return result; } @@ -708,6 +710,7 @@ void T2Mover::HideShaft() { mCapacity = GetEquipDef()->GetCapacity(); } +#pragma var_order(uc, s) unsigned char uc; short s; @@ -733,6 +736,7 @@ void T2Mover::HideShaft() { if (GetEquipDef()) { GetEquipDef()->LoadExtraData(archive, towerDoc, this); } else { +#pragma var_order(i, count) int count; archive >> count; diff --git a/src/T2DLL/T2Mover.h b/src/T2DLL/T2Mover.h index 9a303d9..606ea09 100644 --- a/src/T2DLL/T2Mover.h +++ b/src/T2DLL/T2Mover.h @@ -55,7 +55,7 @@ public: void AdjustLength(); T2Request* GetRequest(T2FloorInfo* floorInfo, int position, BOOL isDown) const; int CalcScore(int) const; - int ExpandArea(T2TowerDoc* towerDoc, EEquipPos pos, int count); + int ExpandArea(T2TowerDoc* inDoc, EEquipPos inEquipPos, int inCount); BOOL IsHomePosition(int) const; void CalcBodyArea(RECT&) const; int CalcModulePos(T2MoverModule*, ERequestUpDown); diff --git a/src/T2DLL/T2MoverArrayList.cpp b/src/T2DLL/T2MoverArrayList.cpp index d36c2de..716419a 100644 --- a/src/T2DLL/T2MoverArrayList.cpp +++ b/src/T2DLL/T2MoverArrayList.cpp @@ -35,37 +35,37 @@ T2Mover* T2MoverArrayList::GetMoverByID(unsigned int inMoverID) { if (inMoverID == 0) return NULL; - int groupID = (inMoverID - 1) / T2MoverArray::kGroupSize; + int groupNum = (inMoverID - 1) / T2MoverArray::kGroupSize; int indexInGroup = (inMoverID - 1) % T2MoverArray::kGroupSize; - if (GetCount() > groupID) - return GetItemAt(groupID + 1)->GetIndexMover(indexInGroup); + if (GetCount() > groupNum) + return GetItemAt(groupNum + 1)->GetIndexMover(indexInGroup); else return NULL; } T2Mover* T2MoverArrayList::FindUnusedMover() { - T2Mover *result = NULL; - LArrayIterator iterator(*this); + T2Mover *theMover = NULL; + LArrayIterator iter(*this); T2MoverArray *theArray = NULL; - while (!result && iterator.Next(&theArray)) - result = theArray->FindUnusedMover(); + while (!theMover && iter.Next(&theArray)) + theMover = theArray->FindUnusedMover(); - if (!result) { - unsigned int startID = 1; + if (!theMover) { + unsigned int lastStartID = 1; if (theArray) - startID = theArray->GetStartID() + T2MoverArray::kGroupSize; + lastStartID = theArray->GetStartID() + T2MoverArray::kGroupSize; - if ((startID + T2MoverArray::kGroupSize) < 1000) { - theArray = new T2MoverArray(startID); + if ((lastStartID + T2MoverArray::kGroupSize) < 1000) { + theArray = new T2MoverArray(lastStartID); if (theArray) { Add(theArray); - result = theArray->FindUnusedMover(); + theMover = theArray->FindUnusedMover(); } } } - return result; + return theMover; } void T2MoverArrayList::DrawMoverAll(T2TowerDoc* inDoc, const RECT& inRect) { @@ -96,10 +96,10 @@ void T2MoverArrayList::Read(T2Archive& inArchive, T2TowerDoc* inDoc) { startID += T2MoverArray::kGroupSize; } - LArrayIterator iterator(*this); + LArrayIterator iter(*this); T2MoverArray *theArray; - while (iterator.Next(&theArray)) + while (iter.Next(&theArray)) theArray->Read(inArchive, inDoc); } @@ -116,10 +116,10 @@ void T2MoverArrayList::Write(T2Archive& inArchive) { int T2MoverArrayList::CalcMentenanceCost(T2TowerDoc* inDoc) const { int cost = 0; - LArrayIterator iterator(*this); + LArrayIterator iter(*this); T2MoverArray *theArray; - while (iterator.Next(&theArray)) + while (iter.Next(&theArray)) cost += theArray->CalcMentenanceCost(inDoc); return cost; @@ -128,12 +128,12 @@ int T2MoverArrayList::CalcMentenanceCost(T2TowerDoc* inDoc) const { LArray* T2MoverArrayList::MakeMoverList(int inType) { LArray *result = new LArray(sizeof(T2Mover *)); - LArrayIterator iterator(*this); - T2MoverArray *theArray; + LArrayIterator iter(*this); + T2MoverArray *theMoverArray; - while (iterator.Next(&theArray)) { + while (iter.Next(&theMoverArray)) { for (int i = 0; i < T2MoverArray::kGroupSize; i++) { - T2Mover *theMover = &theArray->mMover[i]; + T2Mover *theMover = &theMoverArray->mMover[i]; if (theMover->IsUsed() && theMover->GetEquipType() == inType) result->Add(&theMover); } diff --git a/src/T2DLL/T2MoverDef.cpp b/src/T2DLL/T2MoverDef.cpp index 3928cfb..3d39f27 100644 --- a/src/T2DLL/T2MoverDef.cpp +++ b/src/T2DLL/T2MoverDef.cpp @@ -168,36 +168,36 @@ BOOL T2MoverDef::InitObject(T2Mover* mover, const POINT&) { } /*virtual*/ int T2MoverDef::CalcMentenanceCostProc(const T2HaveOutViewObject* obj) const { - int result = 0; + int cost = 0; T2ToolDef *otherDef = obj->GetToolDef(); if (otherDef->IsSetAttribute(kToolAttrNormalMenteCost)) { - result = otherDef->GetOutMoney(0); + cost = GetOutMoney(0); int moduleCount = ((T2Mover *) obj)->mModuleList->GetModuleCount(); if (((T2Mover *) obj)->IsStair()) moduleCount /= 2; - result = result * moduleCount; + cost = cost * moduleCount; } - return result; + return cost; } /*virtual*/ T2InfoDialog* T2MoverDef::ShowInfoDialog(T2TowerDoc* towerDoc, T2Mover* mover, CPoint pt) { - int var = 0; - PARTCODE partCode = GetPartFromPoint(towerDoc, mover, pt, &var); + int theIndex = 0; + PARTCODE part = GetPartFromPoint(towerDoc, mover, pt, &theIndex); T2InfoDialog *dialog = NULL; - if (partCode != PartCode_0) { + if (part != PartCode_0) { CRect rect; AfxGetMainWnd()->GetWindowRect(rect); T2DLGTEMPLATE tmpl; tmpl.pt = rect.CenterPoint(); tmpl.moduleHandle = mModuleHandle; - tmpl.resID = GetInfoDialogID(towerDoc, mover, partCode, var); - dialog = ConstructInfoDialog(mover, partCode, var); + tmpl.resID = GetInfoDialogID(towerDoc, mover, part, theIndex); + dialog = ConstructInfoDialog(mover, part, theIndex); dialog->Realize(this, &tmpl, towerDoc, mImageObj, NULL, true, NULL, 0, true); } diff --git a/src/T2DLL/T2MoverModule.cpp b/src/T2DLL/T2MoverModule.cpp index d4a267b..ae7de97 100644 --- a/src/T2DLL/T2MoverModule.cpp +++ b/src/T2DLL/T2MoverModule.cpp @@ -27,23 +27,23 @@ T2MoverModule::T2MoverModule() { /*virtual*/ void T2MoverModule::SetUsed(BOOL used) { if (!used) { - T2TowerDoc *towerDoc = GetCurrentT2TowerDoc(); + T2TowerDoc *theTowerDoc = GetCurrentT2TowerDoc(); #line 35 - ASSERT(towerDoc); + ASSERT(theTowerDoc != NULL); - T2NameList *nameList = towerDoc->mNameDB; + T2NameList *theNameDB = theTowerDoc->mNameDB; #line 38 - ASSERT(nameList); + ASSERT(theNameDB != NULL); - T2Name *name = nameList->Search(this, true); + T2Name *name = theNameDB->Search(this, true); if (name) { - nameList->RemoveName(name); + theNameDB->RemoveName(name); delete name; } - name = nameList->Search(this, false); + name = theNameDB->Search(this, false); if (name) { - nameList->RemoveName(name); + theNameDB->RemoveName(name); delete name; } } @@ -52,17 +52,17 @@ T2MoverModule::T2MoverModule() { } /*virtual*/ void T2MoverModule::RemoveContents(T2TowerDoc* towerDoc) { - T2FloorInfo *floorInfo = towerDoc->mFloorInfo; + T2FloorInfo *theFloorInfo = towerDoc->mFloorInfo; while (mLink1) { - T2People *people = (T2People *) mLink1; - Leave(people); - - POINT destPos = people->GetCurrDestPos(); - T2Tenant *floor = floorInfo->GetFloor(destPos.y, destPos.x); - if (floor) { - floor->Enter(people); - people->IncEstimate(-100); + T2People *thePeople = (T2People *) mLink1; + Leave(thePeople); + + POINT destPos = thePeople->GetCurrDestPos(); + T2Tenant *theFloor = theFloorInfo->GetFloor(destPos.y, destPos.x); + if (theFloor) { + theFloor->Enter(thePeople); + thePeople->IncEstimate(-100); } } } diff --git a/src/T2DLL/T2MoverModuleList.cpp b/src/T2DLL/T2MoverModuleList.cpp index f388435..9711ec4 100644 --- a/src/T2DLL/T2MoverModuleList.cpp +++ b/src/T2DLL/T2MoverModuleList.cpp @@ -15,11 +15,11 @@ T2MoverModuleList::T2MoverModuleList() /*virtual*/ T2MoverModuleList::~T2MoverModuleList() { LArrayIterator iterator(*this); - T2MoverModule *moverModule = NULL; + T2MoverModule *theMoverModule = NULL; - while (iterator.Next(&moverModule)) { - if (moverModule) - delete moverModule; + while (iterator.Next(&theMoverModule)) { + if (theMoverModule) + delete theMoverModule; } RemoveItemsAt(mItemCount, 1); @@ -43,11 +43,11 @@ void T2MoverModuleList::AllClear() { /*virtual*/ void T2MoverModuleList::Destruct(T2TowerDoc* towerDoc) { LArrayIterator iterator(*this); - T2MoverModule *moverModule = NULL; + T2MoverModule *theMoverModule = NULL; - while (iterator.Next(&moverModule)) { - if (moverModule) - RemoveModule(towerDoc, moverModule); + while (iterator.Next(&theMoverModule)) { + if (theMoverModule) + RemoveModule(towerDoc, theMoverModule); } } @@ -75,10 +75,10 @@ void T2MoverModuleList::AllClear() { archive << mItemCount; LArrayIterator iterator(*this); - T2MoverModule *moverModule = NULL; + T2MoverModule *theMoverModule = NULL; - while (iterator.Next(&moverModule)) - moverModule->Save(archive); + while (iterator.Next(&theMoverModule)) + theMoverModule->Save(archive); } /*virtual*/ T2MoverModule* T2MoverModuleList::ConstructModule() { @@ -96,22 +96,22 @@ unsigned int T2MoverModuleList::GetItemCount() { } /*static*/ T2MoverModuleList* T2MoverModuleList::ReadMMList(T2Archive& archive, T2TowerDoc* towerDoc) { - T2MoverModuleList *list = NULL; + T2MoverModuleList *theList = NULL; - DWORD code; - archive >> code; + DWORD classID; + archive >> classID; - if (code == '_MML') - list = new T2MoverModuleList; - else if (code == 'ElML') - list = new T2ElvModuleList; - else if (code == 'StML') - list = new T2StairModuleList; + if (classID == '_MML') + theList = new T2MoverModuleList; + else if (classID == 'ElML') + theList = new T2ElvModuleList; + else if (classID == 'StML') + theList = new T2StairModuleList; - if (list) - list->Read(archive, towerDoc); + if (theList) + theList->Read(archive, towerDoc); - return list; + return theList; } /*static*/ void T2MoverModuleList::WriteMMList(T2MoverModuleList* list, T2Archive& archive) { diff --git a/src/T2DLL/T2MoverPlugin.cpp b/src/T2DLL/T2MoverPlugin.cpp index 0b38037..95b4e7e 100644 --- a/src/T2DLL/T2MoverPlugin.cpp +++ b/src/T2DLL/T2MoverPlugin.cpp @@ -17,13 +17,13 @@ BOOL T2MoverPlugin::LoadAllTemplatePlugin(T2WorldDef* worldDef, T2TemplatePlugin typedef T2TemplatePlugin *(MSVC_STDCALL* ConstructTemplatePluginType) (T2PluginSpecifier *, CResFile *, T2WorldDef *, T2MoverPlugin *); void T2MoverPlugin::LoadT2MoverDef(T2WorldDef* worldDef) { - ConstructTemplatePluginType func = (ConstructTemplatePluginType) GetProcAddress((HMODULE) mModuleHandle, "ConstructTemplatePlugin"); + ConstructTemplatePluginType theFunc = (ConstructTemplatePluginType) GetProcAddress((HMODULE) mModuleHandle, "ConstructTemplatePlugin"); #line 26 - _ASSERT(func); + _ASSERT(theFunc); - CResFile resFile; - resFile.OpenResource(mModuleHandle, 1, 'MvDf'); - T2TemplatePlugin *plugin = func(&mSpecifier, &resFile, worldDef, this); + CResFile file; + file.OpenResource(mModuleHandle, 1, 'MvDf'); + T2TemplatePlugin *theDef = theFunc(&mSpecifier, &file, worldDef, this); - mTemplatePlugin = plugin; + mTemplatePlugin = theDef; } diff --git a/src/T2DLL/T2Name.cpp b/src/T2DLL/T2Name.cpp index 7cee408..5febc0c 100644 --- a/src/T2DLL/T2Name.cpp +++ b/src/T2DLL/T2Name.cpp @@ -17,6 +17,7 @@ T2Name::T2Name() { } T2Name::T2Name(T2Archive& archive) { +#pragma var_order(valUChar, valUShort, valInt, str) unsigned short valUShort; unsigned char valUChar; int valInt; @@ -102,17 +103,17 @@ void T2Name::SetName(CString name) { mName = name; } -void T2Name::MakeFullName(T2TowerDoc* towerDoc, CString& outStr) { +void T2Name::MakeFullName(T2TowerDoc* inDoc, CString& outStr) { if (mName != NULL) { switch (GetType()) { case kTenantNameType: - if (towerDoc && towerDoc->towerDoc_vf12C()) { - T2FloorInfo *theFloorInfo = towerDoc->towerDoc_vf12C(); + if (inDoc && inDoc->towerDoc_vf12C()) { + T2FloorInfo *theFloorInfo = inDoc->towerDoc_vf12C(); T2Tenant *theTenant = theFloorInfo->GetTenant(GetID()); if (theTenant) { CString str; - int roomNumber = theTenant->GetRoomNumber(theFloorInfo); - UT2Utils::GetRoomNumberString(roomNumber, str); + int theRoomNumber = theTenant->GetRoomNumber(theFloorInfo); + UT2Utils::GetRoomNumberString(theRoomNumber, str); str += "\x8D\x86\x8E\xBA"; // "号室" outStr = str + mName; } @@ -120,17 +121,17 @@ void T2Name::MakeFullName(T2TowerDoc* towerDoc, CString& outStr) { break; case kPeopleNameType: - if (towerDoc && towerDoc->towerDoc_vf12C() && towerDoc->mPeopleArrayList) { - T2People *thePeople = towerDoc->mPeopleArrayList->FindPeople(GetID()); + if (inDoc && inDoc->towerDoc_vf12C() && inDoc->mPeopleArrayList) { + T2People *thePeople = inDoc->mPeopleArrayList->FindPeople(GetID()); if (thePeople) { - T2FloorInfo *theFloorInfo = towerDoc->towerDoc_vf12C(); - int tenantID = (thePeople->GetWorkTenant() > 1) ? thePeople->GetWorkTenant() : (thePeople->GetHomeTenant() > 1) ? thePeople->GetHomeTenant() : 1; + T2FloorInfo *theFloorInfo = inDoc->towerDoc_vf12C(); + int theTenantID = (thePeople->GetWorkTenant() > 1) ? thePeople->GetWorkTenant() : (thePeople->GetHomeTenant() > 1) ? thePeople->GetHomeTenant() : 1; CString str; - T2Tenant *theTenant = theFloorInfo->GetTenant(tenantID); + T2Tenant *theTenant = theFloorInfo->GetTenant(theTenantID); if (theTenant) { - int roomNumber = theTenant->GetRoomNumber(theFloorInfo); - UT2Utils::GetRoomNumberString(roomNumber, str); + int theRoomNumber = theTenant->GetRoomNumber(theFloorInfo); + UT2Utils::GetRoomNumberString(theRoomNumber, str); str += "\x8D\x86\x8E\xBA"; // "号室" } else { str = "\x83\x65\x83\x69\x83\x93\x83\x67\x82\xC8\x82\xB5"; // "テナントなし" diff --git a/src/T2DLL/T2NameList.cpp b/src/T2DLL/T2NameList.cpp index 44ee91f..8fda1d6 100644 --- a/src/T2DLL/T2NameList.cpp +++ b/src/T2DLL/T2NameList.cpp @@ -105,35 +105,35 @@ T2Name* T2NameList::Search(const T2People* people, BOOL isFavorite) const { T2Name* T2NameList::Search(const CString& str, BOOL isFavorite) const { LArrayIterator iterator(*this); - T2Name *result = NULL; - T2Name *name = NULL; + T2Name *theFoundName = NULL; + T2Name *theName = NULL; - while (iterator.Next(&name)) { - if (name->IsFavorite() == isFavorite && *name == str) { - result = name; + while (iterator.Next(&theName)) { + if (theName->IsFavorite() == isFavorite && *theName == str) { + theFoundName = theName; break; } } - return result; + return theFoundName; } T2Name* T2NameList::FullNameSearch(T2TowerDoc* towerDoc, const CString& str, BOOL isFavorite) const { LArrayIterator iterator(*this); - T2Name *result = NULL; - T2Name *name = NULL; + T2Name *theFoundName = NULL; + T2Name *theName = NULL; - while (iterator.Next(&name)) { + while (iterator.Next(&theName)) { CString fullName; - name->MakeFullName(towerDoc, fullName); - BOOL nameMatches = (fullName == str); - if (name->IsFavorite() == isFavorite && nameMatches) { - result = name; + theName->MakeFullName(towerDoc, fullName); + BOOL isMatch = (str == fullName); + if (theName->IsFavorite() == isFavorite && isMatch) { + theFoundName = theName; break; } } - return result; + return theFoundName; } void T2NameList::Read(T2Archive& archive) { @@ -151,8 +151,8 @@ void T2NameList::Write(T2Archive& archive) const { archive << count; LArrayIterator iterator(*this); - T2Name *name; + T2Name *theName; - while (iterator.Next(&name)) - name->Write(archive); + while (iterator.Next(&theName)) + theName->Write(archive); } diff --git a/src/T2DLL/T2OptionPluginList.cpp b/src/T2DLL/T2OptionPluginList.cpp index d060b95..278086d 100644 --- a/src/T2DLL/T2OptionPluginList.cpp +++ b/src/T2DLL/T2OptionPluginList.cpp @@ -22,11 +22,11 @@ void T2OptionPluginList::OnIdle(T2TowerDoc* towerDoc) { BOOL T2OptionPluginList::DispatchEvent(OPTIONEVENTTYPE eventType, T2TowerDoc* towerDoc, void* data) { LArrayIterator iterator(*this); - T2OptionPlugin *plugin; BOOL result = true; - while (iterator.Next(&plugin)) { - result = result && plugin->OnEvent(eventType, towerDoc, data); + T2OptionPlugin *thePlugin; + while (iterator.Next(&thePlugin)) { + result = result && thePlugin->OnEvent(eventType, towerDoc, data); } return result; diff --git a/src/T2DLL/T2OutObj.cpp b/src/T2DLL/T2OutObj.cpp index 570e77c..29c1fca 100644 --- a/src/T2DLL/T2OutObj.cpp +++ b/src/T2DLL/T2OutObj.cpp @@ -106,11 +106,11 @@ T2OutObj::T2OutObj() { if (mToolDef) { mToolDef->LoadExtraData(archive, towerDoc, this); } else { - int count; - archive >> count; + char tmp; + int len; + archive >> len; - for (int i = 0; i < count; i++) { - char tmp; + for (int i = 0; i < len; i++) { archive >> tmp; } } diff --git a/src/T2DLL/T2OuterObjDef.cpp b/src/T2DLL/T2OuterObjDef.cpp index 5c8ec2a..f06e18e 100644 --- a/src/T2DLL/T2OuterObjDef.cpp +++ b/src/T2DLL/T2OuterObjDef.cpp @@ -51,8 +51,7 @@ T2OuterObjDef::T2OuterObjDef(DWORD type, T2PluginSpecifier& specifier, CResFile* if (IntersectRect(&intersect, &theOutObj->_3C, &rect)) { if (arg2) { // "重ねて設置できません" - cannot be placed on top of each other - CString str = "\x8F\x64\x82\xCB\x82\xC4\x90\xDD\x92\x75\x82\xC5\x82\xAB\x82\xDC\x82\xB9\x81\xF1"; - (new T2Message)->ShowMessage(str); + (new T2Message)->ShowMessage("\x8F\x64\x82\xCB\x82\xC4\x90\xDD\x92\x75\x82\xC5\x82\xAB\x82\xDC\x82\xB9\x81\xF1"); } return AreaCheckCode_0; } @@ -63,8 +62,7 @@ T2OuterObjDef::T2OuterObjDef(DWORD type, T2PluginSpecifier& specifier, CResFile* if (!inDoc->mFloorInfo->GetTenant(y, x)) { if (arg2) { // "はみだして設置できません" - it cannot be installed as it protrudes - CString str = "\x82\xCD\x82\xDD\x82\xBE\x82\xB5\x82\xC4\x90\xDD\x92\x75\x82\xC5\x82\xAB\x82\xDC\x82\xB9\x82\xF1"; - (new T2Message)->ShowMessage(str); + (new T2Message)->ShowMessage("\x82\xCD\x82\xDD\x82\xBE\x82\xB5\x82\xC4\x90\xDD\x92\x75\x82\xC5\x82\xAB\x82\xDC\x82\xB9\x82\xF1"); } return AreaCheckCode_0; } @@ -74,8 +72,7 @@ T2OuterObjDef::T2OuterObjDef(DWORD type, T2PluginSpecifier& specifier, CResFile* if (rect.bottom > (inDoc->mWorldDef->mGroundLine - inDoc->mWorldDef->mLobbyHeight)) { if (arg2) { // "ここには設置できません" - cannot be installed here - CString str = "\x82\xB1\x82\xB1\x82\xC9\x82\xCD\x90\xDD\x92\x75\x82\xC5\x82\xAB\x82\xDC\x82\xB9\x82\xF1"; - (new T2Message)->ShowMessage(str); + (new T2Message)->ShowMessage("\x82\xB1\x82\xB1\x82\xC9\x82\xCD\x90\xDD\x92\x75\x82\xC5\x82\xAB\x82\xDC\x82\xB9\x82\xF1"); } return AreaCheckCode_0; } @@ -84,17 +81,17 @@ T2OuterObjDef::T2OuterObjDef(DWORD type, T2PluginSpecifier& specifier, CResFile* } /*virtual*/ T2InfoDialog* T2OuterObjDef::ShowInfoDialog(T2TowerDoc* inDoc, T2OutObj* inOutObj) { - CRect windowRect; - AfxGetMainWnd()->GetWindowRect(windowRect); + CRect rect; + AfxGetMainWnd()->GetWindowRect(rect); T2DLGTEMPLATE tmpl; - tmpl.pt = windowRect.CenterPoint(); + tmpl.pt = rect.CenterPoint(); tmpl.moduleHandle = mModuleHandle; tmpl.resID = GetInfoDialogID(inDoc, inOutObj); - T2InfoDialog *theDialog = ConstructInfoDialog(inOutObj); - theDialog->Realize(this, &tmpl, inDoc, mImageObj, NULL, true, NULL, 0, true); - return theDialog; + T2InfoDialog *dialog = ConstructInfoDialog(inOutObj); + dialog->Realize(this, &tmpl, inDoc, mImageObj, NULL, true, NULL, 0, true); + return dialog; } /*virtual*/ int T2OuterObjDef::GetInfoDialogID(T2TowerDoc*, const T2OutObj*) const { diff --git a/src/T2DLL/T2OutsideInfo.cpp b/src/T2DLL/T2OutsideInfo.cpp index cf1f5c0..df0e6a1 100644 --- a/src/T2DLL/T2OutsideInfo.cpp +++ b/src/T2DLL/T2OutsideInfo.cpp @@ -126,43 +126,41 @@ BOOL T2OutsideInfo::NextIndex(int& outIndex) { } BOOL T2OutsideInfo::NextOutObj(T2OutObj*& outOutObj) { - unsigned int id; - BOOL result; - - for (result = NextValue(id); result; result = NextValue(id)) { - if (id != mCurrentOutObjID) { - mCurrentOutObjID = id; - if (id != 0) { - outOutObj = mFloorInfo.mOutObjArrayList->GetOutObjByID(id); + unsigned int theOutObjID; + BOOL found; + + for (found = NextValue(theOutObjID); found; found = NextValue(theOutObjID)) { + if (theOutObjID != mCurrentOutObjID) { + mCurrentOutObjID = theOutObjID; + if (theOutObjID != 0) { + outOutObj = mFloorInfo.mOutObjArrayList->GetOutObjByID(theOutObjID); break; } } } - return result; + return found; } void T2OutsideInfo::Read(T2Archive& inArchive) { - unsigned int count; - inArchive >> count; + unsigned short v; + unsigned int numInfo, unitInfo; + inArchive >> numInfo; - for (unsigned int i = 1; i <= count; i++) { - unsigned short v; + for (unsigned int i = 1; i <= numInfo; i++) { inArchive >> v; - - unsigned int unitInfo = v; + unitInfo = v; mUnitInfo->AssignItemsAt(1, i, &unitInfo); } } void T2OutsideInfo::Write(T2Archive& inArchive) { - unsigned int count = mFloorInfo.mHRange * mFloorInfo.mVRange; - inArchive << count; + unsigned int numInfo, unitInfo; + numInfo = mFloorInfo.mHRange * mFloorInfo.mVRange; + inArchive << numInfo; - for (unsigned int i = 1; i <= count; i++) { - unsigned int unitInfo; + for (unsigned int i = 1; i <= numInfo; i++) { mUnitInfo->FetchItemAt(i, &unitInfo); - inArchive << (unsigned short) unitInfo; } } diff --git a/src/T2DLL/T2PaletteAnime.cpp b/src/T2DLL/T2PaletteAnime.cpp index da9fc8e..d1dee3b 100644 --- a/src/T2DLL/T2PaletteAnime.cpp +++ b/src/T2DLL/T2PaletteAnime.cpp @@ -65,18 +65,18 @@ LOGPALETTE* T2PaletteAnime::MakeInterCTab() { } BOOL T2PaletteAnime::IsSETime() { - BOOL result = false; - DWORD now = TickCount(); + BOOL isSETime = false; + DWORD ticks = TickCount(); - if (mSETimeNextTick <= now) { - mSETimeNextTick = now + 2; + if (mSETimeNextTick <= ticks) { + mSETimeNextTick = ticks + 2; mSECount++; if (mSECount >= 60) mSECount = 0; - result = true; + isSETime = true; } - return result; + return isSETime; } void T2PaletteAnime::ChangeSE() { @@ -88,14 +88,14 @@ void T2PaletteAnime::ChangeSE() { mSEKind = 0; int numOfSEColor = mPaletteAnimeDef->GetNumOfSEColor(); - int interStartIndex = mPaletteAnimeDef->GetNumOfRefrectColor() + mPaletteAnimeDef->GetNumOfSkyColor(); - int seStartIndex = numOfSEColor * mSEKind; - LOGPALETTE *sePal = mPaletteAnimeDef->GetSEPalette(); + int interIndex = mPaletteAnimeDef->GetNumOfRefrectColor() + mPaletteAnimeDef->GetNumOfSkyColor(); + int srcIndex = numOfSEColor * mSEKind; + LOGPALETTE *theSEPalette = mPaletteAnimeDef->GetSEPalette(); for (int i = 0; i < numOfSEColor; i++) { - mInterCTab->palPalEntry[interStartIndex + i].peRed = sePal->palPalEntry[seStartIndex + i].peRed; - mInterCTab->palPalEntry[interStartIndex + i].peGreen = sePal->palPalEntry[seStartIndex + i].peGreen; - mInterCTab->palPalEntry[interStartIndex + i].peBlue = sePal->palPalEntry[seStartIndex + i].peBlue; + mInterCTab->palPalEntry[interIndex + i].peRed = theSEPalette->palPalEntry[srcIndex + i].peRed; + mInterCTab->palPalEntry[interIndex + i].peGreen = theSEPalette->palPalEntry[srcIndex + i].peGreen; + mInterCTab->palPalEntry[interIndex + i].peBlue = theSEPalette->palPalEntry[srcIndex + i].peBlue; } mWorldDef->ChangeSEProc(this); @@ -109,14 +109,14 @@ void T2PaletteAnime::RotateDayLightPalette(unsigned int start, unsigned int coun } void T2PaletteAnime::RotatePalette(LOGPALETTE* pal, unsigned int start, unsigned int count) const { - PALETTEENTRY save = pal->palPalEntry[start]; + PALETTEENTRY theFirstEntry = pal->palPalEntry[start]; for (unsigned int i = start + 1; i < (start + count); i++) { PALETTEENTRY entry = pal->palPalEntry[i]; pal->palPalEntry[i - 1] = entry; } - pal->palPalEntry[start + count - 1] = save; + pal->palPalEntry[start + count - 1] = theFirstEntry; } void T2PaletteAnime::AdjustSkyState(T2DateTime* dateTime) { @@ -142,31 +142,31 @@ void T2PaletteAnime::ChangeSkyColor() { if (result == BOOL3_1) { mPaletteUpdated = true; } else if (result == BOOL3_NEG1) { - int i; - int numOfSkyColor = mPaletteAnimeDef->GetNumOfSkyColor(); - int numOfRefrectColor = mPaletteAnimeDef->GetNumOfRefrectColor(); - LOGPALETTE *dayLightPalette = mPaletteAnimeDef->GetDayLightPalette(); + int n; + int numOfSkyCol = mPaletteAnimeDef->GetNumOfSkyColor(); + int numOfRefrectCol = mPaletteAnimeDef->GetNumOfRefrectColor(); + LOGPALETTE *dayLightPal = mPaletteAnimeDef->GetDayLightPalette(); - for (i = 0; i < numOfSkyColor; i++) { + for (n = 0; n < numOfSkyCol; n++) { RGBQUAD c; - c.rgbRed = dayLightPalette->palPalEntry[i].peRed; - c.rgbGreen = dayLightPalette->palPalEntry[i].peGreen; - c.rgbBlue = dayLightPalette->palPalEntry[i].peBlue; + c.rgbRed = dayLightPal->palPalEntry[n].peRed; + c.rgbGreen = dayLightPal->palPalEntry[n].peGreen; + c.rgbBlue = dayLightPal->palPalEntry[n].peBlue; mDayLightFilter->SkyColor(&c); - mInterCTab->palPalEntry[i].peRed = c.rgbRed; - mInterCTab->palPalEntry[i].peGreen = c.rgbGreen; - mInterCTab->palPalEntry[i].peBlue = c.rgbBlue; + mInterCTab->palPalEntry[n].peRed = c.rgbRed; + mInterCTab->palPalEntry[n].peGreen = c.rgbGreen; + mInterCTab->palPalEntry[n].peBlue = c.rgbBlue; } - for (i = 0; i < numOfRefrectColor; i++) { + for (n = 0; n < numOfRefrectCol; n++) { RGBQUAD c; - c.rgbRed = dayLightPalette->palPalEntry[i + numOfSkyColor].peRed; - c.rgbGreen = dayLightPalette->palPalEntry[i + numOfSkyColor].peGreen; - c.rgbBlue = dayLightPalette->palPalEntry[i + numOfSkyColor].peBlue; + c.rgbRed = dayLightPal->palPalEntry[n + numOfSkyCol].peRed; + c.rgbGreen = dayLightPal->palPalEntry[n + numOfSkyCol].peGreen; + c.rgbBlue = dayLightPal->palPalEntry[n + numOfSkyCol].peBlue; mDayLightFilter->RefractionColor(&c); - mInterCTab->palPalEntry[i + numOfSkyColor].peRed = c.rgbRed; - mInterCTab->palPalEntry[i + numOfSkyColor].peGreen = c.rgbGreen; - mInterCTab->palPalEntry[i + numOfSkyColor].peBlue = c.rgbBlue; + mInterCTab->palPalEntry[n + numOfSkyCol].peRed = c.rgbRed; + mInterCTab->palPalEntry[n + numOfSkyCol].peGreen = c.rgbGreen; + mInterCTab->palPalEntry[n + numOfSkyCol].peBlue = c.rgbBlue; } mPaletteUpdated = true; diff --git a/src/T2DLL/T2People.cpp b/src/T2DLL/T2People.cpp index ce92a22..38fd272 100644 --- a/src/T2DLL/T2People.cpp +++ b/src/T2DLL/T2People.cpp @@ -195,13 +195,13 @@ unsigned int T2People::GetCurTenantID() const { case kStatus11: if (IsStartTime(towerDoc->towerDoc_vf120()->GetRawMinutes())) { - T2FloorInfo *floorInfo = towerDoc->towerDoc_vf12C(); - T2Tenant *tenant = floorInfo->GetTenant(mCurrEquipID); - if (tenant) { + T2FloorInfo *theFloorInfo = towerDoc->towerDoc_vf12C(); + T2Tenant *theCurrTenant = theFloorInfo->GetTenant(mCurrEquipID); + if (theCurrTenant) { if (IsSetDestination()) - tenant->LeaveTenant(towerDoc, this); + theCurrTenant->LeaveTenant(towerDoc, this); else - tenant->PushOutPeople(towerDoc, this); + theCurrTenant->PushOutPeople(towerDoc, this); } } break; @@ -235,8 +235,8 @@ unsigned int T2People::GetCurTenantID() const { case kStatus10: if (!IsWalk()) { if (IsReachDestination(towerDoc->towerDoc_vf12C()->GetGroundLine() - 1)) { - T2FloorInfo *floorInfo = towerDoc->towerDoc_vf12C(); - T2Tenant *theDstTenant = floorInfo->GetTenant(mDstTenant); + T2FloorInfo *theFloorInfo = towerDoc->towerDoc_vf12C(); + T2Tenant *theDstTenant = theFloorInfo->GetTenant(mDstTenant); if (theDstTenant) theDstTenant->EnterTenant(towerDoc, this); } @@ -273,8 +273,8 @@ void T2People::IdleWaitMover(T2TowerDoc* towerDoc) { BOOL didChange = IncStress(5); if (mStress >= 300) { - T2Request *request = theFloorInfo->GetRequest(mCurrEquipID); - request->Leave(this); + T2Request *theRequest = theFloorInfo->GetRequest(mCurrEquipID); + theRequest->Leave(this); JumpToDestination(towerDoc); IncEstimate(-50); didChange = false; @@ -359,11 +359,11 @@ BOOL T2People::MoveToParking(T2TowerDoc* towerDoc) { BOOL T2People::MoveToSubway(T2TowerDoc* towerDoc) { BOOL ok = false; - T2TowerEvent *event = towerDoc->mWorldDef->GetTowerEvent(); - T2DateTime *now = towerDoc->towerDoc_vf120(); - T2Transport *metro = event->GetMetroRailway(); + T2TowerEvent *theEvent = towerDoc->mWorldDef->GetTowerEvent(); + T2DateTime *theCurrTime = towerDoc->towerDoc_vf120(); + T2Transport *metro = theEvent->GetMetroRailway(); if (metro) { - T2Transport *available = metro->GetAvailable(now); + T2Transport *available = metro->GetAvailable(theCurrTime); if (available) { available->Enter(this); ok = true; @@ -433,7 +433,7 @@ void T2People::SolveNoRoute(T2TowerDoc* towerDoc) { if (!FindRoute(towerDoc)) { changed = IncStress(30) && IsWalk(); if (mStress >= 300) { - T2FloorInfo *floorInfo = towerDoc->towerDoc_vf12C(); + T2FloorInfo *theFloorInfo = towerDoc->towerDoc_vf12C(); if (IsWalk()) { // "道がないよ~" - there is no way CString theMessage = "\x93\xB9\x82\xAA\x82\xC8\x82\xA2\x82\xE6\x81\x60"; @@ -441,12 +441,12 @@ void T2People::SolveNoRoute(T2TowerDoc* towerDoc) { RECT theRect; CalcWalkingSilhouetteArea(theRect); - floorInfo->SetTenantDrawModeByRect(theRect, DrawMode1); + theFloorInfo->SetTenantDrawModeByRect(theRect, DrawMode1); towerDoc->GetTowerMainView()->tmv_vf128(theRect, false); } - T2Tenant *tenant = floorInfo->GetTenant(mCurrEquipID); - tenant->Leave(this); + T2Tenant *theFloor = theFloorInfo->GetTenant(mCurrEquipID); + theFloor->Leave(this); JumpToDestination(towerDoc); IncEstimate(-150); } @@ -462,12 +462,12 @@ void T2People::SolveNoRoute(T2TowerDoc* towerDoc) { BOOL T2People::FindRoute(T2TowerDoc* towerDoc) { BOOL ok = false; int status = mStatus; - T2FloorInfo *floorInfo = towerDoc->towerDoc_vf12C(); + T2FloorInfo *theFloorInfo = towerDoc->towerDoc_vf12C(); - if (floorInfo) { - mCurrDestPos = floorInfo->GetEntrancePt(mDstTenant); + if (theFloorInfo) { + mCurrDestPos = theFloorInfo->GetEntrancePt(mDstTenant); if (mCurPosition.y >= 0) { - if (mCurrEquipID == floorInfo->GetEntranceFloorID(mDstTenant)) { + if (mCurrEquipID == theFloorInfo->GetEntranceFloorID(mDstTenant)) { if (mDstTenant == 1 || mDstTenant == 2) status = kStatus12; else if (!IsSetSpecialFlag(kSpecialFlag40)) @@ -505,18 +505,18 @@ BOOL T2People::FindRoute(T2TowerDoc* towerDoc) { } void T2People::JumpToDestination(T2TowerDoc* towerDoc) { - T2FloorInfo *floorInfo = towerDoc->towerDoc_vf12C(); - POINT entrancePt = floorInfo->GetEntrancePt(mDstTenant); + T2FloorInfo *theFloorInfo = towerDoc->towerDoc_vf12C(); + POINT theDestPos = theFloorInfo->GetEntrancePt(mDstTenant); - mCurPosition = entrancePt; - T2Tenant *tenant = floorInfo->GetFloor(mCurPosition.y, mCurPosition.x); - tenant->Enter(this); + mCurPosition = theDestPos; + T2Tenant *theFloor = theFloorInfo->GetFloor(mCurPosition.y, mCurPosition.x); + theFloor->Enter(this); } void T2People::GoOutTower(T2TowerDoc* towerDoc) { - T2Tenant *tenant = towerDoc->towerDoc_vf12C()->GetTenant(mCurrEquipID); - if (tenant) - tenant->Leave(this); + T2Tenant *theFloor = towerDoc->towerDoc_vf12C()->GetTenant(mCurrEquipID); + if (theFloor) + theFloor->Leave(this); T2Pool *pool = towerDoc->towerDoc_vf130(); pool->Enter(this); @@ -543,10 +543,10 @@ void T2People::IdleSearchedPerson(T2TowerDoc* towerDoc) { case kStatus2: { - T2TowerMainView *mainView = towerDoc->GetTowerMainView(); + T2TowerMainView *theView = towerDoc->GetTowerMainView(); RECT area; CalcWalkingSilhouetteArea(area); - mainView->tmv_vf128(area, false); + theView->tmv_vf128(area, false); mStatus = kStatus3; break; } @@ -656,24 +656,24 @@ BOOL T2People::WalkSearchedPersonLeft(T2TowerDoc* towerDoc) { BOOL T2People::IsReachDestination(int y) { BOOL ok = false; - int var = 16; + int theWalkWidth = 16; if (mDirection != 1) { - if ((mCurPosition.x + var) >= mCurrDestPos.x) { - var = mCurrDestPos.x - mCurPosition.x; + if ((mCurPosition.x + theWalkWidth) >= mCurrDestPos.x) { + theWalkWidth = mCurrDestPos.x - mCurPosition.x; ok = true; } - mCurPosition.x += var; + mCurPosition.x += theWalkWidth; } else { - if ((mCurPosition.x - var) <= mCurrDestPos.x) { - var = mCurPosition.x - mCurrDestPos.x; + if ((mCurPosition.x - theWalkWidth) <= mCurrDestPos.x) { + theWalkWidth = mCurPosition.x - mCurrDestPos.x; ok = true; } - mCurPosition.x -= var; + mCurPosition.x -= theWalkWidth; } if (mCurPosition.y != y) - IncStress(var / 4); + IncStress(theWalkWidth / 4); return ok; } @@ -1088,16 +1088,16 @@ void T2People::DrawAt(T2TowerDoc* towerDoc, T2Equip* equip, POINT pt) { } } -void T2People::Duplicate(T2TowerDoc* towerDoc) { +void T2People::Duplicate(T2TowerDoc* inTowerDoc) { #line 1430 - _ASSERT(towerDoc); + _ASSERT(inTowerDoc != NULL); - T2Pool *pool = towerDoc->mPool; + T2Pool *pool = inTowerDoc->mPool; if (pool) pool->DuplicatePeople(mPeopleType); } -void T2People::Remove(T2TowerDoc* towerDoc, unsigned int id) { +void T2People::Remove(T2TowerDoc* inTowerDoc, unsigned int id) { BOOL flag = false; if (mHomeTenant == id) { @@ -1110,7 +1110,7 @@ void T2People::Remove(T2TowerDoc* towerDoc, unsigned int id) { } if (flag && IsGeneral() && GetStatus() == kStatus1) { - T2Pool *pool = towerDoc->towerDoc_vf130(); + T2Pool *pool = inTowerDoc->towerDoc_vf130(); if (pool) pool->RemovePeople(this); } diff --git a/src/T2DLL/T2PeopleArray.cpp b/src/T2DLL/T2PeopleArray.cpp index 91edc64..f60debd 100644 --- a/src/T2DLL/T2PeopleArray.cpp +++ b/src/T2DLL/T2PeopleArray.cpp @@ -44,23 +44,23 @@ T2People* T2PeopleArray::FindUnusedPeople() { /*virtual*/ void T2PeopleArray::DispatchIdle(T2TowerDoc* towerDoc, int startIndex) { int i; - T2People *people; + T2People *thePeople; - people = &mPeople[startIndex]; + thePeople = &mPeople[startIndex]; for (i = startIndex; i < 256; i += 8) { - if (people->mUsed) - people->Idle(towerDoc); - people += 8; + if (thePeople->mUsed) + thePeople->Idle(towerDoc); + thePeople += 8; } - people = mPeople; - int walkRate = towerDoc->towerDoc_vf148(); + thePeople = mPeople; + int theWalkRate = towerDoc->towerDoc_vf148(); for (i = 0; i < 256; i++) { - if (people->mUsed) { - if ((walkRate > 0 && !(i % walkRate)) || people->IsSetSpecialFlag(kSpecialFlag20)) - people->IdleSearchedPerson(towerDoc); + if (thePeople->mUsed) { + if ((theWalkRate > 0 && !(i % theWalkRate)) || thePeople->IsSetSpecialFlag(kSpecialFlag20)) + thePeople->IdleSearchedPerson(towerDoc); } - people++; + thePeople++; } } diff --git a/src/T2DLL/T2PeopleDemandList.cpp b/src/T2DLL/T2PeopleDemandList.cpp index e9fdcdd..f406515 100644 --- a/src/T2DLL/T2PeopleDemandList.cpp +++ b/src/T2DLL/T2PeopleDemandList.cpp @@ -47,7 +47,7 @@ void T2PeopleDemandList::Add(T2PeopleTimeZoneList* inTimeZoneList) { void T2PeopleDemandList::Add(T2PoolGradeDef* inGradeDef) { T2PeopleTimeZoneList *theTimeZoneList; LArrayIterator iterator(*this); - int theDemandType = 0; + int theDemandType = kDemandType0; T2PeopleType peopleType; while (iterator.Next(&theTimeZoneList)) { diff --git a/src/T2DLL/T2PeopleInfoDialog.cpp b/src/T2DLL/T2PeopleInfoDialog.cpp index 26b98a4..9a3dbc5 100644 --- a/src/T2DLL/T2PeopleInfoDialog.cpp +++ b/src/T2DLL/T2PeopleInfoDialog.cpp @@ -102,7 +102,7 @@ T2PeopleInfoDialog::T2PeopleInfoDialog(T2People* people) } else { T2PeopleType *thePeopleType = mPeople->GetPeopleType(); if (thePeopleType) { - if (thePeopleType->GetDemandType() == 3) { + if (thePeopleType->GetDemandType() == kDemandType3) { // "観光客" - tourist str1 = "\x8A\xCF\x8C\xF5\x8B\x71"; } else { diff --git a/src/T2DLL/T2PeoplePtrList.cpp b/src/T2DLL/T2PeoplePtrList.cpp index 315d664..40e1f22 100644 --- a/src/T2DLL/T2PeoplePtrList.cpp +++ b/src/T2DLL/T2PeoplePtrList.cpp @@ -15,22 +15,22 @@ T2PeoplePtrList::T2PeoplePtrList(int count) void T2PeoplePtrList::Init(unsigned int count) { if (count > 0) { AdjustAllocation(count); - T2People *zero = NULL; - InsertItemsAt(count, 1, &zero); + T2People *nullPeople = NULL; + InsertItemsAt(count, 1, &nullPeople); } } BOOL T2PeoplePtrList::Add(T2People* people) { - BOOL result = false; - T2People *zero = NULL; + BOOL done = false; + T2People *nullPeople = NULL; - int index; - if (GetPeopleIndex(zero, index)) { - AssignItemsAt(1, index, &people); - result = true; + int theIndex; + if (GetPeopleIndex(nullPeople, theIndex)) { + AssignItemsAt(1, theIndex, &people); + done = true; } - return result; + return done; } T2People* T2PeoplePtrList::GetItemAt(int index) const { @@ -53,21 +53,21 @@ BOOL T2PeoplePtrList::GetPeopleIndex(T2People* people, int& outIndex) const { } BOOL T2PeoplePtrList::HasSpace() const { - int index; - T2People *zero = NULL; - return GetPeopleIndex(zero, index); + int theIndex; + T2People *nullPeople = NULL; + return GetPeopleIndex(nullPeople, theIndex); } void T2PeoplePtrList::Clear() { - T2People *zero = NULL; - AssignItemsAt(mItemCount, 1, &zero); + T2People *nullPeople = NULL; + AssignItemsAt(mItemCount, 1, &nullPeople); } void T2PeoplePtrList::Clear(T2People* people) { - int index; - if (GetPeopleIndex(people, index)) { - T2People *zero = NULL; - AssignItemsAt(1, index, &zero); + int theIndex; + if (GetPeopleIndex(people, theIndex)) { + T2People *nullPeople = NULL; + AssignItemsAt(1, theIndex, &nullPeople); } } @@ -122,27 +122,27 @@ void T2PeoplePtrList::IncEstimate(int value) { } BOOL T2PeoplePtrList::InSameTenant(unsigned int tenantID) const { - BOOL result = true; + BOOL inSameTenant = true; LArrayIterator iterator(*this); - T2People *people; + T2People *thePeople; - while (result && iterator.Next(&people)) { - if (people && people->GetCurTenantID() != tenantID) - result = false; + while (inSameTenant && iterator.Next(&thePeople)) { + if (thePeople && thePeople->GetCurTenantID() != tenantID) + inSameTenant = false; } - return result; + return inSameTenant; } void T2PeoplePtrList::LoadSelf(T2Archive& archive, T2PeopleArrayList* list) { - int count; - archive >> count; - Init(count); + int numPeople; + archive >> numPeople; + Init(numPeople); - for (unsigned int i = 0; i < count; i++) { + for (unsigned int i = 0; i < numPeople; i++) { unsigned int peopleID; archive >> peopleID; - if (peopleID) + if (list) Add(list->FindPeople(peopleID)); } } diff --git a/src/T2DLL/T2PeopleType.h b/src/T2DLL/T2PeopleType.h index 048df87..f38535a 100644 --- a/src/T2DLL/T2PeopleType.h +++ b/src/T2DLL/T2PeopleType.h @@ -22,6 +22,22 @@ enum { kEconoType7 = 7, }; +enum { + kMaxTimeZone = 24, +}; + +enum { + kDemandType0 = 0, + kDemandType1 = 1, + kDemandType2 = 2, + kDemandType3 = 3, // tourist? + kDemandType4 = 4, + kDemandType5 = 5, + kDemandType6 = 6, + kDemandType7 = 7, + kMaxDemand = 8, +}; + class AFX_CLASS_EXPORT T2PeopleType { public: T2PeopleType(); diff --git a/src/T2DLL/T2PeopleTypeArray.cpp b/src/T2DLL/T2PeopleTypeArray.cpp index 4be584f..4b2c645 100644 --- a/src/T2DLL/T2PeopleTypeArray.cpp +++ b/src/T2DLL/T2PeopleTypeArray.cpp @@ -35,15 +35,15 @@ void T2PeopleTypeArray::Add(T2PeopleType* type, T2PoolTimeZoneDef* timeZoneDef, for (unsigned int i = 0; i < count; i++) { unsigned int numOfElems = timeZoneDef->GetNumOfElems(); for (unsigned int j = 0; j < numOfElems; j++) { - PeopleElem *peopleElem = timeZoneDef->GetPeopleElem(j); + PeopleElem *thePeopleElem = timeZoneDef->GetPeopleElem(j); #line 49 - _ASSERT(peopleElem); + _ASSERT(thePeopleElem != NULL); - type->SetSilhouetteType(peopleElem->mSilhouetteType); - type->SetEconoType(peopleElem->mEconoType); - type->SetTransportType(peopleElem->mTransportType); + type->SetSilhouetteType(thePeopleElem->mSilhouetteType); + type->SetEconoType(thePeopleElem->mEconoType); + type->SetTransportType(thePeopleElem->mTransportType); type->SetLifeCount(127); - Add(type, peopleElem->m4, 1); + Add(type, thePeopleElem->m4, 1); } } } diff --git a/src/T2DLL/T2PoolDef.cpp b/src/T2DLL/T2PoolDef.cpp index c60afbb..558fdd7 100644 --- a/src/T2DLL/T2PoolDef.cpp +++ b/src/T2DLL/T2PoolDef.cpp @@ -1,4 +1,5 @@ #include "CResFile.h" +#include "T2PeopleType.h" #include "T2PoolDef.h" #include "T2WorldPlugin.h" @@ -109,7 +110,7 @@ T2PoolDef::T2PoolDef(CResFile &resFile, T2WorldPlugin *worldPlugin) { resFile >> m20; resFile >> mNumOfDemand; #line 129 - _ASSERT(mNumOfDemand <= 8); + _ASSERT(mNumOfDemand <= kMaxDemand); mDemand = new DemandInfo[mNumOfDemand]; for (i = 0; i < mNumOfDemand; i++) { diff --git a/src/T2DLL/T2PoolDef.h b/src/T2DLL/T2PoolDef.h index c7dd311..b1c7fb0 100644 --- a/src/T2DLL/T2PoolDef.h +++ b/src/T2DLL/T2PoolDef.h @@ -1,6 +1,10 @@ #pragma once #include "common.h" +enum { + kPoolUnitSize = 20 +}; + // actual name unknown struct PeopleElem { unsigned char mSilhouetteType; diff --git a/src/T2DLL/T2RegistedTenantDB.cpp b/src/T2DLL/T2RegistedTenantDB.cpp index 81d0339..1aee876 100644 --- a/src/T2DLL/T2RegistedTenantDB.cpp +++ b/src/T2DLL/T2RegistedTenantDB.cpp @@ -33,28 +33,28 @@ void T2RegistedTenantDB::Init(T2TenantArrayList* tenantArrayList) { void T2RegistedTenantDB::AddItem(T2Tenant* tenant) { if (tenant->IsRegist()) { - unsigned int registID = tenant->GetRegistID(); - T2EquipPtrList *list = GetList(registID); + unsigned int theRegistID = tenant->GetRegistID(); + T2EquipPtrList *theList = GetList(theRegistID); - if (list) { - list->AddItem(tenant); + if (theList) { + theList->AddItem(tenant); } else { - list = new T2EquipPtrList(registID); + theList = new T2EquipPtrList(theRegistID); #line 55 - _ASSERT(list); - list->AddItem(tenant); - InsertItemsAt(1, mItemCount + 1, &list); + _ASSERT(theList != NULL); + theList->AddItem(tenant); + InsertItemsAt(1, mItemCount + 1, &theList); } } } void T2RegistedTenantDB::RemoveItem(T2Tenant* tenant) { if (tenant->IsRegist()) { - unsigned int registID = tenant->GetRegistID(); - T2EquipPtrList *list = GetList(registID); + unsigned int theRegistID = tenant->GetRegistID(); + T2EquipPtrList *theList = GetList(theRegistID); - if (list) - list->RemoveItem(tenant); + if (theList) + theList->RemoveItem(tenant); } } @@ -72,28 +72,28 @@ T2EquipPtrList* T2RegistedTenantDB::GetList(unsigned int registID) const { } T2Tenant* T2RegistedTenantDB::GetFirstTenant(unsigned int registID) const { - T2Tenant *tenant = NULL; - T2EquipPtrList *list = GetList(registID); - if (list) - tenant = (T2Tenant *) list->GetItem(1); - return tenant; + T2Tenant *theFirstTenant = NULL; + T2EquipPtrList *theList = GetList(registID); + if (theList) + theFirstTenant = (T2Tenant *) theList->GetItem(1); + return theFirstTenant; } -T2Tenant* T2RegistedTenantDB::SearchToilet(const T2RouteNavigator* routeNav, POINT pt, int& outVar) const { - T2Tenant *result = NULL; +T2Tenant* T2RegistedTenantDB::SearchToilet(const T2RouteNavigator* inNavi, POINT inPt, int& outVar) const { + T2Tenant *theSearchToilet = NULL; outVar = -1; - T2EquipPtrList *list = GetList(kTenantRegistID7); - if (list) { - LArrayIterator iterator(*list); - T2Tenant *tenant; - while (outVar != 0 && iterator.Next(&tenant)) { - POINT entrancePt = tenant->GetEntrancePt(); - if (routeNav->CheckRoute(pt, entrancePt, tenant->GetCustomerSearchScore())) { - int status = tenant->GetStatus(); + T2EquipPtrList *theRegistList = GetList(kTenantRegistID7); + if (theRegistList) { + LArrayIterator theTenantIter(*theRegistList); + T2Tenant *theTenant; + while (outVar != 0 && theTenantIter.Next(&theTenant)) { + POINT entrancePt = theTenant->GetEntrancePt(); + if (inNavi->CheckRoute(inPt, entrancePt, theTenant->GetCustomerSearchScore())) { + int status = theTenant->GetStatus(); if (status > kTenantStatus9 && status < kTenantStatus10000) { - if (!tenant->WillBeFull()) { - result = tenant; + if (!theTenant->WillBeFull()) { + theSearchToilet = theTenant; outVar = 0; } else { outVar = -2; @@ -103,37 +103,37 @@ T2Tenant* T2RegistedTenantDB::SearchToilet(const T2RouteNavigator* routeNav, POI } } - return result; + return theSearchToilet; } T2Tenant* T2RegistedTenantDB::FindEmptyParking() const { - T2Tenant *result = NULL; - - T2EquipPtrList *list = GetList(kTenantRegistID3); - if (list) { - LArrayIterator iterator(*list); - T2Tenant *tenant; - while (!result && iterator.Next(&tenant)) { - if (tenant->IsEmptyParking()) - result = tenant; + T2Tenant *theParking = NULL; + + T2EquipPtrList *theRegistList = GetList(kTenantRegistID3); + if (theRegistList) { + LArrayIterator theTenantIter(*theRegistList); + T2Tenant *theTenant; + while (!theParking && theTenantIter.Next(&theTenant)) { + if (theTenant->IsEmptyParking()) + theParking = theTenant; } } - return result; + return theParking; } T2Tenant* T2RegistedTenantDB::FindHisParking(T2People* people) const { - T2Tenant *result = NULL; - - T2EquipPtrList *list = GetList(kTenantRegistID3); - if (list) { - LArrayIterator iterator(*list); - T2Tenant *tenant; - while (!result && iterator.Next(&tenant)) { - if (tenant->IsBelongPeople(people)) - result = tenant; + T2Tenant *hisParking = NULL; + + T2EquipPtrList *theRegistList = GetList(kTenantRegistID3); + if (theRegistList) { + LArrayIterator theTenantIter(*theRegistList); + T2Tenant *theTenant; + while (!hisParking && theTenantIter.Next(&theTenant)) { + if (theTenant->IsBelongPeople(people)) + hisParking = theTenant; } } - return result; + return hisParking; } diff --git a/src/T2DLL/T2RequestArrayList.cpp b/src/T2DLL/T2RequestArrayList.cpp index 0b5acbb..8fac11a 100644 --- a/src/T2DLL/T2RequestArrayList.cpp +++ b/src/T2DLL/T2RequestArrayList.cpp @@ -11,36 +11,36 @@ T2RequestArrayList::T2RequestArrayList() /*virtual*/ T2RequestArrayList::~T2RequestArrayList() { LArrayIterator iterator(*this); - T2RequestArray *requestArray; + T2RequestArray *theRequestArray; - while (iterator.Next(&requestArray)) - delete requestArray; + while (iterator.Next(&theRequestArray)) + delete theRequestArray; } -void T2RequestArrayList::Add(T2RequestArray* requestArray) { - InsertItemsAt(1, mItemCount + 1, &requestArray); +void T2RequestArrayList::Add(T2RequestArray* inRequestArray) { + InsertItemsAt(1, mItemCount + 1, &inRequestArray); } unsigned int T2RequestArrayList::GetItemCount() { return GetCount(); } -T2RequestArray* T2RequestArrayList::GetItemAt(int index) { - T2RequestArray *requestArray; - if (FetchItemAt(index, &requestArray)) - return requestArray; +T2RequestArray* T2RequestArrayList::GetItemAt(int inIndex) { + T2RequestArray *theRequestArray; + if (FetchItemAt(inIndex, &theRequestArray)) + return theRequestArray; else return NULL; } -T2Request* T2RequestArrayList::GetRequestByID(unsigned int requestID) { - if (requestID == 0) +T2Request* T2RequestArrayList::GetRequestByID(unsigned int inRequestID) { + if (inRequestID == 0) return NULL; - if (requestID < 1000) + if (inRequestID < 1000) return NULL; - int group = (requestID - 1000) / 64; - int indexInGroup = (requestID - 1000) % 64; + int group = (inRequestID - 1000) / 64; + int indexInGroup = (inRequestID - 1000) % 64; T2RequestArray *requestArray = GetItemAt(group + 1); if (requestArray) return requestArray->GetIndexRequest(indexInGroup); @@ -49,67 +49,67 @@ T2Request* T2RequestArrayList::GetRequestByID(unsigned int requestID) { } T2Request* T2RequestArrayList::FindUnusedRequest() { - T2Request *result = NULL; + T2Request *theRequest = NULL; LArrayIterator iterator(*this); - T2RequestArray *requestArray = NULL; + T2RequestArray *theRequestArray = NULL; - while (!result && iterator.Next(&requestArray)) { - result = requestArray->FindUnusedRequest(); + while (!theRequest && iterator.Next(&theRequestArray)) { + theRequest = theRequestArray->FindUnusedRequest(); } - if (!result) { + if (!theRequest) { unsigned int newStartID = 1000; - if (requestArray) - newStartID = requestArray->GetStartID() + 64; + if (theRequestArray) + newStartID = theRequestArray->GetStartID() + 64; - requestArray = new T2RequestArray(newStartID); - if (requestArray) { - Add(requestArray); - result = requestArray->FindUnusedRequest(); + theRequestArray = new T2RequestArray(newStartID); + if (theRequestArray) { + Add(theRequestArray); + theRequest = theRequestArray->FindUnusedRequest(); } } - return result; + return theRequest; } -void T2RequestArrayList::BreakoutEmergency(T2TowerDoc* towerDoc) { +void T2RequestArrayList::BreakoutEmergency(T2TowerDoc* inDoc) { LArrayIterator iterator(*this); T2RequestArray *requestArray; while (iterator.Next(&requestArray)) - requestArray->BreakoutEmergency(towerDoc); + requestArray->BreakoutEmergency(inDoc); } -void T2RequestArrayList::Read(T2Archive& archive, T2TowerDoc* towerDoc) { +void T2RequestArrayList::Read(T2Archive& inArchive, T2TowerDoc* inDoc) { int count; - archive >> count; + inArchive >> count; RemoveItemsAt(GetCount(), 1); unsigned int startID = 1000; for (int i = 0; i < count; i++) { - T2RequestArray *requestArray = new T2RequestArray(startID); - requestArray->Read(archive, towerDoc); - Add(requestArray); + T2RequestArray *theRequestArray = new T2RequestArray(startID); + theRequestArray->Read(inArchive, inDoc); + Add(theRequestArray); startID += 64; } } -void T2RequestArrayList::Write(T2Archive& archive) { +void T2RequestArrayList::Write(T2Archive& inArchive) { int count = GetItemCount(); - archive << count; + inArchive << count; LArrayIterator iterator(*this); - T2RequestArray *requestArray; + T2RequestArray *theRequestArray; - while (iterator.Next(&requestArray)) - requestArray->Write(archive); + while (iterator.Next(&theRequestArray)) + theRequestArray->Write(inArchive); } -void T2RequestArrayList::DispatchIdle(T2TowerDoc* towerDoc) { +void T2RequestArrayList::DispatchIdle(T2TowerDoc* inDoc) { LArrayIterator iterator(*this); - T2RequestArray *requestArray; + T2RequestArray *theRequestArray; - while (iterator.Next(&requestArray)) - requestArray->DispatchIdle(towerDoc, 0); + while (iterator.Next(&theRequestArray)) + theRequestArray->DispatchIdle(inDoc, 0); } diff --git a/src/T2DLL/T2RequestIDArray.cpp b/src/T2DLL/T2RequestIDArray.cpp index 4228bf6..8758856 100644 --- a/src/T2DLL/T2RequestIDArray.cpp +++ b/src/T2DLL/T2RequestIDArray.cpp @@ -82,10 +82,10 @@ void T2RequestIDArray::RemoveRequest(T2TowerDoc* towerDoc, int index, ERequestUp void T2RequestIDArray::Union(T2RequestIDArray* otherArray) { LArrayIterator iterator(*otherArray); - unsigned int requestID; + unsigned int theReqID; - while (iterator.Next(&requestID)) - InsertItemsAt(1, mItemCount + 1, &requestID); + while (iterator.Next(&theReqID)) + InsertItemsAt(1, mItemCount + 1, &theReqID); } void T2RequestIDArray::MoverIDChanged(T2FloorInfo* floorInfo, unsigned int moverID) { @@ -100,33 +100,33 @@ void T2RequestIDArray::MoverIDChanged(T2FloorInfo* floorInfo, unsigned int mover } void T2RequestIDArray::StopRemoved(T2TowerDoc* towerDoc, int y) { - T2FloorInfo *floorInfo = towerDoc->towerDoc_vf12C(); + T2FloorInfo *theFloorInfo = towerDoc->towerDoc_vf12C(); #line 142 - _ASSERT(floorInfo); + _ASSERT(theFloorInfo != NULL); LArrayIterator iterator(*this); - unsigned int requestID; + unsigned int theReqID; - while (iterator.Next(&requestID)) { - if (requestID) { - T2Request *request = floorInfo->GetRequest(requestID); - if (request) - request->StopRemoved(towerDoc, y); + while (iterator.Next(&theReqID)) { + if (theReqID) { + T2Request *theRequest = theFloorInfo->GetRequest(theReqID); + if (theRequest) + theRequest->StopRemoved(towerDoc, y); } } } void T2RequestIDArray::ModuleRemoved(T2TowerDoc* towerDoc, unsigned int moduleIndex) { - T2FloorInfo *floorInfo = towerDoc->towerDoc_vf12C(); + T2FloorInfo *theFloorInfo = towerDoc->towerDoc_vf12C(); LArrayIterator iterator(*this); - unsigned int requestID; + unsigned int theReqID; - while (iterator.Next(&requestID)) { - if (requestID) { - T2Request *request = floorInfo->GetRequest(requestID); - if (request && request->GetModuleIndex() == moduleIndex) - request->CancelReservingModule(); + while (iterator.Next(&theReqID)) { + if (theReqID) { + T2Request *theRequest = theFloorInfo->GetRequest(theReqID); + if (theRequest && theRequest->GetModuleIndex() == moduleIndex) + theRequest->CancelReservingModule(); } } } diff --git a/src/T2DLL/T2RouteCEArray.cpp b/src/T2DLL/T2RouteCEArray.cpp index 9a2de67..537c3f0 100644 --- a/src/T2DLL/T2RouteCEArray.cpp +++ b/src/T2DLL/T2RouteCEArray.cpp @@ -19,24 +19,24 @@ void T2RouteCEArray::Insert(unsigned int a, unsigned int b) { } unsigned int T2RouteCEArray::GetSameID(T2RouteCEArray* other) { - unsigned int result = 0; + unsigned int theSameID = 0; - LArrayIterator outer(*this); - unsigned int outerItem; + LArrayIterator theLeftIterator(*this); + unsigned int theLeftReqID; - while (outer.Next(&outerItem)) { - LArrayIterator inner(*other); - unsigned int innerItem; + while (theLeftIterator.Next(&theLeftReqID)) { + LArrayIterator theRightIterator(*other); + unsigned int theRightReqID; - while (inner.Next(&innerItem)) { - if (outerItem == innerItem) { - result = outerItem; + while (theRightIterator.Next(&theRightReqID)) { + if (theLeftReqID == theRightReqID) { + theSameID = theLeftReqID; break; } } } - return result; + return theSameID; } BOOL T2RouteCEArray::HasCrossEquip() const { diff --git a/src/T2DLL/T2SettingDialog.cpp b/src/T2DLL/T2SettingDialog.cpp index 408b2af..5eb6551 100644 --- a/src/T2DLL/T2SettingDialog.cpp +++ b/src/T2DLL/T2SettingDialog.cpp @@ -8,6 +8,7 @@ #include "WalkerDlg.h" T2SettingDialog::T2SettingDialog(T2TowerDoc* inDoc) { +#pragma var_order(theRadio, rect, tmpl, theText, theModule, pt, theDlgTitle) mDocument = inDoc; CRect rect; @@ -43,9 +44,9 @@ T2SettingDialog::T2SettingDialog(T2TowerDoc* inDoc) { theRadio->SetValue(1); T2DlgItem *theText = GetT2DlgItem(120); - CString str; - mSpeedDlg->GetWindowText(str); - theText->SetDescriptor(str); + CString theDlgTitle; + mSpeedDlg->GetWindowText(theDlgTitle); + theText->SetDescriptor(theDlgTitle); } /*virtual*/ T2SettingDialog::~T2SettingDialog() { @@ -55,28 +56,28 @@ T2SettingDialog::T2SettingDialog(T2TowerDoc* inDoc) { delete mBitImage; } -/*virtual*/ int T2SettingDialog::OnT2DialogCommand(unsigned int cmd, long data) { - int result = 1; +/*virtual*/ BOOL T2SettingDialog::OnT2DialogCommand(WPARAM inWParam, LPARAM inLParam) { + BOOL done = true; - WORD hi = HIWORD(cmd); - WORD lo = LOWORD(cmd); + WORD code = HIWORD(inWParam); + WORD id = LOWORD(inWParam); T2DlgItem *theSpeedTabRadio = GetT2DlgItem(108); T2DlgItem *theSoundTabRadio = GetT2DlgItem(109); T2DlgItem *theWalkerTabRadio = GetT2DlgItem(110); - T2DlgItem *theText = GetT2DlgItem(120); + T2DlgItem *theHeaderText = GetT2DlgItem(120); - CString str; + CString theDlgTitle; - switch (lo) { + switch (id) { case 108: mSoundDlg->ShowWindow(SW_HIDE); mWalkerDlg->ShowWindow(SW_HIDE); mSpeedDlg->ShowWindow(SW_SHOW); theSoundTabRadio->SetValue(0); theWalkerTabRadio->SetValue(0); - mSpeedDlg->GetWindowText(str); - theText->SetDescriptor(str); + mSpeedDlg->GetWindowText(theDlgTitle); + theHeaderText->SetDescriptor(theDlgTitle); break; case 109: @@ -85,8 +86,8 @@ T2SettingDialog::T2SettingDialog(T2TowerDoc* inDoc) { mSoundDlg->ShowWindow(SW_SHOW); theSpeedTabRadio->SetValue(0); theWalkerTabRadio->SetValue(0); - mSoundDlg->GetWindowText(str); - theText->SetDescriptor(str); + mSoundDlg->GetWindowText(theDlgTitle); + theHeaderText->SetDescriptor(theDlgTitle); break; case 110: @@ -95,8 +96,8 @@ T2SettingDialog::T2SettingDialog(T2TowerDoc* inDoc) { mWalkerDlg->ShowWindow(SW_SHOW); theSpeedTabRadio->SetValue(0); theSoundTabRadio->SetValue(0); - mWalkerDlg->GetWindowText(str); - theText->SetDescriptor(str); + mWalkerDlg->GetWindowText(theDlgTitle); + theHeaderText->SetDescriptor(theDlgTitle); break; case 111: @@ -110,17 +111,17 @@ T2SettingDialog::T2SettingDialog(T2TowerDoc* inDoc) { mSoundDlg->Save(); mWalkerDlg->Save(); OnT2OK(); - DoClose(lo); + DoClose(id); break; case 113: OnT2OK(); - DoClose(lo); + DoClose(id); break; default: - result = T2Dialog::OnT2DialogCommand(cmd, data); + done = T2Dialog::OnT2DialogCommand(inWParam, inLParam); } - return result; + return done; } diff --git a/src/T2DLL/T2SettingDialog.h b/src/T2DLL/T2SettingDialog.h index c81d876..8bf0fd5 100644 --- a/src/T2DLL/T2SettingDialog.h +++ b/src/T2DLL/T2SettingDialog.h @@ -6,7 +6,7 @@ class AFX_CLASS_EXPORT T2SettingDialog : public T2Dialog { public: T2SettingDialog(T2TowerDoc* inDoc); virtual ~T2SettingDialog(); - virtual int OnT2DialogCommand(unsigned int, long); + virtual BOOL OnT2DialogCommand(WPARAM inWParam, LPARAM inLParam); protected: T2TowerDoc *mDocument; diff --git a/src/T2DLL/T2Settlement.cpp b/src/T2DLL/T2Settlement.cpp index f67216e..4f84841 100644 --- a/src/T2DLL/T2Settlement.cpp +++ b/src/T2DLL/T2Settlement.cpp @@ -198,7 +198,7 @@ void T2Settlement::SetTimeLimitOfMessage(T2TowerDoc* inDoc, T2ToolDef* inToolDef if (!inToolDef->mToolQuietUntil) { inToolDef->mToolQuietUntil = new T2DateTime(*inTimeLimit); #line 267 - _ASSERT(inToolDef->mToolQuietUntil != NULL); + _ASSERT(inToolDef->mToolQuietUntil); } else { *inToolDef->mToolQuietUntil = *inTimeLimit; } diff --git a/src/T2DLL/T2SilhouettePane.cpp b/src/T2DLL/T2SilhouettePane.cpp index 7e48810..64d0b05 100644 --- a/src/T2DLL/T2SilhouettePane.cpp +++ b/src/T2DLL/T2SilhouettePane.cpp @@ -23,6 +23,7 @@ T2SilhouettePane::T2SilhouettePane(T2TowerDoc* towerDoc, T2ImageObj* imageObj, C GetClientRect(clientRect); if (mPeople && !clientRect.IsRectEmpty()) { +#pragma var_order(ratio, image, origColor, rect3, imageRect, rect4) dc->FillRect(clientRect, CBrush::FromHandle((HBRUSH) GetStockObject(WHITE_BRUSH))); clientRect.DeflateRect(2, 2); diff --git a/src/T2DLL/T2Sprite.cpp b/src/T2DLL/T2Sprite.cpp index 2cbd7e8..cd152b1 100644 --- a/src/T2DLL/T2Sprite.cpp +++ b/src/T2DLL/T2Sprite.cpp @@ -20,21 +20,21 @@ void T2Sprite::AllClear() { } int T2Sprite::NewSprite(T2ImageObj& imageObj, const CString& name, int layer) { - T2SpriteObj *obj = new T2SpriteObj; - obj->mImageObj = &imageObj; - obj->mName = name; + T2SpriteObj *theSpriteObj = new T2SpriteObj; + theSpriteObj->mImageObj = &imageObj; + theSpriteObj->mName = name; int index; for (index = 0; ; index++) { if (!FindObj(index)) break; } - obj->mIndex = index; - obj->mLayer = layer; + theSpriteObj->mIndex = index; + theSpriteObj->mLayer = layer; - int objIndex = imageObj.FindObject(name); - imageObj.GetObjectSize(objIndex, &obj->mSize); - AddTail(obj); + int imageObjInd = imageObj.FindObject(name); + imageObj.GetObjectSize(imageObjInd, &theSpriteObj->mSize); + AddTail(theSpriteObj); return index; } diff --git a/src/T2DLL/T2StairModule.cpp b/src/T2DLL/T2StairModule.cpp index 751943f..ec2e5c3 100644 --- a/src/T2DLL/T2StairModule.cpp +++ b/src/T2DLL/T2StairModule.cpp @@ -26,19 +26,19 @@ void T2StairModule::MoverIDChanged(unsigned int moverID) { } /*virtual*/ void T2StairModule::RemoveContents(T2TowerDoc* towerDoc) { - T2FloorInfo *floorInfo = towerDoc->towerDoc_vf12C(); + T2FloorInfo *theFloorInfo = towerDoc->towerDoc_vf12C(); while (mLink1) { - T2People *people = (T2People *) mLink1; - Leave(people); + T2People *thePeople = (T2People *) mLink1; + Leave(thePeople); - POINT pt = mModuleRect.TopLeft(); + POINT theNextPt = mModuleRect.TopLeft(); if (mDirection != kStairDirection1) - pt.y = mModuleRect.bottom - 1; + theNextPt.y = mModuleRect.bottom - 1; - T2Tenant *floor = floorInfo->GetFloor(pt.y, pt.x); - if (floor) - floor->Enter(people); + T2Tenant *theFloor = theFloorInfo->GetFloor(theNextPt.y, theNextPt.x); + if (theFloor) + theFloor->Enter(thePeople); } } diff --git a/src/T2DLL/T2StairModule.h b/src/T2DLL/T2StairModule.h index f97a69d..342e4de 100644 --- a/src/T2DLL/T2StairModule.h +++ b/src/T2DLL/T2StairModule.h @@ -4,8 +4,8 @@ enum { kStairDirection0 = 0, - kStairDirection1, - kStairDirection2 + kStairDirection1, // up? + kStairDirection2 // down? }; class AFX_CLASS_EXPORT T2StairModule : public T2MoverModule { diff --git a/src/T2DLL/T2StairModuleList.cpp b/src/T2DLL/T2StairModuleList.cpp index 876e571..278b088 100644 --- a/src/T2DLL/T2StairModuleList.cpp +++ b/src/T2DLL/T2StairModuleList.cpp @@ -27,29 +27,29 @@ void T2StairModuleList::AddModule(int position, const RECT& rect) { } void T2StairModuleList::AddModule(T2TowerDoc* towerDoc, const RECT& rect, BOOL insertAtEnd) { - T2StairModule *module1 = new T2StairModule; - if (module1) { - module1->SetModuleRect(rect); - module1->mDirection = kStairDirection1; - module1->SetUsed(true); - module1->SetModuleID(towerDoc); + T2StairModule *theUpModule = new T2StairModule; + if (theUpModule) { + theUpModule->SetModuleRect(rect); + theUpModule->mDirection = kStairDirection1; + theUpModule->SetUsed(true); + theUpModule->SetModuleID(towerDoc); } - T2StairModule *module2 = new T2StairModule; - if (module2) { - module2->SetModuleRect(rect); - module2->mDirection = kStairDirection2; - module2->SetUsed(true); - module2->SetModuleID(towerDoc); + T2StairModule *theDownModule = new T2StairModule; + if (theDownModule) { + theDownModule->SetModuleRect(rect); + theDownModule->mDirection = kStairDirection2; + theDownModule->SetUsed(true); + theDownModule->SetModuleID(towerDoc); } - if (module1 && module2) { + if (theUpModule && theDownModule) { if (insertAtEnd) { - InsertModuleAt(mItemCount + 1, module1); - InsertModuleAt(mItemCount + 1, module2); + InsertModuleAt(mItemCount + 1, theUpModule); + InsertModuleAt(mItemCount + 1, theDownModule); } else { - InsertModuleAt(1, module2); - InsertModuleAt(1, module1); + InsertModuleAt(1, theDownModule); + InsertModuleAt(1, theUpModule); } } } diff --git a/src/T2DLL/T2TemplatePluginDB.cpp b/src/T2DLL/T2TemplatePluginDB.cpp index 7b7b94c..f981d37 100644 --- a/src/T2DLL/T2TemplatePluginDB.cpp +++ b/src/T2DLL/T2TemplatePluginDB.cpp @@ -16,16 +16,16 @@ void T2TemplatePluginDB::Regist(T2TemplatePlugin* plugin) { LArrayIterator iterator(*this); T2TemplatePluginList *list; - BOOL found = false; + BOOL added = false; - while (!found && iterator.Next(&list)) { + while (!added && iterator.Next(&list)) { if (list->GetPluginType() == plugin->GetType()) { list->Add(plugin); - found = true; + added = true; } } - if (!found) { + if (!added) { list = new T2TemplatePluginList(plugin->GetType()); list->Add(plugin); InsertItemsAt(1, mItemCount + 1, &list); @@ -35,9 +35,9 @@ void T2TemplatePluginDB::Regist(T2TemplatePlugin* plugin) { void T2TemplatePluginDB::Add(T2TemplatePluginList* list) { LArrayIterator iterator(*this); T2TemplatePluginList *existingList; - BOOL found = false; + BOOL added = false; - while (!found && iterator.Next(&existingList)) { + while (!added && iterator.Next(&existingList)) { if (existingList->GetPluginType() == list->GetPluginType()) { LArrayIterator pluginIterator(*list); T2TemplatePlugin *plugin; @@ -46,11 +46,11 @@ void T2TemplatePluginDB::Add(T2TemplatePluginList* list) { existingList->Add(plugin); } - found = true; + added = true; } } - if (!found) + if (!added) InsertItemsAt(1, mItemCount + 1, &list); } diff --git a/src/T2DLL/T2Tenant.cpp b/src/T2DLL/T2Tenant.cpp index e1a63eb..cec110b 100644 --- a/src/T2DLL/T2Tenant.cpp +++ b/src/T2DLL/T2Tenant.cpp @@ -731,10 +731,10 @@ int T2Tenant::CollectCustomerFromPool(T2TowerDoc* inDoc, T2TenantMemberTableDef* int T2Tenant::CollectCustomerFromTenant(T2TowerDoc* inDoc, T2TenantMemberTableDef* inTable, unsigned int inTime) { int numCustomer = 0; - T2RouteNavigator *theNavigator = inDoc->towerDoc_vf124(); - T2Tenant *theTenant = theNavigator->SelectNearTenant(GetEntrancePt(), inTable->GetScore(T2PlaceParamDef::Place_1)); + T2RouteNavigator *theNavi = inDoc->towerDoc_vf124(); + T2Tenant *theNearTenant = theNavi->SelectNearTenant(GetEntrancePt(), inTable->GetScore(T2PlaceParamDef::Place_1)); - if (theTenant) { + if (theNearTenant) { unsigned int restCapacity = CalcRestCapacity(); int econoType = inTable->GetEconoType(); unsigned int theSpecialFlag = inTable->GetSpecialFlag(); @@ -743,7 +743,7 @@ int T2Tenant::CollectCustomerFromTenant(T2TowerDoc* inDoc, T2TenantMemberTableDe T2TenantMemberDef *memberDef; unsigned int theRate; - T2PeopleLinkIterator peopleLinkIterator(theTenant->GetFirstPeople()); + T2PeopleLinkIterator peopleLinkIterator(theNearTenant->GetFirstPeople()); T2People *people; int time = GetBindTime(); @@ -774,9 +774,9 @@ int T2Tenant::CollectCustomerFromFloor(T2TowerDoc* inDoc, T2TenantMemberTableDef T2FloorInfo *theFloorInfo = inDoc->towerDoc_vf12C(); unsigned int theEntranceFloorID = GetEntranceFloorID(); - T2Tenant *theEntranceFloor = theFloorInfo->GetTenant(theEntranceFloorID); + T2Tenant *theFloor = theFloorInfo->GetTenant(theEntranceFloorID); - if (theEntranceFloor->IsTherePeople()) { + if (theFloor->IsTherePeople()) { unsigned int restCapacity = CalcRestCapacity(); int searchScore = inTable->GetScore(T2PlaceParamDef::Place_2); int econoType = inTable->GetEconoType(); @@ -786,7 +786,7 @@ int T2Tenant::CollectCustomerFromFloor(T2TowerDoc* inDoc, T2TenantMemberTableDef T2TenantMemberDef *memberDef; unsigned int theRate; - T2PeopleLinkIterator peopleLinkIterator(theEntranceFloor->GetFirstPeople()); + T2PeopleLinkIterator peopleLinkIterator(theFloor->GetFirstPeople()); T2People *people; int time = GetBindTime(); @@ -1297,18 +1297,18 @@ BOOL T2Tenant::IsWithinSearchRange(T2TowerDoc* inDoc, T2Tenant* inTenant) const BOOL result = false; if (inTenant) { - T2RouteNavigator *theNavigator = inDoc->towerDoc_vf124(); + T2RouteNavigator *theNavi = inDoc->towerDoc_vf124(); T2TenantMemberTableDef *theTable = inTenant->GetCustomerTableDef(true); if (theTable) { if (IsFloor()) { if (GetValiation() == 1) { - if (theNavigator->IsConnectRouteFromLobby(inTenant->GetEntrancePt())) + if (theNavi->IsConnectRouteFromLobby(inTenant->GetEntrancePt())) result = true; } } else { int score = theTable->GetScore(T2PlaceParamDef::Place_1); - if (theNavigator->CheckRoute(inTenant->GetEntrancePt(), GetEntrancePt(), score)) + if (theNavi->CheckRoute(inTenant->GetEntrancePt(), GetEntrancePt(), score)) result = true; } } @@ -1588,44 +1588,44 @@ unsigned int T2Tenant::CheckRouteFromPool(T2TowerDoc* inDoc, unsigned int inScor unsigned int checkRoute = 0; T2FloorInfo *theFloorInfo = inDoc->towerDoc_vf12C(); - T2RouteNavigator *theNavigator = inDoc->towerDoc_vf124(); + T2RouteNavigator *theNavi = inDoc->towerDoc_vf124(); POINT entrancePt = GetEntrancePt(); - if (theNavigator->CheckRoute(theFloorInfo->GetEntrancePt(1000), entrancePt, inScore)) + if (theNavi->CheckRoute(theFloorInfo->GetEntrancePt(1000), entrancePt, inScore)) checkRoute |= kTransportFlagLobbyLeft | kTransportFlagLobbyRight; T2RegistedTenantDB *theDB = inDoc->towerDoc_vf174(); - T2Tenant *theTenant = theDB->FindEmptyParking(); - if (theTenant) { - if (theNavigator->CheckRoute(theTenant->GetExitPt(), entrancePt, inScore)) + T2Tenant *theEmptyParking = theDB->FindEmptyParking(); + if (theEmptyParking) { + if (theNavi->CheckRoute(theEmptyParking->GetExitPt(), entrancePt, inScore)) checkRoute |= kTransportFlagParking; } - T2TowerEvent *towerEvent = inDoc->towerDoc_vf170()->GetTowerEvent(); - T2DateTime *theDateTime = inDoc->towerDoc_vf120(); - theTenant = theDB->GetFirstTenant(kTenantRegistID8); - if (theTenant && theTenant->IsOpen()) { - if (theNavigator->CheckRoute(theTenant->GetExitPt(), entrancePt, inScore)) + T2TowerEvent *theEvent = inDoc->towerDoc_vf170()->GetTowerEvent(); + T2DateTime *theCurrentDateTime = inDoc->towerDoc_vf120(); + theEmptyParking = theDB->GetFirstTenant(kTenantRegistID8); + if (theEmptyParking && theEmptyParking->IsOpen()) { + if (theNavi->CheckRoute(theEmptyParking->GetExitPt(), entrancePt, inScore)) checkRoute |= kTransportFlagSubway; } T2Transport *theTransport; if (checkRoute & kTransportFlagSubway) { - theTransport = towerEvent->GetMetroRailway(); - if (theTransport && !theTransport->GetAvailable(theDateTime) != NULL) + theTransport = theEvent->GetMetroRailway(); + if (theTransport && !theTransport->GetAvailable(theCurrentDateTime) != NULL) checkRoute &= ~kTransportFlagSubway; } - theTenant = theDB->GetFirstTenant(kTenantRegistID9); - if (theTenant && theTenant->IsOpen()) { - if (theNavigator->CheckRoute(theTenant->GetExitPt(), entrancePt, inScore)) + theEmptyParking = theDB->GetFirstTenant(kTenantRegistID9); + if (theEmptyParking && theEmptyParking->IsOpen()) { + if (theNavi->CheckRoute(theEmptyParking->GetExitPt(), entrancePt, inScore)) checkRoute |= kTransportFlagShip; } if (checkRoute & kTransportFlagShip) { - theTransport = towerEvent->GetCruise(); - if (theTransport && !theTransport->GetAvailable(theDateTime) != NULL) + theTransport = theEvent->GetCruise(); + if (theTransport && !theTransport->GetAvailable(theCurrentDateTime) != NULL) checkRoute &= ~kTransportFlagShip; } @@ -1692,12 +1692,12 @@ BOOL T2Tenant::UpdateResidencialEstimate(T2TowerDoc* inDoc) { return CalcEstimateColor() != oldCol; } -void T2Tenant::BreakoutEmergency(T2TowerDoc* inDoc) { +void T2Tenant::BreakoutEmergency(T2TowerDoc* inTowerDoc) { if (GetRegistID() != kTenantRegistID5) { - int result = GetEquipDef()->EmergencyProc(inDoc, this); + int result = GetEquipDef()->EmergencyProc(inTowerDoc, this); if (result) { SetDrawMode(result); - inDoc->GetTowerMainView()->tmv_vf128(mArea); + inTowerDoc->GetTowerMainView()->tmv_vf128(mArea); } } } diff --git a/src/T2DLL/T2Tenant.h b/src/T2DLL/T2Tenant.h index 381424e..e3ac271 100644 --- a/src/T2DLL/T2Tenant.h +++ b/src/T2DLL/T2Tenant.h @@ -151,7 +151,7 @@ public: BOOL IsRegist() const; T2TenantMemberTableDef* GetCustomerTableDef(BOOL inFlag) const; BOOL UpdateResidencialEstimate(T2TowerDoc* inDoc); - void BreakoutEmergency(T2TowerDoc* inDoc); + void BreakoutEmergency(T2TowerDoc* inTowerDoc); void BurntDown(T2TowerDoc* inDoc); void RecoverRelatedTenantList(T2RegistedTenantDB* inDB); int GetTotalBelong() const; diff --git a/src/T2DLL/T2TenantArray.cpp b/src/T2DLL/T2TenantArray.cpp index 4c536e8..9dd23ee 100644 --- a/src/T2DLL/T2TenantArray.cpp +++ b/src/T2DLL/T2TenantArray.cpp @@ -61,12 +61,15 @@ void T2TenantArray::TenantRemoved(unsigned int id) { } T2Tenant* T2TenantArray::GetTenantByPID(DWORD pluginID) { + T2EquipDef *theDef; + CProgramPlugin *thePlugin; + for (int i = 0; i < kGroupSize; i++) { if (mTenants[i].IsUsed()) { - T2EquipDef *equipDef = mTenants[i].GetEquipDef(); - CProgramPlugin *plugin = equipDef ? equipDef->GetPlugin() : NULL; + theDef = mTenants[i].GetEquipDef(); + thePlugin = theDef ? theDef->GetPlugin() : NULL; - if (plugin && plugin->GetID() == pluginID) + if (thePlugin && thePlugin->GetID() == pluginID) return &mTenants[i]; } } diff --git a/src/T2DLL/T2TenantArrayList.cpp b/src/T2DLL/T2TenantArrayList.cpp index be01aeb..f6cb81d 100644 --- a/src/T2DLL/T2TenantArrayList.cpp +++ b/src/T2DLL/T2TenantArrayList.cpp @@ -57,27 +57,27 @@ T2Tenant* T2TenantArrayList::GetTenantByPID(DWORD pluginID) { } T2Tenant* T2TenantArrayList::FindUnusedTenant() { - T2Tenant *result = NULL; + T2Tenant *theUnusedTenant = NULL; LArrayIterator iterator(*this); - T2TenantArray *tenantArray = NULL; + T2TenantArray *theTenantArray = NULL; - while (!result && iterator.Next(&tenantArray)) { - result = tenantArray->FindUnusedTenant(); + while (!theUnusedTenant && iterator.Next(&theTenantArray)) { + theUnusedTenant = theTenantArray->FindUnusedTenant(); } - if (!result) { + if (!theUnusedTenant) { unsigned int newStartID = 1000; - if (tenantArray) - newStartID = tenantArray->GetStartID() + T2TenantArray::kGroupSize; + if (theTenantArray) + newStartID = theTenantArray->GetStartID() + T2TenantArray::kGroupSize; - tenantArray = new T2TenantArray(newStartID); - if (tenantArray) { - Add(tenantArray); - result = tenantArray->FindUnusedTenant(); + theTenantArray = new T2TenantArray(newStartID); + if (theTenantArray) { + Add(theTenantArray); + theUnusedTenant = theTenantArray->FindUnusedTenant(); } } - return result; + return theUnusedTenant; } void T2TenantArrayList::DispatchIdle(T2TowerDoc* towerDoc) { @@ -109,14 +109,14 @@ void T2TenantArrayList::BreakoutEmergency(T2TowerDoc* towerDoc) { } int T2TenantArrayList::CalcMentenanceCost(T2TowerDoc* towerDoc) const { - int cost = 0; + int theCost = 0; LArrayIterator iterator(*this); - T2TenantArray *tenantArray; + T2TenantArray *theTenantArray; - while (iterator.Next(&tenantArray)) - cost += tenantArray->CalcMentenanceCost(towerDoc); + while (iterator.Next(&theTenantArray)) + theCost += theTenantArray->CalcMentenanceCost(towerDoc); - return cost; + return theCost; } LArray* T2TenantArrayList::MakeTenantList(int type) { @@ -177,11 +177,11 @@ void T2TenantArrayList::Read(T2Archive& archive, T2TowerDoc* towerDoc) { startID += T2TenantArray::kGroupSize; } - LArrayIterator iterator(*this); - T2TenantArray *tenantArray; + LArrayIterator iter(*this); + T2TenantArray *theTenantArray; - while (iterator.Next(&tenantArray)) - tenantArray->Read(archive, towerDoc); + while (iter.Next(&theTenantArray)) + theTenantArray->Read(archive, towerDoc); } void T2TenantArrayList::Write(T2Archive& archive) { diff --git a/src/T2DLL/T2TenantArrayList.h b/src/T2DLL/T2TenantArrayList.h index 0e3e8b5..213f3bc 100644 --- a/src/T2DLL/T2TenantArrayList.h +++ b/src/T2DLL/T2TenantArrayList.h @@ -10,7 +10,7 @@ public: unsigned int GetItemCount(); T2TenantArray* GetItemAt(int); T2Tenant* GetTenantByID(unsigned int); - T2Tenant* GetTenantByPID(unsigned long); + T2Tenant* GetTenantByPID(DWORD); T2Tenant* FindUnusedTenant(); void DispatchIdle(T2TowerDoc*); void TenantRemoved(unsigned int); diff --git a/src/T2DLL/T2ToolDef.cpp b/src/T2DLL/T2ToolDef.cpp index 21b0a63..1a0d264 100644 --- a/src/T2DLL/T2ToolDef.cpp +++ b/src/T2DLL/T2ToolDef.cpp @@ -128,13 +128,13 @@ void T2ToolDef::GetName(CString& outStr, int id) { int T2ToolDef::GetOutMoney(unsigned int id) const { int money = 0; - if (id < 4) + if (id < kMaxValiation) money = mOutMoney[id]; return money; } void T2ToolDef::SetOutMoney(unsigned int id, int money) { - if (id < 4) + if (id < kMaxValiation) mOutMoney[id] = money; } diff --git a/src/T2DLL/T2ToolDef.h b/src/T2DLL/T2ToolDef.h index 830dc92..b954d82 100644 --- a/src/T2DLL/T2ToolDef.h +++ b/src/T2DLL/T2ToolDef.h @@ -3,6 +3,10 @@ #include "T2TemplatePlugin.h" enum { + kMaxValiation = 4, +}; + +enum { kToolAttrIsMover = 2, kEquipAttrIsAbleDragMaking = 0x80, kToolAttrNormalMenteCost = 0x100, @@ -122,16 +126,16 @@ protected: CString mCategoryCommentString; int mToolNo; int mValiationCount; - CString *mPriceString[4]; - CString *mOutMoneyString[4]; - CString *mCommentString[4]; - int mOutMoney[4]; - CString *mToolName[4]; - CString *mName[4]; - int mPrice[4]; + CString *mPriceString[kMaxValiation]; + CString *mOutMoneyString[kMaxValiation]; + CString *mCommentString[kMaxValiation]; + int mOutMoney[kMaxValiation]; + CString *mToolName[kMaxValiation]; + CString *mName[kMaxValiation]; + int mPrice[kMaxValiation]; T2BitImage *mToolIcon; T2BitImage *mEC; - int mConsumptionPower[4]; + int mConsumptionPower[kMaxValiation]; int mCurBuildCount; int mMaxBuildCount; DWORD mSubPluginType; diff --git a/src/T2DLL/T2WeatherFilter.cpp b/src/T2DLL/T2WeatherFilter.cpp index a65d3ce..fe56bba 100644 --- a/src/T2DLL/T2WeatherFilter.cpp +++ b/src/T2DLL/T2WeatherFilter.cpp @@ -106,6 +106,7 @@ void T2WeatherFilter::RainySkyFilter(unsigned long time, RGBQUAD* rgb) { } void T2WeatherFilter::SnowySkyFilter(unsigned long time, RGBQUAD* rgb) { +#pragma var_order(g, r, z, b, c) int z = ((rgb->rgbRed * 33) + (rgb->rgbGreen * 42) + (rgb->rgbBlue * 25)) / 100; int r = (((z * 180) / 255) & 255) + 80; int g = (((z * 180) / 255) & 255) + 80; diff --git a/src/T2TowerDoc.h b/src/T2TowerDoc.h index 2af4ff0..e657d47 100644 --- a/src/T2TowerDoc.h +++ b/src/T2TowerDoc.h @@ -40,17 +40,17 @@ public: virtual int towerDoc_vf108() const; // get zoom level virtual T2BitImage *towerDoc_vf10C() const; // 110 - virtual T2TowerMainView *GetTowerMainView(); + virtual T2TowerMainView *GetTowerMainView(); // GetMainView ref: Mac ver asserts virtual void towerDoc_vf114(); virtual void towerDoc_vf118(); virtual void towerDoc_vf11C(int startIndex, int count, PALETTEENTRY *entries); // updates palette // 120 virtual T2DateTime *towerDoc_vf120() const; - virtual T2RouteNavigator *towerDoc_vf124(); + virtual T2RouteNavigator *towerDoc_vf124(); // GetRouteNavi() virtual T2TemplatePluginList *towerDoc_vf128(); virtual T2FloorInfo *towerDoc_vf12C() const; // 130 - virtual T2Pool *towerDoc_vf130(); + virtual T2Pool *towerDoc_vf130(); // GetPool virtual T2SoundPlayer *towerDoc_vf134(); virtual int towerDoc_vf138() const; // game level? virtual T2TowerMessage *towerDoc_vf13C(); diff --git a/src/T2TowerMainView.h b/src/T2TowerMainView.h index d611989..4bb33ad 100644 --- a/src/T2TowerMainView.h +++ b/src/T2TowerMainView.h @@ -10,7 +10,7 @@ public: virtual void tmv_vf11C(); virtual void tmv_vf120(); // DrawSimulation? virtual void tmv_vf124(BOOL); // some invalidator - virtual void tmv_vf128(const RECT &, BOOL flag = false); // updates various rects + virtual void tmv_vf128(const RECT &, BOOL flag = false); // updates various rects - InvalUnitRect? virtual void tmv_vf12C(); virtual void tmv_vf130(int); // set scroll Y? virtual void tmv_vf134(int); // set scroll X: diff --git a/src/common.h b/src/common.h index 7ccf015..779d46f 100644 --- a/src/common.h +++ b/src/common.h @@ -1,4 +1,5 @@ #pragma once +#define VC_EXTRALEAN #include <AFX.H> // a terrible, terrible kludge @@ -286,8 +287,8 @@ enum EEquipPos { }; enum ERequestUpDown { - ERequestUpDown_0, - ERequestUpDown_1 + ERequestUpDown_0, // up? + ERequestUpDown_1 // down? }; struct BkgndInfo; |