Added the new tag [GlobalControls]DebugKeysEnabled= (boolean, defaults to yes). If it is set to no, the AI Base Plan, AI Control, Dump Types and Map Snapshot keyboard commands are disabled. If they are executed, the language string "TXT_COMMAND_DISABLED" is shown instead.

This tag can be used to prevent users from gaining an unfair advantage in multi-player games, from revealing vital secrets, and from deliberately causing a Reconnection Error in release versions of a mod.

TXT_COMMAND_DISABLED can include one "%s", which is replaced with the actual command name. In Ares, this string defaults to "The %s command is not available.".
Updated forEachObjectInRange() method.

It now returns negative values if the input is invalid. Otherwise it always returns the count of objects that successfully invoked the callback action.

These changes do not affect how the function behaves internally, and no caller uses the return value for anything yet, so this is actually just a minor service update.
Added documentation and better comments to the enumerator functions.

No code change.
Added forEachObjectInCellRange and changed the Psychic Dominator to use it.

forEachObjectInCellRange checks the cell distance to the center cell instead of each object's distance to the center. This means, if a cell is close enough, all objects on it will be affected, regardless of their sub-position on the cell.

This fixes a problem with the original Yuri's Revenge matches (including single player missions) featuring the Dominator, where it would not capture all units in a 3x3 area (only if defaulting to DominatorCaptureRange=). Instead, only the target cell and its four direct neighbors would be affected. The diagonal cells were too far away for a default radius of 1.

For instance, freeing Einstein gives you a one-shot PsyDom, which would not be able to capture all nine units waiting in Yuri's base. You would get only five units - three of them Gatling Tanks - which makes this mission harder. All missions where the PsyDom is used against you became easier, naturally.
Added documentation for the DistinctCollector.
Split forEachObjectInCellRange into two methods. Replaced the almost-cellspread-like distance calculation by a better version based on code by DCoder. It matches the first 10 cell spread areas, and only misses the last one because WW fucked up.

forEachCellInCellSpread invokes a callback on each cell in an area determined by the CellSpread logic. This does not use the CellSpread offset table, so it will work for values greater than 10.

forEachObjectInCellSpread uses the above method to get all cells in the area and then invokes a callback function on each object on that cell.
Update version display string to "RC1".
Related to issue 1022392: C4 infantry deselected when destroying building with rubble

Removing the DynamicVectorClasses changed the order in which infantry was checked whether it was selected and removed. Removing reset the selection state, thus it was always unselected when that value was cached. Infantry C$ing a building that had rubble set always came out unselected.
Removed pointless semicolons.
Minor change: Removed some revealing macros which didn't help at all.
REORG! the debug files:
when a crash occurs, the directory debug/snapshot-%timestamp will be created, except.txt and extcrashdump.dmp will be created there, and debug.log (if enabled) will be copied there. Reporting errors should be easier, all users need to do is zip up that folder and post it.
merged in Alex's changes
Related to issue 1024707: Multi-Engineer related Reconnection Error.

MultiEngineer is always considered enabled, except for skirmish games. This prevents the setting from causing REs if one player played a skirmish game with ME enabled and one player didn't enable ME. In skirmish it's still possible to disable MultiEngineer if the checkbox in the skirmish menu is allowed to be shown.

Minor change: comment edited.
Related to issue 1024127: Multi-Engineer won't work in campaigns.

Skipped the check for the game mode. This makes ME work in single-player missions. Also changed the way tech structures are detected. They have to belong to Neutral or Special initially. It is not sufficient any more to give them to a MultiplayerPassive house, because missions might define their own houses.
Related to issue 1025156: Player drop down colors affects in-game messages

As long as there is no dedicated tag to change it (which won't happen in 0.2) the message color for map action 11 messages is hard coded to the original [Color] items. Customizable drop down colors affected the colors, which is an unintentional change, in other words, a bug.

Message colors are hard coded to color 10 for side 1, color 5 for side 2 and color 12 for every other side, just like in the original YR without the customizable drop down colors.
Related to issue 1025226: PoweredBy + ground unit in air = problems

Code reuse. Destroying units isn't done manually any more. The original version was copied from EMP's aircraft handling. It has been replaced by a method call that supports any techno type.
Related to issue 1025226: PoweredBy weirdity

EMP_Threshold was used in a weird way. Comment said it's checking for the "inair" value, but it checked for all negative values. "inair" is equivalent to -1. Negative EMP threshold destroys a unit only if it is in air. Positive threshold will destroy the unit regardless of its height above ground. Thus, positive threshold will also destroy units in air, so it should be checked also.

Note: EMP was changed not to use InAir() because units taking off and landing would be misinterpreted. Instead, it currently checks for GetHeight() > 0. I won't reproduce this there, because I can't rule out that this would break something.
Related to issue 1002020: Stale Mind-Control pointers

The problem is this: If a mind-controlled unit is destroyed, the mind-controller gets notified and removes the victim from its internal list the hard way - the pointer is considered invalid and won't be accessed. Thus the back-linking field isn't reset.

The dead victim keeps its valid link to the controller and plays its death anim, keeps sinking or crashing.

If the mind-controller is killed now and finishes its death anim earlier than the victim, it is uninitialized and freed earlier than the victim also. At this point, the link from the victim to the controller becomes invalid. The crash happens the moment the game checks whether the mind control link should be drawn.

If the controller dies before the victim, the mind control link is removed by the real unlink function which also checks and updates the victim properly.

The applied solution removes the pointer from the victim to the mind-controller before AnnounceInvalidPointer is called.
Disabled the menu buttons related to savegames for the time being.
Related to issue 896125: Crash if SpyEffect.StolenTechIndex >= 32

If SpyEffect.StolenTechIndex is >= 32, the value is set to -1 (disabling the effect) and a warning is put in the log file. Without this check, spying this building will cause a crash.