CanBuild CanResearch refactoring and time slowdown in upgrade menu

Removed some duplicate code.
The slowdown is now activated by setting the inBuildingMode or inUpgradeMenu through the setter function.
Fixed bug where you could still place buildings after swapping from the build to upgrade menu.