diff options
author | Ash Wolf <ninji@wuffs.org> | 2023-06-28 22:22:32 +0100 |
---|---|---|
committer | Ash Wolf <ninji@wuffs.org> | 2023-06-28 22:22:32 +0100 |
commit | c0c336500955a23e344651e5412c9d9d441ef4ee (patch) | |
tree | 790769c748db307cf3314f6e896e2f61c68561a2 /src/T2DLL/T2DlgItemProfitsGage.cpp | |
parent | 37e364b2c6cc7487a1c888d256a73e5337bb7189 (diff) | |
download | t2win-c0c336500955a23e344651e5412c9d9d441ef4ee.tar.gz t2win-c0c336500955a23e344651e5412c9d9d441ef4ee.zip |
first pass of T2DLL
Diffstat (limited to '')
-rw-r--r-- | src/T2DLL/T2DlgItemProfitsGage.cpp | 51 |
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); } |