CleverRaven/Cataclysm-DDA — pull request #8778 by BevapDin (2014-09-01 19:27:38+00:00)
Title: Debug message related fixes

Related to http://smf.cataclysmdda.com/index.php?topic=7630.0

The variable is named `debugmon`, the message in `npcmove.cpp` says it is "debug mode", the name of the action to toggle it is "Toggle debug messages". The ident of the action is "debug_mode", the enum value of that action is `ACTION_TOGGLE_DEBUGMON`. *What* is it?

- Renamed `game::debugmon` to debug_mode and moved it to debug.h/debug.cpp.
- Renamed the action to "Toggle debug mode".
- Renamed `ACTION_TOGGLE_DEBUGMON` to `ACTION_TOGGLE_DEBUG_MODE`.

Mode seems to fit best, it is used in the vehicle window to show the actual amount of fuel instead of the relative amount in percent.

Also added the message type `m_debug`. Messages of that type are only stored in the message log when `debug_mode` is on.

Instead of writing `if(debug_mode) { add_msg(...); }` one can now write `add_msg(m_debug, ...)`, this has been changed in the code where possible.

It also converts some calls to `debugmsg` to `add_msg` (notably in npc related code). Using `debugmsg` there is unfortunate as it interrupts the player, they have to press spacebar to continue. `add_msg` only adds a message into the message log, still annoying but it does not interrupt the player that much.

----

This fixes the issue here http://smf.cataclysmdda.com/index.php?topic=7546
When the program starts and the old log file is big enough (> 1 MiB), the old log file is moved to another location (simply the original log file path + ".prev"). This prevents the log file from getting bigger and bigger forever, while it still keeps the previous log available.

----

Fixes a crash from items exploding in fire (some npc caused this situation during testing). The iterator would be invalidated when the explosion destroys items on the same square as the exploding item. Easily experienced with dynamite and some glass items (in that order) on a square with fire.