FireSale can be toggled via lua script, the AI in soviet 1 won't do a fire sale, and the allied radar dome is no longer a fake dome.

This commit is contained in:
Justin Marshall
2020-07-20 12:15:27 -07:00
parent 9fcc2d286d
commit a21baa6891
5 changed files with 33 additions and 2 deletions
+6
View File
@@ -525,6 +525,7 @@ HouseClass::HouseClass(HousesType house) :
RepairDelay(0),
BuildDelay(0),
ActLike(Class->House),
fireSaleAvailable(false),
IsHuman(false),
WasHuman(false),
IsPlayerControl(false),
@@ -7513,6 +7514,11 @@ bool HouseClass::Is_Hack_Prevented(RTTIType rtti, int value) const
*=============================================================================================*/
bool HouseClass::Fire_Sale(void)
{
// Toggle the fire sale ability.
if(!fireSaleAvailable) {
return false;
}
if (CurBuildings > 0) {
for (int index = 0; index < Buildings.Count(); index++) {
BuildingClass * b = Buildings.Ptr(index);
+3
View File
@@ -688,6 +688,7 @@ class HouseClass {
// Added so the ally flags could be sent to client machines - 09 / 12 / 2019 JAS
unsigned Get_Ally_Flags();
void ToggleFireSaleAbility(bool fireSaleEnabled) { this->fireSaleAvailable = fireSaleEnabled; }
bool Fire_Sale(void);
bool Is_Hack_Prevented(RTTIType rtti, int value) const;
bool Is_No_YakMig(void) const;
@@ -851,6 +852,8 @@ class HouseClass {
int AI_Infantry(void);
int AI_Aircraft(void);
bool fireSaleAvailable;
/*
** This is a bit field record of all the other houses that are allies with
** this house. It is presumed that any house that isn't an ally, is therefore
+20
View File
@@ -5,6 +5,24 @@
* Red Alert Vanilla Actions *
*=============================================================================================*/
static int Script_ToggleFireSale(lua_State* L) {
int houseType = lua_tointeger(L, 1);
int fireSaleEnabled = lua_tointeger(L, 2);
if (houseType != HOUSE_NONE) {
HouseClass* this_house = HouseClass::As_Pointer((HousesType)houseType);
if (this_house != NULL) {
this_house->ToggleFireSaleAbility(fireSaleEnabled != 0);
}
}
return 1;
}
/***********************************************************************************************
* Script_Win - The specified player wins *
* *
@@ -7620,6 +7638,8 @@ bool MapScript::Init(const char* mapName) {
* Script Globals *
*=============================================================================================*/
lua_register(L, "ToggleFireSale", Script_ToggleFireSale);
lua_pushnumber(L, PlayerPtr->ID); // Local player (house) index
lua_setglobal(L, "_localPlayer");