Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

/prog/ - RPG

Name: Anonymous 2010-10-29 15:44

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;
}

Name: Anonymous 2010-10-31 15:17

>>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);.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List