summaryrefslogtreecommitdiff
path: root/src/Plugins/Common
diff options
context:
space:
mode:
Diffstat (limited to 'src/Plugins/Common')
-rw-r--r--src/Plugins/Common/StdFoodInfoDialog.cpp67
-rw-r--r--src/Plugins/Common/StdFoodInfoDialog.h10
-rw-r--r--src/Plugins/Common/StdShopInfoDialog.cpp187
-rw-r--r--src/Plugins/Common/StdShopInfoDialog.h17
-rw-r--r--src/Plugins/Common/StdTenantInfoDialog.cpp390
-rw-r--r--src/Plugins/Common/StdTenantInfoDialog.h24
6 files changed, 687 insertions, 8 deletions
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;
};