hello guys. Can anyone explain me why this coad is incorrect? it works correctly, but one of my friends told me that's very bad! please, look at it and tell me where did i wrong. Thanks for your patience.
inv@[] invs;
class inv
{
int type,invamount;
string name;
inv(string invn,int invt,int inva) {
name=invn; type=invt; invamount=inva;
} }
void spawninv(string iname,int itype,int iamount) {
inv i1(iname,itype,iamount); invs.insert_last(i1);
}
void invloop() { if(key_pressed(KEY_RETURN)) { if(invs[poss].type==1) { if(invs[poss].invamount>0) { invs[poss].invamount--; energy+=200; p.play_stationary("usepotion.ogg",false); } } }
if(invs[poss].invamount<1) { invs[poss].invamount=0; invs.remove_at(poss); }
}
best regards