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/T2DlgItemPPLEvalGage.cpp | |
parent | 37e364b2c6cc7487a1c888d256a73e5337bb7189 (diff) | |
download | t2win-c0c336500955a23e344651e5412c9d9d441ef4ee.tar.gz t2win-c0c336500955a23e344651e5412c9d9d441ef4ee.zip |
first pass of T2DLL
Diffstat (limited to '')
-rw-r--r-- | src/T2DLL/T2DlgItemPPLEvalGage.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/T2DLL/T2DlgItemPPLEvalGage.cpp b/src/T2DLL/T2DlgItemPPLEvalGage.cpp index 27e821b..164a3ab 100644 --- a/src/T2DLL/T2DlgItemPPLEvalGage.cpp +++ b/src/T2DLL/T2DlgItemPPLEvalGage.cpp @@ -1,28 +1,43 @@ #include "T2DlgItemPPLEvalGage.h" +#include "T2People.h" +#include "T2PeopleDef.h" -T2DlgItemPPLEvalGage::T2DlgItemPPLEvalGage(T2TowerDoc*, T2ImageObj*, CPalette*) { +T2DlgItemPPLEvalGage::T2DlgItemPPLEvalGage(T2TowerDoc* towerDoc, T2ImageObj* imageObj, CPalette* palette) + : T2DlgItemGageBase(towerDoc, imageObj, palette) + , mPeople(NULL) +{ } /*virtual*/ int T2DlgItemPPLEvalGage::GetMinValue() { + return 0; } /*virtual*/ int T2DlgItemPPLEvalGage::GetMaxValue() { + return (mPeople && mPeople->GetMatterDef()) ? ((T2PeopleDef *) mPeople->GetMatterDef())->GetStressMax() : GetMinValue(); } /*virtual*/ int T2DlgItemPPLEvalGage::GetValue() { + return mPeople ? mPeople->GetAverageStress() : GetMinValue(); } /*virtual*/ int T2DlgItemPPLEvalGage::GetBlueValue() { + return (mPeople && mPeople->GetMatterDef()) ? ((T2PeopleDef *) mPeople->GetMatterDef())->GetStressBlueLimit() : GetMinValue(); } /*virtual*/ int T2DlgItemPPLEvalGage::GetYellowValue() { + return (mPeople && mPeople->GetMatterDef()) ? ((T2PeopleDef *) mPeople->GetMatterDef())->GetStressYellowLimit() : GetMinValue(); } -void T2DlgItemPPLEvalGage::SetPeople(T2People*) { +void T2DlgItemPPLEvalGage::SetPeople(T2People* people) { + mPeople = people; } -/*virtual*/ unsigned long T2DlgItemPPLEvalGage::GetGageColor(int) { +/*virtual*/ COLORREF T2DlgItemPPLEvalGage::GetGageColor(int value) { + return (value <= GetBlueValue()) ? PALETTERGB(0, 0, 255) : + (value <= GetYellowValue()) ? PALETTERGB(255, 255, 0) : + PALETTERGB(255, 0, 0); } -/*virtual*/ int T2DlgItemPPLEvalGage::IsDrawInterior() { +/*virtual*/ BOOL T2DlgItemPPLEvalGage::IsDrawInterior() { + return (mPeople != NULL); } |