summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2DlgItemProfitsGage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/T2DLL/T2DlgItemProfitsGage.cpp')
-rw-r--r--src/T2DLL/T2DlgItemProfitsGage.cpp51
1 files changed, 46 insertions, 5 deletions
diff --git a/src/T2DLL/T2DlgItemProfitsGage.cpp b/src/T2DLL/T2DlgItemProfitsGage.cpp
index 9479e65..b5181f1 100644
--- a/src/T2DLL/T2DlgItemProfitsGage.cpp
+++ b/src/T2DLL/T2DlgItemProfitsGage.cpp
@@ -1,34 +1,75 @@
#include "T2DlgItemProfitsGage.h"
+#include "T2Tenant.h"
-T2DlgItemProfitsGage::T2DlgItemProfitsGage(T2TowerDoc*, T2ImageObj*, CPalette*) {
+T2DlgItemProfitsGage::T2DlgItemProfitsGage(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette)
+ : T2DlgItemGageBase(inDoc, inImageObj, inPalette)
+ , mTenant(NULL)
+{
}
void T2DlgItemProfitsGage::CalcCost() {
+ mCost = mTenant->GetOutMoney();
}
/*virtual*/ int T2DlgItemProfitsGage::GetMinValue() {
+ int val = mCost * -1;
+ if (mCost == 0)
+ val = 0;
+ return val;
}
/*virtual*/ int T2DlgItemProfitsGage::GetMaxValue() {
+ int val;
+
+ if (mCost == 0)
+ val = 4;
+ else
+ val = (mCost * 230) / 70;
+
+ return val;
}
/*virtual*/ int T2DlgItemProfitsGage::GetValue() {
+ int val = GetMinValue();
+ if (mTenant)
+ val = mTenant->CalcInMoney();
+ return val;
}
/*virtual*/ int T2DlgItemProfitsGage::GetBlueValue() {
+ int val;
+
+ if (mCost == 0)
+ val = 2;
+ else
+ val = (mCost * 130) / 70;
+
+ return val;
}
/*virtual*/ int T2DlgItemProfitsGage::GetYellowValue() {
+ int val = 0;
+
+ if (mCost == 0)
+ val = 1;
+
+ return val;
}
-/*virtual*/ unsigned long T2DlgItemProfitsGage::GetGageColor(int) {
+/*virtual*/ DWORD T2DlgItemProfitsGage::GetGageColor(int inValue) {
+ return (inValue < GetYellowValue()) ? PALETTERGB(255, 0, 0) : (inValue < GetBlueValue()) ? PALETTERGB(255, 255, 0) : PALETTERGB(0, 0, 255);
}
-void T2DlgItemProfitsGage::SetTenant(T2Tenant*) {
+void T2DlgItemProfitsGage::SetTenant(T2Tenant* inTenant) {
+ mTenant = inTenant;
+ CalcCost();
}
-/*virtual*/ void T2DlgItemProfitsGage::DrawInterior(CDC*, const CRect&) {
+/*virtual*/ void T2DlgItemProfitsGage::DrawInterior(CDC* pDC, const CRect& inRect) {
+ T2DlgItemGageBase::DrawInterior(pDC, inRect);
+ DrawValueByText(pDC, inRect);
}
-/*virtual*/ int T2DlgItemProfitsGage::IsDrawInterior() {
+/*virtual*/ BOOL T2DlgItemProfitsGage::IsDrawInterior() {
+ return (mTenant != NULL);
}