summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2DlgItemStressGage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/T2DLL/T2DlgItemStressGage.cpp')
-rw-r--r--src/T2DLL/T2DlgItemStressGage.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/T2DLL/T2DlgItemStressGage.cpp b/src/T2DLL/T2DlgItemStressGage.cpp
index 098f8fb..f685e31 100644
--- a/src/T2DLL/T2DlgItemStressGage.cpp
+++ b/src/T2DLL/T2DlgItemStressGage.cpp
@@ -1,28 +1,43 @@
#include "T2DlgItemStressGage.h"
+#include "T2People.h"
+#include "T2PeopleDef.h"
-T2DlgItemStressGage::T2DlgItemStressGage(T2TowerDoc*, T2ImageObj*, CPalette*) {
+T2DlgItemStressGage::T2DlgItemStressGage(T2TowerDoc* towerDoc, T2ImageObj* imageObj, CPalette* palette)
+ : T2DlgItemGageBase(towerDoc, imageObj, palette)
+ , mPeople(NULL)
+{
}
/*virtual*/ int T2DlgItemStressGage::GetMinValue() {
+ return 0;
}
/*virtual*/ int T2DlgItemStressGage::GetMaxValue() {
+ return (mPeople && mPeople->GetMatterDef()) ? ((T2PeopleDef *) mPeople->GetMatterDef())->GetStressMax() : GetMinValue();
}
/*virtual*/ int T2DlgItemStressGage::GetValue() {
+ return mPeople ? mPeople->GetStress() : GetMinValue();
}
/*virtual*/ int T2DlgItemStressGage::GetBlueValue() {
+ return (mPeople && mPeople->GetMatterDef()) ? ((T2PeopleDef *) mPeople->GetMatterDef())->GetStressBlueLimit() : GetMinValue();
}
/*virtual*/ int T2DlgItemStressGage::GetYellowValue() {
+ return (mPeople && mPeople->GetMatterDef()) ? ((T2PeopleDef *) mPeople->GetMatterDef())->GetStressYellowLimit() : GetMinValue();
}
-void T2DlgItemStressGage::SetPeople(T2People*) {
+void T2DlgItemStressGage::SetPeople(T2People* people) {
+ mPeople = people;
}
-/*virtual*/ unsigned long T2DlgItemStressGage::GetGageColor(int) {
+/*virtual*/ COLORREF T2DlgItemStressGage::GetGageColor(int value) {
+ return (value <= GetBlueValue()) ? PALETTERGB(0, 0, 255) :
+ (value <= GetYellowValue()) ? PALETTERGB(255, 255, 0) :
+ PALETTERGB(255, 0, 0);
}
-/*virtual*/ int T2DlgItemStressGage::IsDrawInterior() {
+/*virtual*/ BOOL T2DlgItemStressGage::IsDrawInterior() {
+ return (mPeople != NULL);
}