MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / notifyWorkerStopsAction

Method notifyWorkerStopsAction

source/game/Player.cpp:802–820  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

800}
801
802void Player::notifyWorkerStopsAction(Creature& worker, CreatureActionType actionType)
803{
804 uint32_t index = static_cast<uint32_t>(actionType);
805 if(index >= mWorkersActions.size())
806 {
807 OD_LOG_ERR("Invalid index seatId=" + Helper::toString(getId()) + ", value=" + Helper::toString(index) + ", size=" + Helper::toString(mWorkersActions.size()));
808 return;
809 }
810
811 // Sanity check
812 if(mWorkersActions[index] <= 0)
813 {
814 OD_LOG_ERR("No worker doing action seatId=" + Helper::toString(getId()) + ", action=" + CreatureAction::toString(actionType));
815 return;
816 }
817
818
819 mWorkersActions[index]--;
820}
821
822uint32_t Player::getNbWorkersDoing(CreatureActionType actionType) const
823{

Calls 1

toStringFunction · 0.70

Tested by

no test coverage detected