Oh yeah, here's the character purchase hook so you can have powerups in the character menu too.
int CharacterPurchase(BaseControllerClass *Base,GameObject *Purchaser,unsigned int Cost,unsigned int Preset,const char *Data) {
if (Base->Can_Generate_Soldiers() || !Cost) {
DefinitionClass *Def = Find_Definition(Preset);
if (Def->Get_Class_ID() == CID_Soldier) {
if (Purchase_Item(Purchaser,Cost)) {
Purchaser->As_SoldierGameObj()->Re_Init(*(SoldierGameObjDef*)Def);
Purchaser->As_SoldierGameObj()->Post_Re_Init();
return 0;
}
return 2;
}
else if (Def->Get_Class_ID() == CID_PowerUp) {
PowerUpGameObjDef *PowerUpDef = (PowerUpGameObjDef*)Def;
if (PowerUpDef->GrantWeapon && Has_Weapon(Purchaser,Get_Definition_Name(PowerUpDef->GrantWeaponID))) {
return 4;
}
else if (Purchase_Item(Purchaser,Cost)) {
PowerUpDef->Grant(Purchaser->As_SoldierGameObj());
return 0;
}
return 2;
}
}
return 3;
}