bool CCameraHandler::SetState(const CCameraController::StateMap& sm) { CCameraController::StateMap::const_iterator it = sm.find("mode"); if (it != sm.end()) { const unsigned int camMode = (unsigned int)it->second; if (camMode >= camControllers.size()) { return false; } if (camMode != currCamCtrlNum) { currCamCtrlNum = camMode; currCamCtrl = camControllers[camMode]; currCamCtrl->SwitchTo(); } } return currCamCtrl->SetState(sm); }
bool CCameraHandler::SetState(const CCameraController::StateMap& sm) { const auto it = sm.find("mode"); if (it != sm.end()) { const unsigned int camMode = it->second; const unsigned int oldMode = currCamCtrlNum; if (camMode >= camControllers.size()) return false; if (camMode != currCamCtrlNum) { camControllers[currCamCtrlNum = camMode]->SwitchTo(oldMode); } } const bool result = camControllers[currCamCtrlNum]->SetState(sm); camControllers[currCamCtrlNum]->Update(); return result; }