Cleanup g_utils.c and add sanity checks
Cleanup g_weapon.c and add sanity checks