Commit 23f7cfc7 authored by Matthew Odle's avatar Matthew Odle

move status updates to function

parent 88a55727
......@@ -302,9 +302,7 @@ export class Village extends React.Component {
this.updateLog('a villager has ' + reason + ' to death');
let villagerStatus = this.state.villagerStatus;
villagerStatus.dead.count += 1;
this.setState({
villagerStatus: villagerStatus,
});
this.setVillagerStatus(villagerStatus);
}
bringOutYourDead = (villager) => {
......@@ -355,9 +353,7 @@ export class Village extends React.Component {
villager.energy <= warningValue && villager.assignment !== 'DEAD' ? (villagerStatus.starving.count += 1, this.setBadThingClass('starving')) : null;
villager.warmth <= warningValue && villager.assignment !== 'DEAD' ? (villagerStatus.freezing.count += 1, this.setBadThingClass('freezing')) : null;
});
this.setState({
villagerStatus: villagerStatus,
});
this.setVillagerStatus(villagerStatus);
}
checkGameEndConditions = () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment