IDK what your 'Restore_Building' does but this is what it'd need to rebuild buildings (on 3.4.4 that is).
GameObject *o = As_BuildingGameObj(obj); //obj is your input GameObject
if (!o)
{
return;
}
char *c = (char *)o;
c += 0x778;
bool *x = (bool *)c;
*x = false;
BaseControllerClass *b = BaseControllerClass::Find_Base(Get_Object_Type(o));
if (b && !Is_Building_Dead(o)) //Just to be sure it's revived
{
if (Is_SoldierFactory(o))
{
b->CanGenerateSoldiers = true;
}
else if (Is_WarFactory(o) || Is_Airstrip(o))
{
b->CanGenerateVehicles = true;
}
else if(Is_PowerPlant(o))
{
b->IsPowered = true; //Ofcource you can have some feedback messages around this code (ie "Nod base power restored")
}
Set_Object_Dirty_Bit_All(b, DB_RARE, true);
float max = Commands->Get_Max_Health(o);
Commands->Set_Health(o, max);
}
[Updated on: Mon, 19 September 2011 09:39]
Report message to a moderator