本文整理汇总了C++中CSystem::SetWorker方法的典型用法代码示例。如果您正苦于以下问题:C++ CSystem::SetWorker方法的具体用法?C++ CSystem::SetWorker怎么用?C++ CSystem::SetWorker使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSystem
的用法示例。
在下文中一共展示了CSystem::SetWorker方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FillRemainingSlots
//fills all remaining empty buildings of the given cathegory, only considering available workers and buildings
bool FillRemainingSlots(WORKER::Typ type)
{
AssertBotE(m_WorkersLeftToSet >= 0);
if(m_WorkersLeftToSet == 0)
return false;
m_WorkersLeftToSet += m_pSystem->GetWorker(type);
m_pSystem->SetWorker(type, CSystem::SET_WORKER_MODE_SET, 0);
const int buildings = m_pSystem->GetNumberOfWorkbuildings(type, 0);
const int to_set = min(buildings, m_WorkersLeftToSet);
SetWorker(type, CSystem::SET_WORKER_MODE_SET,to_set);
return true;
}
示例2: SetWorker
//worker setting function which makes according changes to m_WorkersLeftToSet, tracking how many
//we still have to distribute at all
void SetWorker(WORKER::Typ type, CSystem::SetWorkerMode mode, int value = -1)
{
if(mode == CSystem::SET_WORKER_MODE_INCREMENT)
{
AssertBotE(value == -1);
m_pSystem->SetWorker(type, mode);
--m_WorkersLeftToSet;
}
else if(mode == CSystem::SET_WORKER_MODE_DECREMENT)
{
AssertBotE(value == -1);
m_pSystem->SetWorker(type, mode);
++m_WorkersLeftToSet;
}
else if(mode == CSystem::SET_WORKER_MODE_SET)
{
AssertBotE(value >= 0);
m_pSystem->SetWorker(type, mode, value);
m_WorkersLeftToSet -= value;
}
AssertBotE(m_WorkersLeftToSet >= 0);
}