With that; we can suggest improvements for you.
I'd do it like this:
int Team = Get_Team(ID);
GameObject *Building = 0;
if(Text[1] == "pp")
{
if(!ini->Get_Bool("Settings", "Allow_Revive_Power_Plants", 0))
{
//not allowed
return;
}
Building = Find_Power_Plant(Team));
}
else if(...)
{
}
else
{
//invalid selection
return;
}
if(!Building || !Commands->Get_ID(Building))
{
//error
return;
}
float Cost = /*Get cost */;
if(!Purchase_Item(Get_GameObj(ID), Cost))
{
//not enough money
return
}
Attach_Script_Once(Building, "RR
Commands->Attach_Script(bar, "RR_ReviveBuilding", "");
char msg[256];
sprintf(msg, "msg %S has revived the %s", Get_Wide_Player_Name_By_ID(ID), Translate_Preset(Building));
Console_Input(msg);
[Updated on: Fri, 26 September 2008 07:00]
Report message to a moderator