Lets program a roleplaying game together. Each post must contain either a new function or an edited version of an old function in psudocode. I will start:
int dealDamage(int hp, int damage){
return hp - damage;
}
>>85
Wrong, wrong, wrong. All of it wrong. You've been poisoned by Bjarne. #ifndef WEAPON_H
#define WEAPON_H
enum { NONE, MELEE, RANGED, SPECIAL } weapon_type;
#define DEFAULT_AMMO -2
#define DEFAULT_DAMAGE 0x80000000
/* etc */
struct {
int id;
enum weapon_type type;
int ammo, damage;
} weapon;
#endif
and then set defaults in struct weapon *weapon_new (void);.