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
+2 -2
View File
@@ -507,9 +507,9 @@ HomeCell=2742
30=Neutral,ABAN02,256,5172,0,None,1,0
31=Neutral,ABAN02,256,5175,0,None,1,0
32=Neutral,ABAN02,256,5178,0,None,1,0
33=Greece,DOMF,256,6538,0,None,0,0
33=Greece,DOME,256,6538,0,None,0,0
34=Greece,HOSP,256,6154,0,None,0,0
35=Greece,FACT,256,6160,0,None,0,0
35=Greece,APWR,256,6160,0,None,0,0
36=Greece,PROC,256,6800,0,None,0,0
37=Greece,APWR,256,6548,0,None,0,0
38=Greece,APWR,256,6036,0,None,0,0
+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");
+2
View File
@@ -7,6 +7,7 @@ end
function map_start()
GiveSpecialWeapon(SpecialWeapons.Paratroops, Houses.USSR, 1)
ToggleFireSale(Houses.GREECE, 0) -- Disable fire sale for the AI, otherwise it sells the radar dome we're trying to capture :)
end
function map_frame()
@@ -19,6 +20,7 @@ function map_frame()
end
if numRadarDomes == 2 then
ToggleFireSale(Houses.GREECE, 1) -- Renable the fire sale for the AI
Win(Houses.USSR)
end