Added set of functions that perform integer division with different
rounding modes:
- divideAndCeil - rounds up to next integer
- divideAndRound - rounds to nearest integer
- divideAndFloor - rounds to previous integer (equivalent to default
division)
Intended for use in library, where usage of floating point might lead to
desync in multiplayer games.
Replaced some cases that I knew of, including recent handicap PR
Attempt to get a bit more debug info from crashes. VCMI will now:
- use c++ terminate handler on any platform in release builds
- attempt to write call stack to log file using boost::callstack
Since I use std::set_terminate this will only affect c++ exceptions, e.g.
std::runtime_error and will not affect OS signals, e.g. SIGSEGV. Handling
signals is OS-specific and has a lot of limitations that I don't want to
investigate. Besides - most of our crashes are now caused by c++
exceptions.
Haven't tested on other platforms, but should at the very least write
exception information (`e.what()`) for all exceptions and function names
for methods exported from dll's (libvcmi.so & AI's). Possibly more, if
debug information is present.
Mixed line endings cause problems when exporting patches with
git-format-patch and then trying to "git am" a patch with mixed and
non-matching line endings. In such a situation git will fail to apply
the patch.
This commit runs the dos2unix tools on the remaining files with CRLF
(\r\n) line endings to convert them to line-feeds (\n) only.
Files that are Windows specific like *.vcxproj and *.props files were
not converted.
Closes: #3073
- use std::fstream instead of boost::iostreams for properly working flush
- removed some catch-all blocks
- reduce catch scope of some try/catch blocks to clearly indicate intent
- Added EShortcut enumeration that contains all in-game shortcuts
- CIntObject::keyPressed now receive values from hotkey enumeration
- On keypress, SDL key code will be translated to shortcut ID
- Removed access to SDL key codes from most of engine