CleverRaven/Cataclysm-DDA — pull request #8332 by BevapDin (2014-07-25 16:51:30+00:00)
Title: Merge game::kill_mon into monster::die

The game has several pieces of code in this form:
```
if (g->zombie(index).hurt(tmp_item.weight() / 225)) {
g->kill_mon(index, true);
}
```

`monster::hurt` returns true when the monster has been killed by the hurting. This is redundant.

Also: only `game::kill_mon` drops the items in the inventory of the monster. This is not done in `game::cleanup_dead` nor in `monster::die`.

`monster::die` is called *only* from `game::cleanup_dead` and `game::throw_item` (there it's actually called twice - `monster::is_dead_state` returns `hp<=0`, practically the same check that is done in `monster::hurt` to return true). But that version of `monster::die` (the one with the source creature as parameter) simply calls `game::kill_mon`, which checks that the monster is not already dead and sets `monster::dead` to true.

I removed both `game::kill_mon` functions and changed the return type of `monster::hurt` to void. That function also has a point to the source creature now. It calls `monster::die` when the damage was big enough to kill the monster. That allows to omit the if clause above and simply write `g->zombie(...).hurt(...)` - most of the code did not even check the return value anyway.

The value `monster::dead` should probably not be saved at all. In fact dead monster should not be saved, they should not appear in the monster list when saving at all.

That member is now private and is only set to true in `monster::die`, that function now contains *all* the death-related code (increasing kill count, morale penalty, dropping inventory, ...). By checking the value of `monster::dead` it makes sure that each monster dies only once.

I combined `is_dead_state()` and `monster::dead` into one function: `is_dead`. `is_dead_state` should probably be removed and the creature should take care of calling `die()` on their own.

And I extracted the logic to get the item type of the monsters "body part" (what you get when butchering them or when they explode) into a separate function as it is used by butchering code and by explode monster code.