CleverRaven/Cataclysm-DDA — pull request #4972 by felliott (2013-12-09 16:48:40+00:00)
Title: Fixes for building on  OS X + 1 misc fix

Hello,

This patch series fixes several build issues with CDDA on OS X 10.6, and one all-platforms bug.

The first patch fixes some "variable may be used uninitialized" warnings that were causing the build to fail. None of them seemed to actually be triggerable, but I initialized them just to be safe. (edit: I just rebuilt master and it seems the maybe uninitialized warning has been taken out. The patch still applies, but feel free to discard it as unnecessary.)

The second patch fixes a segfault that occurs when building with LOCALIZE=0. The segfault occurs when assigning to sanitized_messages[msgid] in translations.cpp. The problem seemed to be the static initialization order fiasco problem as described here: http://www.parashift.com/c++-faq-lite/static-init-order.html so I implemented the fix as described here: http://www.parashift.com/c++-faq-lite/static-init-order-on-first-use.html

The third patch is not a serious bug, but a minor annoyance. The Makefile uses 'uname -o' to detect the operating system, but -o is not a supported switch on Darwin. I've changed it to use -s instead. -s is supported on all platforms (according to: http://en.wikipedia.org/wiki/Uname). I've updated the one place where $(OS) was being used and deleted some code that uses it that has been commented out since January. I've also fixed another uname invocation to use -s. There's one uname -o that remains that affects Cygwin. I've left it alone for now, since I don't have a way to test it.

The last patch is an all-platforms fix. If a character with sufficiently high perception and intelligence does a Size Up on an NPC, their ability could be more than 100, making str_range equal 0, and causing a divide by zero error in the str_min calculation. My fix is to cap ability at 100.

I haven't programmed any C++ in 14 years, so please double check my code to make sure I'm not doing anything stupid. If you'd like me to rebase, reformat, redocument, or rewrite my patches, I'm happy to. Just let me know what I need to do. Thank you for your time and effort on this great game!

Cheers,
Fitz