diff options
author | Ash Wolf <ninji@wuffs.org> | 2023-07-06 10:49:52 +0100 |
---|---|---|
committer | Ash Wolf <ninji@wuffs.org> | 2023-07-06 10:49:52 +0100 |
commit | 96a63139221587c6be9659c1e07eacd3a8e7f048 (patch) | |
tree | 23aef453ef216c97b762637f553d131646fd5985 | |
parent | 27fc86e8c0450a7fe33d76344c4d53e23a70a6c3 (diff) | |
download | t2win-96a63139221587c6be9659c1e07eacd3a8e7f048.tar.gz t2win-96a63139221587c6be9659c1e07eacd3a8e7f048.zip |
add untested Burger code
29 files changed, 1242 insertions, 66 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 0cdd0bc..8092cb2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -681,6 +681,8 @@ add_library(Food_Burger src/Plugins/Common/StdShopInfoDialog.h src/Plugins/Common/StdTenantInfoDialog.cpp src/Plugins/Common/StdTenantInfoDialog.h + src/Plugins/Food/Common/Trash.cpp + src/Plugins/Food/Common/Trash.h ) add_library(Food_Cafe diff --git a/src/Plugins/Common/StdFoodInfoDialog.cpp b/src/Plugins/Common/StdFoodInfoDialog.cpp index 59d8a8a..e3002bd 100644 --- a/src/Plugins/Common/StdFoodInfoDialog.cpp +++ b/src/Plugins/Common/StdFoodInfoDialog.cpp @@ -1,7 +1,74 @@ +#include "../Food/Common/Trash.h" #include "StdFoodInfoDialog.h" +#include "T2EquipPtrList.h" +#include "T2RouteNavigator.h" +#include "T2Tenant.h" +#include "T2TowerDoc.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif + +StdFoodInfoDialog::StdFoodInfoDialog(T2Tenant *inTenant) + : StdShopInfoDialog(inTenant) +{ +} + +StdFoodInfoDialog::~StdFoodInfoDialog() { +} + +/*virtual*/ void StdFoodInfoDialog::GenerateComments() { + StdShopInfoDialog::GenerateComments(); + + if (GetDocument()->IsDustOn()) { + T2EquipPtrList *theTrashFacilityList = GetTrashFacilities(GetDocument(), GetTenant()); + if (!theTrashFacilityList || theTrashFacilityList->GetCount() == 0) { + // EN: There's no Trash Facility. + AppendComment(14); + } else { + T2RouteNavigator *theNavi = GetDocument()->GetRouteNavi(); +#line 48 + _ASSERT(theNavi != NULL); + + BOOL isNotConnected = true; + T2Tenant *tenant = NULL; + POINT theTenantExit = GetTenant()->GetExitPt(); + + LArrayIterator iterator(*theTrashFacilityList); + while (iterator.Next(&tenant)) { + if (theNavi->CheckRoute(theTenantExit, tenant->GetEntrancePt(), 1000, kRouteType1)) { + isNotConnected = false; + break; + } + } + + if (isNotConnected) { + // EN: Item not connected to Trash Facility. + AppendComment(15); + } + } + } + + if (GetTenant()->GetWorkCount() >= 3) { + // EN: Forced to close. + AppendComment(16); + } else if (GetTenant()->GetWorkCount() > 0) { + // EN: Full of garbage. + AppendComment(15); + } +} + +/*virtual*/ BOOL StdFoodInfoDialog::GenerateStatusProc(CString &outStr, BOOL &outIsBad) { + BOOL result = false; + + if (GetTenant()->GetWorkCount() >= 3) { + // "営業停止" - Suspension of business + outStr = "\x89\x63\x8B\xC6\x92\xE2\x8E\x7E"; + outIsBad = true; + result = true; + } + + return result; +} diff --git a/src/Plugins/Common/StdFoodInfoDialog.h b/src/Plugins/Common/StdFoodInfoDialog.h index 3a72974..f340a18 100644 --- a/src/Plugins/Common/StdFoodInfoDialog.h +++ b/src/Plugins/Common/StdFoodInfoDialog.h @@ -1,5 +1,13 @@ #pragma once #include "common.h" +#include "StdShopInfoDialog.h" -class StdFoodInfoDialog { +class StdFoodInfoDialog : public StdShopInfoDialog { +public: + StdFoodInfoDialog(T2Tenant *inTenant); + virtual ~StdFoodInfoDialog(); + +protected: + virtual void GenerateComments(); + virtual BOOL GenerateStatusProc(CString &outStr, BOOL &outIsBad); }; diff --git a/src/Plugins/Common/StdShopInfoDialog.cpp b/src/Plugins/Common/StdShopInfoDialog.cpp index a3ee04d..43e7283 100644 --- a/src/Plugins/Common/StdShopInfoDialog.cpp +++ b/src/Plugins/Common/StdShopInfoDialog.cpp @@ -1,7 +1,194 @@ #include "StdShopInfoDialog.h" +#include "T2DateTime.h" +#include "T2DlgItemArrows.h" +#include "T2DlgItemEdit.h" +#include "T2DlgItemMerchandiseField.h" +#include "T2Tenant.h" +#include "T2TenantMemberDef.h" +#include "T2TenantMemberTableDef.h" +#include "T2TowerDoc.h" +#include "T2WorldDef.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif + +StdShopInfoDialog::StdShopInfoDialog(T2Tenant *inTenant) + : StdTenantInfoDialog(inTenant) + , mNumMerchandise(0) +{ +} + +/*virtual*/ StdShopInfoDialog::~StdShopInfoDialog() { +} + +/*virtual*/ void StdShopInfoDialog::GenerateComments() { + StdTenantInfoDialog::GenerateComments(); + + T2DateTime *now = GetDocument()->GetNow(); +#line 40 + _ASSERT(now != NULL); + + if (GetTenant()->IsOpen()) { + // EN: There aren't many customers. + int id = 18; + + switch (GetTenant()->CalcEstimateColor()) { + case 9: + // EN: There aren't many customers. + id = 18; + break; + case 14: + // EN: There are a few customers. + id = 19; + break; + case 12: + // EN: Business is booming. + id = 20; + break; + } + + AppendComment(id); + + if (id == 20 && now->IsHoliday(GetDocument())) { + // EN: There are many customers due to the weekend. + AppendComment(21); + } + + if (id == 18 && GetDocument()->GetWorldDef()->IsRainyDay(now)) { + // EN: There are fewer customers because its a rainy day. + AppendComment(22); + } + } else { + if (GetTenant()->GetStatus() == kTenantStatus11) { + // EN: Will be opened tomorrow. + AppendComment(23); + } + } +} + +/*virtual*/ void StdShopInfoDialog::OnT2Create() { + StdTenantInfoDialog::OnT2Create(); + + if (!GetTenant()->IsFire()) + InitNormal(); + else + InitFire(); +} + +/*virtual*/ void StdShopInfoDialog::OnT2OK() { + StdTenantInfoDialog::OnT2OK(); + + if (!GetTenant()->IsFire()) + SaveMerchandise(); +} + +void StdShopInfoDialog::InitNormal() { + T2TenantMemberTableDef *theTMT = GetTenant()->GetMerchandiseTMT(); + if (theTMT) { + mNumMerchandise = theTMT->GetNumOfElem(); + + for (int i = 0; i < 4; i++) { + T2TenantMemberDef *theMerchandise = (i < mNumMerchandise) ? theTMT->GetElem(i) : NULL; + + T2DlgItem *text = GetT2DlgItem(8001 + i * 4); + if (text && theMerchandise) { + CString name; + theMerchandise->GetName(name); + text->SetDescriptor(name); + } + + T2DlgItem *merchandise = GetT2DlgItem(8002 + i * 4); + if (merchandise) { + if (theMerchandise) + merchandise->SetValue(theMerchandise->GetPercent()); + else + merchandise->EnableWindow(false); + } + + T2DlgItemArrows *arrows = (T2DlgItemArrows *) GetT2DlgItem(8003 + i * 4); + if (arrows) { + if (theMerchandise) + arrows->SetValue(theMerchandise->GetPercent()); + + arrows->SetMinValue(0); + arrows->SetMaxValue(100); + arrows->ShowWindow(SW_HIDE); + } + } + } +} + +void StdShopInfoDialog::InitFire() { + for (int i = 0; i < 4; i++) { + T2DlgItem *merchandise = GetT2DlgItem(8002 + i * 4); + merchandise->EnableWindow(false); + + T2DlgItemArrows *arrows = (T2DlgItemArrows *) GetT2DlgItem(8003 + i * 4); + arrows->ShowWindow(SW_HIDE); + } +} + +void StdShopInfoDialog::SaveMerchandise() { + if (mNumMerchandise > 0) { + int i, array[4]; + + for (i = 0; i < 4; i++) { + T2DlgItem *theField = GetT2DlgItem(8002 + i * 4); + if (theField) + array[i] = theField->GetValue(); + else + break; + } + + GetTenant()->SetMerchandise(i, array); + } +} + +/*virtual*/ BOOL StdShopInfoDialog::OnT2DialogCommand(WPARAM inWParam, LPARAM inLParam) { + BOOL result = false; + WORD code = HIWORD(inWParam); + WORD itemID = LOWORD(inWParam); + + for (int n = 0; n < 4; n++) { + if (itemID == (8003 + n * 4)) { + result = true; + + T2DlgItemArrows *arrows = (T2DlgItemArrows *) GetT2DlgItem(8003 + n * 4); + T2DlgItemMerchandiseField *field = (T2DlgItemMerchandiseField *) GetT2DlgItem(8002 + n * 4); + if (arrows && field) { + int change = arrows->GetValue() - field->GetValue(); + if (change == 0) + break; + + for (int next = (n + 1) % mNumMerchandise; next != n; next = (next + 1) % mNumMerchandise) { + T2DlgItemArrows *nextArrows = (T2DlgItemArrows *) GetT2DlgItem(8003 + next * 4); + T2DlgItemMerchandiseField *nextField = (T2DlgItemMerchandiseField *) GetT2DlgItem(8002 + next * 4); + + if (nextArrows && nextField) { + int nextValue = nextField->GetValue(); + if ((change > 0 && nextValue > 0) || (change < 0 && nextValue < 100)) { + nextValue -= change; + nextField->SetValue(nextValue); + nextArrows->SetValue(nextValue); + nextField->Invalidate(); + + field->SetValue(arrows->GetValue()); + field->SelectAll(); + field->Invalidate(); + break; + } + } + } + } + break; + } + } + + if (!result) + result = StdTenantInfoDialog::OnT2DialogCommand(inWParam, inLParam); + + return result; +} diff --git a/src/Plugins/Common/StdShopInfoDialog.h b/src/Plugins/Common/StdShopInfoDialog.h index d1f79d7..280b2cc 100644 --- a/src/Plugins/Common/StdShopInfoDialog.h +++ b/src/Plugins/Common/StdShopInfoDialog.h @@ -1,5 +1,20 @@ #pragma once #include "common.h" +#include "StdTenantInfoDialog.h" -class StdShopInfoDialog { +class StdShopInfoDialog : public StdTenantInfoDialog { +public: + StdShopInfoDialog(T2Tenant *inTenant); + virtual ~StdShopInfoDialog(); + +protected: + virtual void GenerateComments(); + virtual void OnT2Create(); + virtual void OnT2OK(); + void InitNormal(); + void InitFire(); + void SaveMerchandise(); + virtual BOOL OnT2DialogCommand(WPARAM inWParam, LPARAM inLParam); + + int mNumMerchandise; }; diff --git a/src/Plugins/Common/StdTenantInfoDialog.cpp b/src/Plugins/Common/StdTenantInfoDialog.cpp index 0cac85b..3bad68c 100644 --- a/src/Plugins/Common/StdTenantInfoDialog.cpp +++ b/src/Plugins/Common/StdTenantInfoDialog.cpp @@ -1,7 +1,387 @@ #include "StdTenantInfoDialog.h" +#include "T2DlgItemCustomerGage.h" +#include "T2DlgItemPeopleView.h" +#include "T2DlgItemProfitsGage.h" +#include "T2DlgItemText.h" +#include "T2FloorInfo.h" +#include "T2Maru_Reggae.h" +#include "T2Mover.h" +#include "T2Name.h" +#include "T2NameList.h" +#include "T2People.h" +#include "T2PeopleLinkIterator.h" +#include "T2PeoplePtrList.h" +#include "T2RouteCEArray.h" +#include "T2RouteNavigator.h" +#include "T2Tenant.h" +#include "T2TenantDef.h" +#include "T2TowerDoc.h" +#include "T2WorldDef.h" +#include "UT2Coordinate.h" +#include "UT2Utils.h" -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif +StdTenantInfoDialog::StdTenantInfoDialog(T2Tenant *inTenant) + : T2TenantInfoDialog(inTenant) + , mNumCommentLines(0) +{ + mIsFavorited = 0; +} + +/*virtual*/ StdTenantInfoDialog::~StdTenantInfoDialog() { +} + +/*virtual*/ BOOL StdTenantInfoDialog::OnT2DialogCommand(WPARAM inWParam, LPARAM inLParam) { + WORD code = HIWORD(inWParam); + WORD id = LOWORD(inWParam); + + if (code == -1 && id == 7090) { // favourite button + GetT2DlgItem(7090)->EnableWindow(false); + mIsFavorited = 1; + + CString name; + T2DlgItem *nameField = (T2DlgItem *) GetDlgItem(7003); + nameField->GetDescriptor(name); + + if (name == "") + nameField->SetDescriptor(mTenantName); + } +} + +/*virtual*/ void StdTenantInfoDialog::OnT2Create() { + if (!GetDocument() || !GetDocument()->mWorldDef) + return; + + CString text; + T2DlgItem *item = NULL; + + // ID + item = GetT2DlgItem(7001); + if (item) { + int roomNumber = GetTenant()->GetRoomNumber(GetDocument()->mFloorInfo); + UT2Utils::GetRoomNumberString(roomNumber, text); + item->SetDescriptor(text); + } + + // Name + item = GetT2DlgItem(7003); + if (item) { + T2Name *theName = GetDocument()->mNameDB->Search(GetTenant()); + if (theName) { + unsigned int id; + theName->GetName(mTenantName, id); + } else { + GetTenant()->GetTypicalName(mTenantName); + } + item->SetDescriptor(mTenantName); + } + + // Image + item = GetT2DlgItem(7004); + if (item) + UpdateViewOfTenant(item); + + GenerateStatus(); + + if (!GetTenant()->IsFire()) { + // Hours + item = GetT2DlgItem(7021); + if (item) { + int theOpenTime = GetTenant()->GetOpenTime(); + int theCloseTime = GetTenant()->GetCloseTime(); + text.Format( + "%d:%02d\x81\x60%d:%02d", + theOpenTime / 60, theOpenTime % 60, + theCloseTime / 60, theCloseTime % 60 + ); + item->SetDescriptor(text); + } + + item = GetT2DlgItem(7022); + if (item) { + text.Format("%d", GetDocument()->mWorldDef->ExchangeMoney(GetTenant()->GetInMoney())); + item->SetDescriptor(text); + } + + item = GetT2DlgItem(7023); + if (item) { + item->GetDescriptor(text); + text += GetDocument()->mWorldDef->GetMoneyUnit(); + item->SetDescriptor(text); + } + + // Customers + item = GetT2DlgItem(7030); + if (item) { + text.Format("%d", GetTenant()->GetTotalCustomer()); + item->SetDescriptor(text); + } + + item = GetT2DlgItem(7031); + if (item) { + text.Format("%d", GetDocument()->mWorldDef->ExchangeMoney(GetTenant()->GetInMoney() * 100)); + item->SetDescriptor(text); + } + + item = GetT2DlgItem(7032); + if (item) { + item->GetDescriptor(text); + text += GetDocument()->mWorldDef->GetMoneyUnit(); + item->SetDescriptor(text); + } + + item = GetT2DlgItem(7042); + if (item) { + T2DlgItemProfitsGage *profitsGage = (T2DlgItemProfitsGage *) item; + profitsGage->SetTenant(GetTenant()); + } + + item = GetT2DlgItem(7043); + if (item) { + item->GetDescriptor(text); + text += GetDocument()->mWorldDef->GetMoneyUnit(); + item->SetDescriptor(text); + } + + T2PeoplePtrList *theBelongList = GetTenant()->GetBelongList(); + item = GetT2DlgItem(7060); + if (theBelongList && item) { + T2DlgItemPeopleView *peopleView = (T2DlgItemPeopleView *) item; + peopleView->StartAdd(); + + T2People *thePeople; + LArrayIterator iterator(*theBelongList); + + while (iterator.Next(&thePeople)) { + if (thePeople && thePeople->GetCurTenantID() == GetTenant()->GetEquipID()) + peopleView->AddOne(thePeople); + } + + peopleView->FinishAdd(); + } + + T2People *theFirstPeople = GetTenant()->GetFirstPeople(); + item = GetT2DlgItem(7061); + if (theFirstPeople && item) { + T2DlgItemPeopleView *thePeopleView = (T2DlgItemPeopleView *) item; + thePeopleView->StartAdd(); + + T2People *thePeople; + T2PeopleLinkIterator theIterator(theFirstPeople); + + while (theIterator.Next(&thePeople)) { + if ( + thePeople && + thePeople->GetCurTenantID() == GetTenant()->GetEquipID() && + thePeople->GetWorkTenant() != GetTenant()->GetEquipID() + ) + thePeopleView->AddOne(thePeople); + } + + thePeopleView->FinishAdd(); + } + + item = GetT2DlgItem(7042); + if (item) { + T2DlgItemCustomerGage *customerGage = (T2DlgItemCustomerGage *) item; + customerGage->SetTenant(GetTenant()); + } + } + + T2Name *theExistingName = mTowerDoc->mNameDB->Search(GetTenant()); + if (theExistingName) + GetT2DlgItem(7090)->EnableWindow(false); + + GenerateComments(); +} + +/*virtual*/ void StdTenantInfoDialog::OnT2Destroy() { + // empty +} + +/*virtual*/ void StdTenantInfoDialog::AppendLine(const CString &inStr) { + if (mNumCommentLines < 4) { + mNumCommentLines++; + + T2DlgItem *theItem = GetT2DlgItem(7080); + if (theItem) { + CString str; + theItem->GetDescriptor(str); + str += '\r'; + theItem->SetDescriptor(str); + } + } +} + +/*virtual*/ void StdTenantInfoDialog::AppendComment(unsigned int inID, T2Equip *inEquip) { + CString str, comment; + + if (inEquip) + inEquip->GetTypicalName(str); + + GetCommentString(inID, comment); + str += comment; + AppendLine(str); +} + +/*virtual*/ void StdTenantInfoDialog::UpdateViewOfTenant(T2DlgItem *inItem) { + T2TenantDef *theTenantDef = GetTenantDef(); + T2Tenant *theTenant = GetTenant(); + CString str; + + if (theTenantDef && theTenant) { + if (theTenant->IsFire()) { + inItem->SetDescriptor("Rubble"); + inItem->SetValue(0); + } else { + inItem->SetValue( + GetTenant()->GetValiation() * 1000 + + theTenantDef->mHeight * 100 + + GetTenant()->GetPatIndex() + ); + } + + CRect theDialogArea, theTenantRect; + GetClientRect(theDialogArea); + theTenant->GetEquipArea(theTenantRect); + + CSize theSize = theTenantRect.Size(); + + int multiplier = (theSize.cy == 1) ? 2 : 1; + int theHeight = ((theSize.cy * UT2Coordinate::UnitVSize(0)) - UT2Coordinate::CalcRoofThick(0) - UT2Coordinate::CalcFloorThick(0)) * multiplier; + int theWidth = min(theSize.cx * UT2Coordinate::UnitHSize(0) * multiplier, theDialogArea.Width() - 26); + + CRect rect(0, 0, theWidth, theHeight); + inItem->MapWindowPoints(inItem->GetParent(), rect); + inItem->MoveWindow(rect); + + T2DlgItem *theBox = GetT2DlgItem(7504); + if (theBox) { + rect.InflateRect(1, 1); + theBox->MoveWindow(rect); + } + } +} + +/*virtual*/ BOOL StdTenantInfoDialog::GenerateStatusProc(CString &outStr, BOOL &outIsBad) { + return false; +} + +void StdTenantInfoDialog::GenerateStatus() { + T2DlgItemText *theTextItem = (T2DlgItemText *) GetT2DlgItem(7010); + if (theTextItem) { + CString str; + BOOL bad = false; + + if (!GetDocument()->GetRouteNavi()->IsConnectRouteFromLobby(GetTenant()->GetEntrancePt())) { + // "ロビー未接続" - Lobby not connected + str = "\x83\x8D\x83\x72\x81\x5B\x96\xA2\x90\xDA\x91\xB1"; + bad = true; + } else if (0) { + // "停電" - Blackout + str = "\x92\xE2\x93\x64"; + bad = true; + } else if (GetTenant()->IsFire()) { + // "火災の焼け跡" - fire scars + str = "\x89\xCE\x8D\xD0\x82\xCC\x8F\xC4\x82\xAF\x90\xD5"; + bad = true; + } else if (GenerateStatusProc(str, bad)) { + // use it as-is + } else { + // "稼働中" - in operation + str = "\x89\xD2\x93\xAD\x92\x86"; + } + + theTextItem->SetDescriptor(str); + if (bad) + theTextItem->SetTextColor(PALETTERGB(255, 0, 0)); + } +} + +/*virtual*/ void StdTenantInfoDialog::GenerateComments() { + ClearComment(); + + if (!GetDocument()->GetRouteNavi()->IsConnectRouteFromLobby(GetTenant()->GetEntrancePt())) { + // EN: Need a more direct route to destination. + AppendComment(2); + } else if (GetTenant()->GetInMoney() != 0 && GetTenant()->GetBelongCapacity() != 0) { + T2Tenant *theEntranceFloor = GetDocument()->mFloorInfo->GetTenant(GetTenant()->GetEntranceFloorID()); +#line 380 + _ASSERT(theEntranceFloor != NULL); + + POINT entrancePt = GetTenant()->GetEntrancePt(); + T2Mover *nearMover = NULL; + unsigned int nearMoverScore = 0xFFFFFFFF; + + unsigned int theID = 0; + LArrayIterator iterator(*theEntranceFloor->GetCEArray()); + while (iterator.Next(&theID)) { + T2Mover *theMover = GetDocument()->mFloorInfo->GetMover(theID); + if (!theMover || !theMover->IsSetAttribute(kMoverAttrRoutingTable0)) + continue; + + CRect moverArea; + theMover->GetEquipArea(moverArea); + + int h = (moverArea.left + moverArea.right) / 2; + int theDistance = abs(h - entrancePt.x); + if (theDistance < nearMoverScore) { + nearMover = theMover; + nearMoverScore = theDistance; + } + } + + if (nearMover) { + if (nearMoverScore >= 160) { + if (nearMover->IsStair()) { + // EN: is far away. + AppendComment(6, nearMover); + } else { + // EN: Elevator is far away. + AppendComment(4); + } + } else if (nearMoverScore >= 96) { + if (nearMover->IsStair()) { + // EN: is a bit far away. + AppendComment(5, nearMover); + } else { + // EN: Elevator is far away. + AppendComment(4); + } + } + } + } + + T2Maru_Reggae *theReggae = GetDocument()->mWorldDef->GetReggae(); + if (theReggae && theReggae->GetVisitTenant() == GetTenant()) { + // EN: Uncle Reggae is noisy and annoying. + AppendComment(8); + } +} + +/*virtual*/ void StdTenantInfoDialog::OnT2OK() { + CString str; + ((T2DlgItem *) GetDlgItem(7003))->GetDescriptor(str); + if (str == "") + str = mTenantName; + + if (mTenantName != str || mIsFavorited == 1) { + T2Name *theName = mTowerDoc->mNameDB->Search(GetTenant()); + if (theName) { + theName->SetName(str); + } else { + T2Name *newName = new T2Name(str, GetTenant(), false); + mTowerDoc->mNameDB->Add(newName); + } + } +} + +/*virtual*/ void StdTenantInfoDialog::OnT2Cancel() { + // empty +} + +void StdTenantInfoDialog::ClearComment() { + T2DlgItem *theItem = GetT2DlgItem(7080); + if (theItem) + theItem->SetDescriptor(""); + mNumCommentLines = 0; +} diff --git a/src/Plugins/Common/StdTenantInfoDialog.h b/src/Plugins/Common/StdTenantInfoDialog.h index b2e1eac..6220261 100644 --- a/src/Plugins/Common/StdTenantInfoDialog.h +++ b/src/Plugins/Common/StdTenantInfoDialog.h @@ -1,5 +1,27 @@ #pragma once #include "common.h" +#include "T2TenantInfoDialog.h" -class StdTenantInfoDialog { +class StdTenantInfoDialog : public T2TenantInfoDialog { +public: + StdTenantInfoDialog(T2Tenant *inTenant); + virtual ~StdTenantInfoDialog(); + +protected: + virtual BOOL OnT2DialogCommand(WPARAM inWParam, LPARAM inLParam); + virtual void OnT2Create(); + virtual void OnT2Destroy(); + virtual void OnT2OK(); + virtual void OnT2Cancel(); + virtual void AppendLine(const CString &inStr); + virtual void AppendComment(unsigned int inID, T2Equip *inEquip = NULL); + virtual void GenerateComments(); + virtual BOOL GenerateStatusProc(CString &outStr, BOOL &outIsBad); + virtual void UpdateViewOfTenant(T2DlgItem *inItem); + void GenerateStatus(); + void ClearComment(); + + int mNumCommentLines; + CString mTenantName; + int mIsFavorited; }; diff --git a/src/Plugins/Food/Burger/Burger.cpp b/src/Plugins/Food/Burger/Burger.cpp index 4b81d7b..e18f508 100644 --- a/src/Plugins/Food/Burger/Burger.cpp +++ b/src/Plugins/Food/Burger/Burger.cpp @@ -1,7 +1,59 @@ #include "Burger.h" +#include "T2PluginSpecifier.h" +#include "../Common/FoodDef.h" +#include "../Common/FoodPlugin.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif + +BEGIN_MESSAGE_MAP(CBurgerApp, CWinApp) +END_MESSAGE_MAP() + +CBurgerApp::CBurgerApp() { +} + +CBurgerApp theApp; + +FoodPlugin *sFoodPlugin; +FoodDef *sFoodDef; + +extern "C" void *AFX_EXT_API CALLBACK ConstructProgramPlugin(T2PluginSpecifier *inSpecifier) { + if (!sFoodPlugin) { +#line 88 + sFoodPlugin = new FoodPlugin('TnPl', inSpecifier); + } + + return sFoodPlugin; +} + +extern "C" void *AFX_EXT_API CALLBACK ConstructTemplatePlugin(T2PluginSpecifier *inSpecifier, CResFile *inResFile, T2WorldDef *inWorldDef, T2TenantPlugin *inPlugin) { + if (!sFoodDef) { +#line 101 + sFoodDef = new FoodDef('TnDf', *inSpecifier, inResFile, inWorldDef, inPlugin); + } + + return sFoodDef; +} + +extern "C" void *AFX_EXT_API CALLBACK DestructProgramPlugin() { + delete sFoodPlugin; + sFoodPlugin = NULL; + + delete sFoodDef; + sFoodDef = NULL; + + return NULL; +} + +extern "C" T2PluginSpecifier *AFX_EXT_API CALLBACK GetAttr(T2PluginSpecifier *inSpecifier, CResFile *inResFile, T2WorldDef *inWorldDef, T2TenantPlugin *inPlugin) { +#line 120 + T2PluginSpecifier *specifier = new T2PluginSpecifier; + specifier->mPluginName = "Burgar"; + specifier->mType = 'TnPl'; + specifier->mAttrib = 0xFFFFFFFF; + specifier->mGameLevel = 0; + return specifier; +} diff --git a/src/Plugins/Food/Burger/Burger.h b/src/Plugins/Food/Burger/Burger.h index a99da1b..37b2774 100644 --- a/src/Plugins/Food/Burger/Burger.h +++ b/src/Plugins/Food/Burger/Burger.h @@ -1,5 +1,9 @@ #pragma once #include "common.h" -class Burger { +class CBurgerApp : public CWinApp { +public: + CBurgerApp(); + + DECLARE_MESSAGE_MAP() }; diff --git a/src/Plugins/Food/Common/FoodDef.cpp b/src/Plugins/Food/Common/FoodDef.cpp index 821a063..dfc84ad 100644 --- a/src/Plugins/Food/Common/FoodDef.cpp +++ b/src/Plugins/Food/Common/FoodDef.cpp @@ -1,7 +1,298 @@ #include "FoodDef.h" +#include "../../Common/StdFoodInfoDialog.h" +#include "Trash.h" +#include "T2DateTime.h" +#include "T2People.h" +#include "T2SoundPlayer.h" +#include "T2TemplatePluginList.h" +#include "T2Tenant.h" +#include "T2TowerDoc.h" +#include "T2TowerMainView.h" +#include "UT2Utils.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif + +FoodDef::FoodDef(DWORD inType, T2PluginSpecifier &inSpecifier, CResFile *inResFile, T2WorldDef *inWorldDef, T2TenantPlugin *inPlugin) + : T2TenantDef(inType, inSpecifier, inResFile, inWorldDef, inPlugin) +{ +} + +/*virtual*/ FoodDef::~FoodDef() { +} + +/*virtual*/ void FoodDef::LoadSound(T2TowerDoc *inDoc) { + inDoc->mSoundPlayer->AddSound(CalcSoundID(1000), SoundPriority_3, 165, mModuleHandle); +} + +/*virtual*/ BOOL FoodDef::ChangeStatusOnIdle(T2TowerDoc *inDoc, T2Tenant *inTenant, int inStatus) { + BOOL isChange = false; + T2DateTime *theNow = inDoc->GetNow(); + + if (inTenant->IsOpen()) { + unsigned int closeTime = inTenant->GetCloseTime(); + if (!theNow->WithinMinutes(closeTime, closeTime + 8)) { + inTenant->CollectCustomer(inDoc); + if (inTenant->SetPeopleAnime()) + isChange = true; + + if (theNow->GetMinutes() < 8) { + BOOL estimateChanged = inTenant->UpdateCommercialEstimate(); + isChange |= (inDoc->GetViewMode() == kEvalView) && estimateChanged; + } + + if (UT2Utils::Randomize(7) == 0) + inTenant->PlaySound(inDoc, 1000, SoundMask_2, SoundFlags_1); + } else { + if (inDoc->IsDustOn()) + inTenant->IncWorkCount(); + + inDoc->DoPayTool( + -inTenant->CalcInMoney(), + kFundGroup3, + inTenant->GetEquipDef(), + // I got money from the restaurant. + // "レストランの売上金が入りました。" + "\x83\x8C\x83\x58\x83\x67\x83\x89\x83\x93\x82\xCC\x94\x84\x8F\xE3\x8B\xE0\x82\xAA\x93\xFC\x82\xE8\x82\xDC\x82\xB5\x82\xBD\x81\x42", + kTimeLimitLength30Min, + kTimeLimitTypeCategory); + + if (inTenant->GetOpenTime() != closeTime) { + inTenant->PushOutAllCustomer(inDoc); + inTenant->SetStatus(kTenantStatus15); + inTenant->SetPatIndex(0); + inTenant->SetAllPeopleToSleep(); + isChange = true; + } else { + inTenant->ClearTotalCustomer(); + TakeOutTrash(inDoc, inTenant, theNow->GetRawMinutes()); + + if (inTenant->GetWorkCount() > 2) { + inTenant->SetMark(1); + inTenant->PushOutAll(inDoc); + inTenant->SetStatus(kTenantStatus13); + inTenant->SetPatIndex(0); + isChange = true; + } + } + + BOOL estimateChanged = inTenant->UpdateCommercialEstimate(); + isChange |= (inDoc->GetViewMode() == kEvalView) && estimateChanged; + } + } else { + if (inStatus == kTenantStatus13 || inStatus == kTenantStatus12) { + unsigned int threshold = inTenant->GetOpenTime() - 60; + if (!theNow->WithinMinutes(threshold, threshold + 8)) { + inTenant->PushOutAll(inDoc); + } else { + inTenant->CallBelongPeople(theNow->GetRawMinutes()); + inTenant->SetStatus(kTenantStatus14); + inTenant->ClearTotalCustomer(); + inTenant->ClearReserveCount(); + inTenant->UpdateCommercialEstimate(); + isChange = true; + } + + } else if (inStatus == kTenantStatus14) { + unsigned int theOpenTime = inTenant->GetOpenTime(); + unsigned int theCloseTime = inTenant->GetCloseTime(); + if (theNow->WithinMinutes(theOpenTime, theCloseTime)) { + if (inTenant->GetMark() != 1) { + if (inTenant->GetBelongCount() == inTenant->GetBelongCapacity()) { + inTenant->SetStatus(kTenantStatus30); + inTenant->SetPatIndex(1); + inTenant->SetPeopleAnime(); + isChange = true; + } + } else { + TakeOutTrash(inDoc, inTenant, theNow->GetRawMinutes()); + if (inTenant->GetWorkCount() < 3) { + inTenant->SetMark(-1); + isChange = true; + } + } + } else if (theNow->WithinMinutes(theCloseTime, theCloseTime + 8)) { + inTenant->SetStatus(kTenantStatus13); + } + + } else if (inStatus == kTenantStatus15) { + TakeOutTrash(inDoc, inTenant, theNow->GetRawMinutes()); + if (inTenant->GetWorkCount() > 2) { + inTenant->SetMark(1); + isChange = true; + } + inTenant->SetStatus(kTenantStatus13); + + } else if (inStatus == kTenantStatus11) { + if (theNow->GetRawMinutes() < 8) + inTenant->SetStatus(kTenantStatus12); + + } else if (inStatus == kTenantStatus10) { + if (theNow->GetMinutes() < 8 && inTenant->CollectEmployee(inDoc)) { + UnkVF(inDoc, inTenant); + + int newStatus; + if (theNow->GetRawMinutes() >= (inTenant->GetOpenTime() - 60)) + newStatus = kTenantStatus11; + else + newStatus = kTenantStatus12; + + inTenant->SetStatus(newStatus); + } + + } else if (inStatus == kTenantStatus9) { + int newStatus; + if (inTenant->GetBelongCapacity() > 0) + newStatus = kTenantStatus10; + else if (theNow->GetRawMinutes() >= inTenant->GetOpenTime()) + newStatus = kTenantStatus11; + else + newStatus = kTenantStatus12; + + inTenant->SetStatus(newStatus); + inTenant->SetPatIndex(0); + isChange = true; + } + } + + return isChange; +} + +/*virtual*/ void FoodDef::EnterTenant(T2TowerDoc *inDoc, T2Tenant *inTenant, T2People *inPeople) { + BOOL changed = false; + + if (inTenant->IsBelongPeople(inPeople)) { + if (inPeople->GetStyle() == kPeopleStyle0) { + inPeople->ChangeStyle(kPeopleStyle1); + } else if (inPeople->GetStyle() == kPeopleStyle2) { + inPeople->ChangeStyle(kPeopleStyle1); + inTenant->IncWorkCount(); + if (inTenant->GetWorkCount() > 2) { + inTenant->SetMark(1); + changed = true; + } + } + + if (!inTenant->IsOpen()) { + inPeople->SetToSleep(); + } else { + inTenant->SetPeopleAnime(); + changed = true; + } + } else { + T2DateTime *theNow = inDoc->GetNow(); +#line 273 + _ASSERT(theNow != NULL); + + inTenant->EnterCustomer(inPeople, theNow->GetRawMinutes()); + + int numCustomer = inTenant->GetCustomerCount(); + if (numCustomer == 1) { + inTenant->SetStatus(kTenantStatus31); + inTenant->UpdatePatternIndex(2); + changed = true; + } else if (numCustomer == (inTenant->GetCapacity() / 2)) { + inTenant->SetStatus(kTenantStatus32); + inTenant->UpdatePatternIndex(3); + changed = true; + } + } + + if (changed) { + inTenant->SetDrawMode(DrawMode1); + + T2TowerMainView *theMainView = inDoc->GetMainView(); + if (theMainView) { + RECT area; + inTenant->GetEquipArea(area); + theMainView->InvalUnitRect(area); + } + } +} + +/*virtual*/ void FoodDef::LeaveTenant(T2TowerDoc *inDoc, T2Tenant *inTenant, T2People *inPeople) { + BOOL changed = false; + + if (inTenant->IsBelongPeople(inPeople)) { + if (inPeople->GetStyle() == kPeopleStyle1) + inPeople->ChangeStyle(kPeopleStyle0); + + if (inTenant->IsOpen()) { + inTenant->SetPeopleAnime(); + changed = true; + } + } else { + int numCustomer = inTenant->GetCustomerCount(); + if (numCustomer == 0) { + inTenant->SetStatus(kTenantStatus30); + inTenant->UpdatePatternIndex(1); + changed = true; + } else if (numCustomer == (inTenant->GetCapacity() / 2 - 1)) { + inTenant->SetStatus(kTenantStatus31); + inTenant->UpdatePatternIndex(2); + changed = true; + } + } + + if (changed) { + inTenant->SetDrawMode(DrawMode1); + + T2TowerMainView *theMainView = inDoc->GetMainView(); + if (theMainView) { + RECT area; + inTenant->GetEquipArea(area); + theMainView->InvalUnitRect(area); + } + } +} + +/*virtual*/ int FoodDef::EmergencyProc(T2TowerDoc *inDoc, T2Equip *inEquip) { + T2Tenant *theTenant = (T2Tenant *) inEquip; + + theTenant->PushOutAll(inDoc); + theTenant->ClearReserveCount(); + + if (theTenant->GetStatus() == kTenantStatus14) + theTenant->SetStatus(kTenantStatus13); + + if (theTenant->GetOpenTime() == theTenant->GetCloseTime() && theTenant->IsOpen()) + theTenant->SetStatus(kTenantStatus13); + + return 0; +} + +/*virtual*/ void FoodDef::UnkVF(T2TowerDoc *inDoc, T2Tenant *inTenant) { + T2TemplatePluginList *silhouetteTemplates = inDoc->GetSilhouetteTemplates(); + if (silhouetteTemplates) { + BOOL done = false; + + for (int i = 0; !done; i++) { + T2People *thePeople = inTenant->GetBelongPeople(i); + if (thePeople) { + int theType1, theType2; + if (thePeople->IsMale()) { + theType1 = 1004; + theType2 = 1008; + } else { + theType1 = 1005; + theType2 = 1009; + } + + T2SilhouetteDef *theSilhouetteDef = silhouetteTemplates->FindSilhouette(theType1); + thePeople->SetSilhouetteDef(kPeopleStyle1, theSilhouetteDef); + + theSilhouetteDef = silhouetteTemplates->FindSilhouette(theType2); + thePeople->SetSilhouetteDef(kPeopleStyle2, theSilhouetteDef); + } else { + done = true; + } + } + } +} + +/*virtual*/ T2InfoDialog *FoodDef::ConstructInfoDialog(T2Equip *inEquip) { + return new StdFoodInfoDialog((T2Tenant *) inEquip); +} diff --git a/src/Plugins/Food/Common/FoodDef.h b/src/Plugins/Food/Common/FoodDef.h index 93bbe62..f425270 100644 --- a/src/Plugins/Food/Common/FoodDef.h +++ b/src/Plugins/Food/Common/FoodDef.h @@ -1,5 +1,17 @@ #pragma once #include "common.h" +#include "T2TenantDef.h" -class FoodDef { +class FoodDef : public T2TenantDef { +public: + FoodDef(DWORD inType, T2PluginSpecifier &inSpecifier, CResFile *inResFile, T2WorldDef *inWorldDef, T2TenantPlugin *inPlugin); + virtual ~FoodDef(); + + virtual void LoadSound(T2TowerDoc *inDoc); + virtual BOOL ChangeStatusOnIdle(T2TowerDoc *inDoc, T2Tenant *inTenant, int inStatus); + virtual void EnterTenant(T2TowerDoc *inDoc, T2Tenant *inTenant, T2People *inPeople); + virtual void LeaveTenant(T2TowerDoc *inDoc, T2Tenant *inTenant, T2People *inPeople); + virtual int EmergencyProc(T2TowerDoc *inDoc, T2Equip *inEquip); + virtual void UnkVF(T2TowerDoc *inDoc, T2Tenant *inTenant); + virtual T2InfoDialog *ConstructInfoDialog(T2Equip *inEquip); }; diff --git a/src/Plugins/Food/Common/FoodPlugin.cpp b/src/Plugins/Food/Common/FoodPlugin.cpp index 2b5d041..22e72fe 100644 --- a/src/Plugins/Food/Common/FoodPlugin.cpp +++ b/src/Plugins/Food/Common/FoodPlugin.cpp @@ -5,3 +5,11 @@ #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif + +FoodPlugin::FoodPlugin(DWORD inType, T2PluginSpecifier &inSpecifier) + : T2TenantPlugin(inType, inSpecifier) +{ +} + +/*virtual*/ FoodPlugin::~FoodPlugin() { +} diff --git a/src/Plugins/Food/Common/FoodPlugin.h b/src/Plugins/Food/Common/FoodPlugin.h index 157d64c..5cd0a5a 100644 --- a/src/Plugins/Food/Common/FoodPlugin.h +++ b/src/Plugins/Food/Common/FoodPlugin.h @@ -1,5 +1,9 @@ #pragma once #include "common.h" +#include "T2TenantPlugin.h" -class FoodPlugin { +class FoodPlugin : public T2TenantPlugin { +public: + FoodPlugin(DWORD inType, T2PluginSpecifier &inSpecifier); + virtual ~FoodPlugin(); }; diff --git a/src/Plugins/Food/Common/Trash.cpp b/src/Plugins/Food/Common/Trash.cpp new file mode 100644 index 0000000..15e7c6c --- /dev/null +++ b/src/Plugins/Food/Common/Trash.cpp @@ -0,0 +1,103 @@ +// actual name unknown +#include "T2EquipPtrList.h" +#include "T2People.h" +#include "T2RegistedTenantDB.h" +#include "T2RouteNavigator.h" +#include "T2Tenant.h" +#include "T2TowerDoc.h" +#include "T2TowerMessage.h" +#include "Trash.h" + +void TakeOutTrash(T2TowerDoc *inDoc, T2Tenant *inTenant, unsigned int inTime) { + unsigned int numBelong = inTenant->GetBelongCapacity(); + + for (unsigned int i = 1; inTenant->GetWorkCount() > 0 && i <= numBelong; i++) { + T2People *thePeople = inTenant->GetBelongPeopleIn(i); + if (thePeople) { + T2Tenant *theFacility = SelectTrashFacility(inDoc, inTenant, thePeople); + if (theFacility) { + inTenant->DecWorkCount(); + thePeople->ChangeStyle(kPeopleStyle2); + thePeople->SetDestination(theFacility->GetEquipID(), inTime); + thePeople->SetReturn(inTenant->GetEquipID(), inTime); + theFacility->IncReserveCount(1); + } else { + break; + } + } + } +} + +T2Tenant *SelectTrashFacility(T2TowerDoc *inDoc, T2Tenant *inTenant, T2People *inPeople) { + BOOL isConnectedRoute = false; + BOOL isFacilityBuildFinish = false; + BOOL isFacilityRegisted = false; + + T2Tenant *theTrashFacility = NULL; + T2EquipPtrList *theTrashFacilityList = GetTrashFacilities(inDoc, inTenant); + + if (theTrashFacilityList && theTrashFacilityList->GetCount() > 0) { + T2RouteNavigator *theNavi = inDoc->GetRouteNavi(); + if (theNavi) { + POINT exitPt = inTenant->GetExitPt(); + + LArrayIterator iterator(*theTrashFacilityList); + T2Tenant *tenant; + + while (!theTrashFacility && iterator.Next(&tenant)) { + if (tenant->IsBuildFinish()) { + POINT entrancePt = tenant->GetEntrancePt(); + + if (theNavi->CheckRoute(exitPt, entrancePt, 1000, kRouteType1)) { + if ((tenant->GetTotalCustomer() + tenant->GetReserveCount()) < tenant->GetCapacity()) + theTrashFacility = tenant; + + isConnectedRoute = true; + } + + isFacilityBuildFinish = true; + } + } + } + + isFacilityRegisted = true; + } + + if (!theTrashFacility) { + if (isConnectedRoute) { + inDoc->GetTowerMessage()->PassiveInfoBarMessage( + // We need to expand the garbage collection area. + // "ゴミ回収場の拡張が必要です。" + "\x83\x53\x83\x7E\x89\xF1\x8E\xFB\x8F\xEA\x82\xCC\x8A\x67\x92\xA3\x82\xAA\x95\x4B\x97\x76\x82\xC5\x82\xB7\x81\x42", + 180); + } else if (isFacilityBuildFinish) { + inDoc->GetTowerMessage()->PeopleBalloonMessage( + // Where is the garbage collection point? + // "ゴミ回収場はどこにあるのかな?" + "\x83\x53\x83\x7E\x89\xF1\x8E\xFB\x8F\xEA\x82\xCD\x82\xC7\x82\xB1\x82\xC9\x82\xA0\x82\xE9\x82\xCC\x82\xA9\x82\xC8\x81\x48", + inPeople); + } else if (!isFacilityRegisted) { + inDoc->GetTowerMessage()->PassiveInfoBarMessage( + // A garbage collection point is required in the building. + // "ビル内にゴミ回収場が必要です。" + "\x83\x72\x83\x8B\x93\xE0\x82\xC9\x83\x53\x83\x7E\x89\xF1\x8E\xFB\x8F\xEA\x82\xAA\x95\x4B\x97\x76\x82\xC5\x82\xB7\x81\x42", + 180); + } + } + + return theTrashFacility; +} + +T2EquipPtrList *GetTrashFacilities(T2TowerDoc *inDoc, T2Tenant *inTenant) { + T2EquipPtrList *theList = inTenant->GetRelatedTenantList(); + + if (!theList) { + T2RegistedTenantDB *theDB = inDoc->GetRegistedTenantDB(); + if (theDB) { + theList = theDB->GetList(kTenantRegistID2); + inTenant->SetRelatedTenant(theList); + } + } + + return theList; +} diff --git a/src/Plugins/Food/Common/Trash.h b/src/Plugins/Food/Common/Trash.h new file mode 100644 index 0000000..59b7fdd --- /dev/null +++ b/src/Plugins/Food/Common/Trash.h @@ -0,0 +1,6 @@ +#pragma once +#include "common.h" + +void TakeOutTrash(T2TowerDoc *inDoc, T2Tenant *inTenant, unsigned int inTime); +T2Tenant *SelectTrashFacility(T2TowerDoc *inDoc, T2Tenant *inTenant, T2People *inPeople); +T2EquipPtrList *GetTrashFacilities(T2TowerDoc *inDoc, T2Tenant *inTenant); diff --git a/src/T2DLL/T2Maru_Reggae.cpp b/src/T2DLL/T2Maru_Reggae.cpp index ee863ea..1c6fd2c 100644 --- a/src/T2DLL/T2Maru_Reggae.cpp +++ b/src/T2DLL/T2Maru_Reggae.cpp @@ -379,7 +379,7 @@ void T2Maru_Reggae::ReggaeReception(T2TowerDoc* inDoc, T2People* inPeople) { if ((mCounter % 60) == 0) { CString message; MakeClaimMessage(inDoc, theTenant, message); - inDoc->towerDoc_vf13C()->InfoBarMessage(message, 180, NULL); + inDoc->GetTowerMessage()->InfoBarMessage(message, 180, NULL); if (!mGuardman) mGuardman = new T2Guardman(this, inDoc, theTenant); @@ -409,7 +409,7 @@ void T2Maru_Reggae::ReggaeReception(T2TowerDoc* inDoc, T2People* inPeople) { curPos = inPeople->GetCurPosition(); theTenant = inDoc->GetFloorInfo()->GetTenant(curPos.y, curPos.x); MakeClaimMessage(inDoc, theTenant, message); - inDoc->towerDoc_vf13C()->CancelInfoBarMessage(message); + inDoc->GetTowerMessage()->CancelInfoBarMessage(message); // "レゲエのおじさんは警備員につかまりました。" // Uncle Reggae was caught by a security guard. diff --git a/src/T2DLL/T2People.cpp b/src/T2DLL/T2People.cpp index c83373a..4ce0737 100644 --- a/src/T2DLL/T2People.cpp +++ b/src/T2DLL/T2People.cpp @@ -437,7 +437,7 @@ void T2People::SolveNoRoute(T2TowerDoc* towerDoc) { if (IsWalk()) { // "道がないよ~" - there is no way CString theMessage = "\x93\xB9\x82\xAA\x82\xC8\x82\xA2\x82\xE6\x81\x60"; - towerDoc->towerDoc_vf13C()->PeopleBalloonMessage(theMessage, this); + towerDoc->GetTowerMessage()->PeopleBalloonMessage(theMessage, this); RECT theRect; CalcWalkingSilhouetteArea(theRect); @@ -987,7 +987,7 @@ BOOL T2People::SearchToilet(T2TowerDoc* towerDoc) { ok = true; } else { SetReturnToDestination(); - T2TowerMessage *towerMessage = towerDoc->towerDoc_vf13C(); + T2TowerMessage *towerMessage = towerDoc->GetTowerMessage(); if (towerMessage) { // "トイレが混んでいる" - toilet is crowded CString msg = "\x83\x67\x83\x43\x83\x8C\x82\xAA\x8D\xAC\x82\xF1\x82\xC5\x82\xA2\x82\xE9"; diff --git a/src/T2DLL/T2RouteNavigator.h b/src/T2DLL/T2RouteNavigator.h index a667e07..b12a6b9 100644 --- a/src/T2DLL/T2RouteNavigator.h +++ b/src/T2DLL/T2RouteNavigator.h @@ -3,7 +3,9 @@ enum { kRouteTypeNeg1 = -1, + // Normal people movement kRouteType0 = 0, + // Trash disposal kRouteType1 = 1, kRouteType2 = 2, kRouteType3 = 3, diff --git a/src/T2DLL/T2Settlement.cpp b/src/T2DLL/T2Settlement.cpp index 30ea8e5..ed60b5f 100644 --- a/src/T2DLL/T2Settlement.cpp +++ b/src/T2DLL/T2Settlement.cpp @@ -154,7 +154,7 @@ void T2Settlement::EmitPayToolMessage(T2TowerDoc* towerDoc, T2ToolDef* inToolDef SetTimeLimitOfMessage(towerDoc, inToolDef, type, theTimeLimit); delete theTimeLimit; - towerDoc->towerDoc_vf13C()->InfoBarMessage(str, 120, "Cash"); + towerDoc->GetTowerMessage()->InfoBarMessage(str, 120, "Cash"); } } diff --git a/src/T2DLL/T2SoundPlayer.h b/src/T2DLL/T2SoundPlayer.h index 667ac13..01eb326 100644 --- a/src/T2DLL/T2SoundPlayer.h +++ b/src/T2DLL/T2SoundPlayer.h @@ -10,15 +10,19 @@ enum PLAYMODE { enum SOUNDPRIORITY { SoundPriority_0, - SoundPriority_1 + SoundPriority_1, + SoundPriority_2, + SoundPriority_3 }; enum { + SoundMask_2 = 2, SoundMask_10 = 0x10, SoundMask_20 = 0x20, }; enum { + SoundFlags_1 = 1, SoundFlags_10 = 0x10, SoundFlags_20 = 0x20, SoundFlags_10000 = 0x10000 diff --git a/src/T2DLL/T2Tenant.cpp b/src/T2DLL/T2Tenant.cpp index 0a29db6..dadaf21 100644 --- a/src/T2DLL/T2Tenant.cpp +++ b/src/T2DLL/T2Tenant.cpp @@ -852,7 +852,7 @@ void T2Tenant::CollectCustomer(T2TowerDoc* inDoc, int inNum) { } } - CollectCustomer(inDoc, (T2Tenant *) NULL); + CollectCustomer(inDoc); } int T2Tenant::CollectEmployee(T2TowerDoc* inDoc) { diff --git a/src/T2DLL/T2Tenant.h b/src/T2DLL/T2Tenant.h index e3ac271..6b374fc 100644 --- a/src/T2DLL/T2Tenant.h +++ b/src/T2DLL/T2Tenant.h @@ -10,6 +10,12 @@ enum { kTenantStatus2 = 2, kTenantStatus9 = 9, kTenantStatus10 = 10, + // means it's opening tomorrow + kTenantStatus11 = 11, + kTenantStatus12 = 12, + kTenantStatus13 = 13, + kTenantStatus14 = 14, + kTenantStatus15 = 15, kTenantStatus30 = 30, kTenantStatus9999 = 9999, kTenantStatus10000 = 10000, @@ -25,16 +31,26 @@ enum { }; enum { - kTenantRegistID1 = 1, // hotel rooms - kTenantRegistID2 = 2, // trash facilities - kTenantRegistID3 = 3, // parking - kTenantRegistID4 = 4, // hospital - kTenantRegistID5 = 5, // security - kTenantRegistID6 = 6, // school - kTenantRegistID7 = 7, // toilets - kTenantRegistID8 = 8, // metro railway - kTenantRegistID9 = 9, // boat deck - kTenantRegistID10 = 10, // ticket booth + // hotel rooms + kTenantRegistID1 = 1, + // trash facilities + kTenantRegistID2 = 2, + // parking + kTenantRegistID3 = 3, + // hospital + kTenantRegistID4 = 4, + // security + kTenantRegistID5 = 5, + // school + kTenantRegistID6 = 6, + // toilets + kTenantRegistID7 = 7, + // metro railway + kTenantRegistID8 = 8, + // boat deck + kTenantRegistID9 = 9, + // ticket booth + kTenantRegistID10 = 10, }; class AFX_CLASS_EXPORT T2Tenant : public T2Equip { @@ -104,7 +120,7 @@ public: void UpdatePatternIndex(); void UpdatePatternIndex(int inIndex); int GetNumOfPattern() const; - void CollectCustomer(T2TowerDoc* inDoc, T2Tenant* inTenant); + void CollectCustomer(T2TowerDoc* inDoc, T2Tenant* inTenant = NULL); void CollectCustomer(T2TowerDoc* inDoc, int inNum); int CollectEmployee(T2TowerDoc* inDoc); void RegistBelongPeople(T2People* inPeople); diff --git a/src/T2DLL/T2TenantDef.cpp b/src/T2DLL/T2TenantDef.cpp index 3cde569..e05e982 100644 --- a/src/T2DLL/T2TenantDef.cpp +++ b/src/T2DLL/T2TenantDef.cpp @@ -144,14 +144,14 @@ T2TenantDef::T2TenantDef(DWORD type, T2PluginSpecifier& specifier, CResFile* res int status = theEquip->GetStatus(); unsigned int result = 0; - if (status < kStatus10) { - if (status <= kStatus2 || status == kStatus9) + if (status < kTenantStatus10) { + if (status <= kTenantStatus2 || status == kTenantStatus9) result = 1; status++; theEquip->SetStatus(status); - if (status == kStatus10) { + if (status == kTenantStatus10) { BuildFinish(towerDoc, theEquip); towerDoc->mTowerMainView->InvalUnitRect(theEquip->mArea, true); } @@ -160,8 +160,8 @@ T2TenantDef::T2TenantDef(DWORD type, T2PluginSpecifier& specifier, CResFile* res T2Tenant *theTenant = (T2Tenant *) theEquip; status = theTenant->GetStatus(); - if (status >= kStatus9 && ChangeStatusOnIdle(towerDoc, theTenant, status)) { - if (status == kStatus9) + if (status >= kTenantStatus9 && ChangeStatusOnIdle(towerDoc, theTenant, status)) { + if (status == kTenantStatus9) theTenant->SetDrawMode(DrawMode2); else theTenant->SetDrawMode(DrawMode1); @@ -181,7 +181,7 @@ T2TenantDef::T2TenantDef(DWORD type, T2PluginSpecifier& specifier, CResFile* res if (GetCategory() != 100 && rect.top <= towerDoc->mWorldDef->mTopFloorLine) { if (inShowError) { // EN: Only Final item can be placed on the top floor of building. - towerDoc->towerDoc_vf13C()->BuildErr(68, NULL); + towerDoc->GetTowerMessage()->BuildErr(68, NULL); } return AreaCheckCode_0; } @@ -189,7 +189,7 @@ T2TenantDef::T2TenantDef(DWORD type, T2PluginSpecifier& specifier, CResFile* res if (rect.bottom > towerDoc->mWorldDef->mBottomFloorLine) { if (inShowError) { // EN: Can not place items beyond the edges of the floor below. - towerDoc->towerDoc_vf13C()->BuildErr(2, NULL); + towerDoc->GetTowerMessage()->BuildErr(2, NULL); } return AreaCheckCode_0; } diff --git a/src/T2DLL/T2ToolDef.h b/src/T2DLL/T2ToolDef.h index bb42d77..d819b5c 100644 --- a/src/T2DLL/T2ToolDef.h +++ b/src/T2DLL/T2ToolDef.h @@ -110,13 +110,6 @@ public: int GetOutMoney(unsigned int id) const; void SetOutMoney(unsigned int id, int money); -protected: - friend class T2Mover; - friend class T2Settlement; - friend class T2TemplatePluginList; - friend class T2ToolHelpWnd; - friend class T2TowerDoc; - int mToolType; int mWidth; int mHeight; diff --git a/src/T2DLL/T2TowerMessage.h b/src/T2DLL/T2TowerMessage.h index 67d40ad..300963d 100644 --- a/src/T2DLL/T2TowerMessage.h +++ b/src/T2DLL/T2TowerMessage.h @@ -30,7 +30,7 @@ public: void SpendTime(); void SpendTime2(); void CancelInfoBarMessage(const CString& inText); - void PassiveInfoBarMessage(const char* inText, int inDelay, const char* inSoundID); + void PassiveInfoBarMessage(const char* inText, int inDelay, const char* inSoundID = NULL); void SetCaptureRect(RECT inRect); private: diff --git a/src/T2DLL/T2VisitVIP.cpp b/src/T2DLL/T2VisitVIP.cpp index 0b190d9..fdda3e1 100644 --- a/src/T2DLL/T2VisitVIP.cpp +++ b/src/T2DLL/T2VisitVIP.cpp @@ -177,7 +177,7 @@ T2VisitVIP::T2VisitVIP(T2TowerEvent* inTowerEvent, int inSubID, int inLevelBit, // "の設置が必要です。" - installation is required. str += "\x82\xCC\x90\xDD\x92\x75\x82\xAA\x95\x4B\x97\x76\x82\xC5\x82\xB7\x81\x42"; - inDoc->towerDoc_vf13C()->InfoBarMessage(str, 900, NULL); + inDoc->GetTowerMessage()->InfoBarMessage(str, 900, NULL); } else if (!theSpecifier) { inDoc->mA0 |= mVisitFlag; mStatus = kVisitVIPStatus4; diff --git a/src/T2TowerDoc.cpp b/src/T2TowerDoc.cpp index f9bcf5f..7fb998b 100644 --- a/src/T2TowerDoc.cpp +++ b/src/T2TowerDoc.cpp @@ -2242,7 +2242,7 @@ void T2TowerDoc::LoadSoundForPlugin(T2TemplatePlugin *inPlugin) { if (!inTenant->IsBuildFinish()) { // EN: Can not remove the item under construction until it is completed. - towerDoc_vf13C()->BuildErr(52, NULL); + GetTowerMessage()->BuildErr(52, NULL); if (!inSkipSounds) mSoundPlayer->Play("No", SoundMask_20, SoundFlags_20, &inPt2, PlayMode_2, 100); @@ -2282,7 +2282,7 @@ BOOL T2TowerDoc::OutsideAreaCheck(T2Tenant *inTenant, BOOL inShowError) { if (mFloorInfo->GetOutObjID(v, h) != 0) { if (inShowError) { // EN: Can not remove this floor because an outside item is placed. - towerDoc_vf13C()->BuildErr(69 /*nice*/, NULL); + GetTowerMessage()->BuildErr(69 /*nice*/, NULL); } return false; } @@ -2559,7 +2559,7 @@ void T2TowerDoc::CalcCraneUpdateRect(RECT &ioRect) { success = false; if (inShowError) { // EN: Shortage of construction money. - towerDoc_vf13C()->BuildErr(10, NULL); + GetTowerMessage()->BuildErr(10, NULL); } } } @@ -2577,7 +2577,7 @@ void T2TowerDoc::CalcCraneUpdateRect(RECT &ioRect) { if (inRect.top < buildArea.top || inRect.bottom > buildArea.bottom || inRect.left < buildArea.left || inRect.right > buildArea.right) { if (inShowErr) { // EN: Can not place items here. - towerDoc_vf13C()->BuildErr(8, NULL); + GetTowerMessage()->BuildErr(8, NULL); } return false; } @@ -2585,7 +2585,7 @@ void T2TowerDoc::CalcCraneUpdateRect(RECT &ioRect) { if (!mFloorInfo->IsAreaBuildable(inRect)) { if (inShowErr) { // EN: Can not place items here. - towerDoc_vf13C()->BuildErr(8, NULL); + GetTowerMessage()->BuildErr(8, NULL); } return false; } @@ -2596,7 +2596,7 @@ void T2TowerDoc::CalcCraneUpdateRect(RECT &ioRect) { if (inRect.bottom != mWorldDef->mGroundLine) { if (inShowErr) { // EN: This item can only be placed on the lobby floor. - towerDoc_vf13C()->BuildErr(23, NULL); + GetTowerMessage()->BuildErr(23, NULL); } return false; } @@ -2604,7 +2604,7 @@ void T2TowerDoc::CalcCraneUpdateRect(RECT &ioRect) { if (mWorldDef->mGroundLine > inRect.top && inRect.bottom > (mWorldDef->mGroundLine - mWorldDef->GetLobbyHeight())) { if (inShowErr) { // EN: Can not place this item on the lobby floor. - towerDoc_vf13C()->BuildErr(24, NULL); + GetTowerMessage()->BuildErr(24, NULL); } return false; } @@ -2614,7 +2614,7 @@ void T2TowerDoc::CalcCraneUpdateRect(RECT &ioRect) { if (inRect.bottom > mWorldDef->mGroundLine) { if (inShowErr) { // EN: Can not place this item underground. - towerDoc_vf13C()->BuildErr(6, NULL); + GetTowerMessage()->BuildErr(6, NULL); } return false; } @@ -2624,7 +2624,7 @@ void T2TowerDoc::CalcCraneUpdateRect(RECT &ioRect) { if (inRect.top < mWorldDef->mGroundLine) { if (inShowErr) { // EN: Can not place this item above ground. - towerDoc_vf13C()->BuildErr(7, NULL); + GetTowerMessage()->BuildErr(7, NULL); } return false; } @@ -2640,7 +2640,7 @@ void T2TowerDoc::CalcCraneUpdateRect(RECT &ioRect) { if (IntersectRect(&tmp, &inRect, &equip->mArea)) { if (inShowErr) { // EN: Can not place items where something else already exists. - towerDoc_vf13C()->BuildErr(9, NULL); + GetTowerMessage()->BuildErr(9, NULL); } return false; } @@ -2652,7 +2652,7 @@ void T2TowerDoc::CalcCraneUpdateRect(RECT &ioRect) { if (theTenant && (isBuildingFloor || !theTenant->IsFloor())) { if (inShowErr) { // EN: Can not place items where something else already exists. - towerDoc_vf13C()->BuildErr(9, NULL); + GetTowerMessage()->BuildErr(9, NULL); } return false; } @@ -2677,7 +2677,7 @@ void T2TowerDoc::CalcCraneUpdateRect(RECT &ioRect) { if (m1A0->GetCurBuildCount() >= m1A0->GetMaxBuildCount()) { if (_B0) { // EN: Can not make additional placement of this item. - towerDoc_vf13C()->BuildErr(11, NULL); + GetTowerMessage()->BuildErr(11, NULL); } result = false; } @@ -2886,10 +2886,10 @@ void T2TowerDoc::CalcCraneUpdateRect(RECT &ioRect) { if (!inIsFromMouseMove) { if (inDef->IsStair()) { // EN: can not be placed there. - towerDoc_vf13C()->BuildErr(41, inDef); + GetTowerMessage()->BuildErr(41, inDef); } else { // EN: Can not place elevator system there. - towerDoc_vf13C()->BuildErr(42, NULL); + GetTowerMessage()->BuildErr(42, NULL); } } return false; @@ -2904,7 +2904,7 @@ void T2TowerDoc::CalcCraneUpdateRect(RECT &ioRect) { if (theTenant && theTenant->IsSetAttribute(kTenantAttr40000)) { if (!inIsFromMouseMove) { // EN: Can not place a transit system on the Sky Bridge. - towerDoc_vf13C()->BuildErr(72, NULL); + GetTowerMessage()->BuildErr(72, NULL); } return false; } @@ -2915,10 +2915,10 @@ void T2TowerDoc::CalcCraneUpdateRect(RECT &ioRect) { if (!inIsFromMouseMove) { if (inDef->IsStair()) { // EN: requires space on both sides. - towerDoc_vf13C()->BuildErr(32, inDef); + GetTowerMessage()->BuildErr(32, inDef); } else { // EN: The elevator item requires space on both sides. - towerDoc_vf13C()->BuildErr(33, NULL); + GetTowerMessage()->BuildErr(33, NULL); } } return false; @@ -2931,7 +2931,7 @@ void T2TowerDoc::CalcCraneUpdateRect(RECT &ioRect) { if (cost > GetCurrentFunds()) { if (!inIsFromMouseMove) { // EN: Shortage of construction money. - towerDoc_vf13C()->BuildErr(10, NULL); + GetTowerMessage()->BuildErr(10, NULL); } return false; } @@ -2948,7 +2948,7 @@ void T2TowerDoc::CalcCraneUpdateRect(RECT &ioRect) { if (cost > GetCurrentFunds()) { if (!inIsFromMouseMove) { // EN: Shortage of construction money. - towerDoc_vf13C()->BuildErr(10, NULL); + GetTowerMessage()->BuildErr(10, NULL); } return false; } diff --git a/src/T2TowerDoc.h b/src/T2TowerDoc.h index 9371bce..7bde93f 100644 --- a/src/T2TowerDoc.h +++ b/src/T2TowerDoc.h @@ -130,7 +130,7 @@ public: virtual T2Pool *GetPool() const { return mPool; } virtual T2SoundPlayer *GetSoundPlayer() const { return mSoundPlayer; } virtual int GetLevel() const { return mGameLevel; } - virtual T2TowerMessage *towerDoc_vf13C() { return mTowerMessage; } + virtual T2TowerMessage *GetTowerMessage() { return mTowerMessage; } // 140 virtual int GetViewMode() const { return mViewMode; } virtual void SetViewMode(int inViewMode); diff --git a/src/T2TowerMainView.cpp b/src/T2TowerMainView.cpp index 87508af..64b2f37 100644 --- a/src/T2TowerMainView.cpp +++ b/src/T2TowerMainView.cpp @@ -970,7 +970,7 @@ void T2TowerMainView::HandleLButtonDown(CPoint inPt) { T2Tenant *theTenant = mDocument->mFloorInfo->GetTenant(pt.y, pt.x); if (theTenant && !theTenant->IsFloor()) - theTenant->CollectCustomer(mDocument, (T2Tenant *) NULL); + theTenant->CollectCustomer(mDocument); } else if (*theToolName == "ToolInfo") { mDocument->DoGetInfo(inPt); } else if (*theToolName == "ToolZoom") { |