summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2DlgItemPPLEvalGage.cpp
blob: 5be309e7921588cfed33477553f44b6e699892ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include "StdAfx.h"
#include "T2DlgItemPPLEvalGage.h"
#include "T2People.h"
#include "T2PeopleDef.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

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* people) {
    mPeople = people;
}

/*virtual*/ COLORREF T2DlgItemPPLEvalGage::GetGageColor(int value) {
    return (value <= GetBlueValue()) ? PALETTERGB(0, 0, 255) :
           (value <= GetYellowValue()) ? PALETTERGB(255, 255, 0) :
           PALETTERGB(255, 0, 0);
}

/*virtual*/ BOOL T2DlgItemPPLEvalGage::IsDrawInterior() {
    return (mPeople != NULL);
}