途中でreturnしたっていいじゃない、人間だもの
bool Person::action() { if (isStand()) { fsm_.change(&standState_); return true; } if (isMove()) { fsm_.change(&moveState_); return true; } return false; }
これを、
bool Person::action() { bool result = false; if (isStand()) { fsm_.change(&standState_); result = true; } else if (isMove()) { fsm_.change(&moveState_); result = true; } return result; }
と直してもよくなってないような感じがして、
では、
bool Person::action() { bool result = false; if (checkStandStart()) { result = true; } else if (checkMoveStart()) { result = true; } return result; }
なんてことになったらキモイ。