Fix crash when pushing button on top or bottom map borders (fixes: #64)

Also, use constant and enumeration names instead of hardcoded values.