if (chance > rand()/RAND_MAX) { if (type == "bat") { MakeBat() } else if (type == "health") { MakeHealth() } }
MakeBat() { pos = params.find(';'); healthString = params.substr(0,pos); bat.health = atoi(healtString) damageString = params.substr(pos+1); bas.damage = atoi(damageString); }