Merge branch '1dot13:master' into Backgrounds

This commit is contained in:
Kitty
2024-03-18 12:58:32 +01:00
committed by GitHub
3 changed files with 31 additions and 38 deletions
+21 -36
View File
@@ -13603,58 +13603,43 @@ static int l_GetNumHostilesInSector( lua_State *L )
void LuaGetIntelAndQuestMapData( INT32 aLevel ) void LuaGetIntelAndQuestMapData( INT32 aLevel )
{ {
static LuaScopeState _LS(true); const char* filename = "scripts\\strategicmap.lua";
static bool isInitialized = false;
// Initialize only once during lifetime of program LuaScopeState _LS( true );
if (!isInitialized)
{ IniFunction( _LS.L(), TRUE );
isInitialized = true; IniGlobalGameSetting( _LS.L() );
IniFunction(_LS.L(), TRUE);
IniGlobalGameSetting(_LS.L()); SGP_THROW_IFFALSE( _LS.L.EvalFile( filename ), _BS( "Cannot open file: " ) << filename << _BS::cget );
const char* filename = "scripts\\strategicmap.lua";
SGP_THROW_IFFALSE(_LS.L.EvalFile(filename), _BS("Cannot open file: ") << filename << _BS::cget);
}
IniGlobalGameSetting(_LS.L());
LuaFunction( _LS.L, "GetIntelAndQuestMapData" ).Param<int>( aLevel ).Call( 1 ); LuaFunction( _LS.L, "GetIntelAndQuestMapData" ).Param<int>( aLevel ).Call( 1 );
} }
void SetFactoryLeftoverProgress( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT16 usFacilityType, UINT16 usProductionNumber, INT32 sProgressLeft ) void SetFactoryLeftoverProgress( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT16 usFacilityType, UINT16 usProductionNumber, INT32 sProgressLeft )
{ {
static LuaScopeState _LS(true); const char* filename = "scripts\\strategicmap.lua";
static bool isInitialized = false;
// Initialize only once during lifetime of program LuaScopeState _LS( true );
if (!isInitialized)
{ IniFunction( _LS.L(), TRUE );
isInitialized = true; IniGlobalGameSetting( _LS.L() );
IniFunction(_LS.L(), TRUE);
IniGlobalGameSetting(_LS.L()); SGP_THROW_IFFALSE( _LS.L.EvalFile( filename ), _BS( "Cannot open file: " ) << filename << _BS::cget );
const char* filename = "scripts\\strategicmap.lua";
SGP_THROW_IFFALSE(_LS.L.EvalFile(filename), _BS("Cannot open file: ") << filename << _BS::cget);
}
IniGlobalGameSetting(_LS.L());
LuaFunction( _LS.L, "SetFactoryLeftoverProgress" ).Param<int>( sSectorX ).Param<int>( sSectorY ).Param<int>( bSectorZ ).Param<int>( usFacilityType ).Param<int>( usProductionNumber ).Param<int>( sProgressLeft ).Call( 6 ); LuaFunction( _LS.L, "SetFactoryLeftoverProgress" ).Param<int>( sSectorX ).Param<int>( sSectorY ).Param<int>( bSectorZ ).Param<int>( usFacilityType ).Param<int>( usProductionNumber ).Param<int>( sProgressLeft ).Call( 6 );
} }
INT32 GetFactoryLeftoverProgress( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT16 usFacilityType, UINT16 usProductionNumber ) INT32 GetFactoryLeftoverProgress( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT16 usFacilityType, UINT16 usProductionNumber )
{ {
static LuaScopeState _LS( true ); const char* filename = "scripts\\strategicmap.lua";
static bool isInitialized = false;
// Initialize only once during lifetime of program LuaScopeState _LS( true );
if (!isInitialized)
{ IniFunction( _LS.L(), TRUE );
isInitialized = true; IniGlobalGameSetting( _LS.L() );
IniFunction( _LS.L(), TRUE );
IniGlobalGameSetting(_LS.L()); SGP_THROW_IFFALSE( _LS.L.EvalFile( filename ), _BS( "Cannot open file: " ) << filename << _BS::cget );
const char* filename = "scripts\\strategicmap.lua";
SGP_THROW_IFFALSE( _LS.L.EvalFile( filename ), _BS( "Cannot open file: " ) << filename << _BS::cget );
}
IniGlobalGameSetting(_LS.L());
LuaFunction( _LS.L, "GetFactoryLeftoverProgress" ).Param<int>( sSectorX ).Param<int>( sSectorY ).Param<int>( bSectorZ ).Param<int>( usFacilityType ).Param<int>( usProductionNumber ).Call( 5 ); LuaFunction( _LS.L, "GetFactoryLeftoverProgress" ).Param<int>( sSectorX ).Param<int>( sSectorY ).Param<int>( bSectorZ ).Param<int>( usFacilityType ).Param<int>( usProductionNumber ).Call( 5 );
if ( lua_gettop( _LS.L() ) >= 0 ) if ( lua_gettop( _LS.L() ) >= 0 )
+1 -1
View File
@@ -5692,7 +5692,7 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT16 bWeaponStatus, UIN
if ( pBullet->fFragment == false) if ( pBullet->fFragment == false)
{ {
INT16 sX, sY; INT16 sX, sY;
ConvertGridNoToCenterCellXY(pSoldier->sGridNo, &sX, &sY); ConvertGridNoToCenterCellXY(sGridNo, &sX, &sY);
if ( Item[usWeaponIndex].singleshotrocketlauncher ) if ( Item[usWeaponIndex].singleshotrocketlauncher )
{ {
+9 -1
View File
@@ -168,7 +168,7 @@ backgroundStartElementHandle(void *userData, const XML_Char *name, const XML_Cha
else if (strcmp(name, "drugitems") == 0 && pData->curElement == ELEMENT) else if (strcmp(name, "drugitems") == 0 && pData->curElement == ELEMENT)
{ {
pData->curElement = ELEMENT_VECTOR_OF_NUMBERS; pData->curElement = ELEMENT_VECTOR_OF_NUMBERS;
pData->curBackground.valueVectors[BackgroundVectorTypes::BG_DRUGUSE_TYPES].clear(); pData->curBackground.valueVectors[BackgroundVectorTypes::BG_DRUGUSE_ITEMS].clear();
pData->maxReadDepth++; //we are not skipping this element pData->maxReadDepth++; //we are not skipping this element
} }
@@ -693,6 +693,14 @@ backgroundEndElementHandle(void *userData, const XML_Char *name)
pData->curElement = ELEMENT; pData->curElement = ELEMENT;
pData->curBackground.uiFlags |= (UINT16)atol(pData->szCharData) ? BACKGROUND_CIVGROUPLOYAL : 0; pData->curBackground.uiFlags |= (UINT16)atol(pData->szCharData) ? BACKGROUND_CIVGROUPLOYAL : 0;
} }
else if (strcmp(name, "drugtypes") == 0)
{
pData->curElement = ELEMENT;
}
else if (strcmp(name, "drugitems") == 0)
{
pData->curElement = ELEMENT;
}
else if (strcmp(name, "drugtype") == 0) else if (strcmp(name, "drugtype") == 0)
{ {
pData->curElement = ELEMENT_VECTOR_OF_NUMBERS; pData->curElement = ELEMENT_VECTOR_OF_NUMBERS;