summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2PeopleDemandList.cpp
diff options
context:
space:
mode:
authorAsh Wolf <ninji@wuffs.org>2023-07-01 02:43:29 +0100
committerAsh Wolf <ninji@wuffs.org>2023-07-01 02:43:29 +0100
commit5c6a48b2ff362a70416a6a00fda7d06e0f276f2d (patch)
tree62cf542c68d91aa6f7a4e3bfa9eddca4ab352970 /src/T2DLL/T2PeopleDemandList.cpp
parentc0c336500955a23e344651e5412c9d9d441ef4ee (diff)
downloadt2win-5c6a48b2ff362a70416a6a00fda7d06e0f276f2d.tar.gz
t2win-5c6a48b2ff362a70416a6a00fda7d06e0f276f2d.zip
i am in hell
Diffstat (limited to '')
-rw-r--r--src/T2DLL/T2PeopleDemandList.cpp54
1 files changed, 27 insertions, 27 deletions
diff --git a/src/T2DLL/T2PeopleDemandList.cpp b/src/T2DLL/T2PeopleDemandList.cpp
index e8def3b..e9fdcdd 100644
--- a/src/T2DLL/T2PeopleDemandList.cpp
+++ b/src/T2DLL/T2PeopleDemandList.cpp
@@ -11,11 +11,11 @@ T2PeopleDemandList::T2PeopleDemandList(T2PoolDef* inPoolDef, T2SeasonParamDef* i
: LArray(sizeof(T2PeopleTimeZoneList *))
, mSeasonParamDef(inSeasonParamDef)
{
- int count = inPoolDef->GetNumOfDemand();
- for (int i = 0; i < count; i++) {
- DemandInfo *theDemandInfo = inPoolDef->GetDemandInfo(i);
- T2PeopleTimeZoneList *theTimeZoneList = new T2PeopleTimeZoneList(theDemandInfo->b, theDemandInfo->a, inWorldDef);
- Add(theTimeZoneList);
+ int numDemand = inPoolDef->GetNumOfDemand();
+ for (int i = 0; i < numDemand; i++) {
+ DemandInfo *theDemand = inPoolDef->GetDemandInfo(i);
+ T2PeopleTimeZoneList *list = new T2PeopleTimeZoneList(theDemand->b, theDemand->a, inWorldDef);
+ Add(list);
}
}
@@ -45,43 +45,43 @@ void T2PeopleDemandList::Add(T2PeopleTimeZoneList* inTimeZoneList) {
}
void T2PeopleDemandList::Add(T2PoolGradeDef* inGradeDef) {
+ T2PeopleTimeZoneList *theTimeZoneList;
LArrayIterator iterator(*this);
- int demandType = 0;
+ int theDemandType = 0;
T2PeopleType peopleType;
- T2PeopleTimeZoneList *theTimeZoneList;
while (iterator.Next(&theTimeZoneList)) {
- peopleType.SetDemandType(demandType);
+ peopleType.SetDemandType(theDemandType);
- T2PoolDefDemandElem *theDemandElem = inGradeDef->GetDemandElem(demandType);
+ T2PoolDefDemandElem *theDemandElem = inGradeDef->GetDemandElem(theDemandType);
theTimeZoneList->Add(&peopleType, theDemandElem);
- demandType++;
+ theDemandType++;
}
}
void T2PeopleDemandList::Init(unsigned int inMonth, unsigned int inSomeNum) {
- float rate = 0.0f;
+ float theRate = 0.0f;
if (mSeasonParamDef)
- rate = mSeasonParamDef->GetRate(inMonth - 1);
+ theRate = mSeasonParamDef->GetRate(inMonth - 1);
LArrayIterator iterator(*this);
T2PeopleTimeZoneList *theTimeZoneList;
while (iterator.Next(&theTimeZoneList))
- theTimeZoneList->Init(inSomeNum, rate);
+ theTimeZoneList->Init(inSomeNum, theRate);
}
void T2PeopleDemandList::IncHour(unsigned int inMonth) {
- float rate = 0.0f;
+ float theRate = 1.0f;
if (mSeasonParamDef)
- rate = mSeasonParamDef->GetRate(inMonth - 1);
+ theRate = mSeasonParamDef->GetRate(inMonth - 1);
LArrayIterator iterator(*this);
T2PeopleTimeZoneList *theTimeZoneList;
while (iterator.Next(&theTimeZoneList))
- theTimeZoneList->IncHour(rate);
+ theTimeZoneList->IncHour(theRate);
}
T2PeopleTimeZoneList* T2PeopleDemandList::GetItem(int inDemandType) const {
@@ -93,35 +93,35 @@ T2PeopleTimeZoneList* T2PeopleDemandList::GetItem(int inDemandType) const {
}
BOOL T2PeopleDemandList::Find(T2TenantMemberDef* inTenantMemberDef, int inEconoType, unsigned int inTransportType, BOOL inCheckOnlyFirstEconoType) const {
- BOOL result = false;
+ BOOL found = false;
T2PeopleTimeZoneList *theList = GetItem(inTenantMemberDef->GetDemandType());
if (theList)
- result = theList->Find(inTenantMemberDef, inEconoType, inTransportType, inCheckOnlyFirstEconoType);
+ found = theList->Find(inTenantMemberDef, inEconoType, inTransportType, inCheckOnlyFirstEconoType);
- return result;
+ return found;
}
BOOL T2PeopleDemandList::Call(T2TenantMemberDef* inTenantMemberDef, int inEconoType, unsigned int inTransportType, T2PeopleType& outPeopleType) const {
- BOOL result = false;
- int demandType = inTenantMemberDef->GetDemandType();
+ BOOL found = false;
+ int theDemandType = inTenantMemberDef->GetDemandType();
- if (demandType != -1) {
- T2PeopleTimeZoneList *theList = GetItem(demandType);
+ if (theDemandType != -1) {
+ T2PeopleTimeZoneList *theList = GetItem(theDemandType);
if (theList)
- result = theList->Call(inTenantMemberDef, inEconoType, inTransportType, outPeopleType);
+ found = theList->Call(inTenantMemberDef, inEconoType, inTransportType, outPeopleType);
} else {
- for (int i = UT2Utils::Randomize(mItemCount) + 1, j = 0; !result && j < mItemCount; j++, i++) {
+ for (int i = UT2Utils::Randomize(mItemCount) + 1, j = 0; !found && j < mItemCount; j++, i++) {
if (i > mItemCount)
i = 1;
T2PeopleTimeZoneList *theList = GetItem(i);
if (theList && !theList->IsFixed())
- result = theList->Call(inTenantMemberDef, inEconoType, inTransportType, outPeopleType);
+ found = theList->Call(inTenantMemberDef, inEconoType, inTransportType, outPeopleType);
}
}
- return result;
+ return found;
}
void T2PeopleDemandList::DispatchRestore(T2PeopleType& peopleType) {