Haven't packaged yet, but has been compiled, and seems to work just fine.
In slicfunc.h (prior to last #endif)
In SlicEngine.cpp (at the end of AddBuiltinFunctions() )
In SlicFunc.cpp (at the end)
In slicfunc.h (prior to last #endif)
Code:
// New good slic function prototypes. See cpp for details SLICFUNC(SFR_VOID, PlantSpecificGood); SLICFUNC(SFR_VOID, RemoveGood);
Code:
#if !defined(ACTIVISION_ORIGINAL) // new good functions by MrBaggins m_functionHash->Add(new Slic_PlantSpecificGood); m_functionHash->Add(new Slic_RemoveGood); #endif
Code:
//----------------------------------------------------------------------------
//
// Authored : MrBaggins
//
// Name : Slic_PlantSpecificGood
//
// Description: Rather than planting a random good, as per the standard SLIC
// function, this allows the specification of which good subtype
// to plant
//
// Parameters : SlicArg 0: location
// SlicArg 1: int
//
// Globals : g_theWorld : World gamestate functionality
// g_tiledMap : UI update functionality
//
// Returns : SFN_ERROR : execution result
//
// Remark(s) : Allows for the specification of a good sub
// a range of 0 (no good), or 1-4 (the specific good subtype,
// as defined in ctp2_data\default\gamedata\goods.txt//
//----------------------------------------------------------------------------
SFN_ERROR Slic_PlantSpecificGood::Call(SlicArgList *args)
{
#if !defined(ACTIVISION_ORIGINAL)
if(args->m_numArgs != 2)
return SFN_ERROR_NUM_ARGS;
MapPoint pos;
if(!args->GetPos(0, pos))
return SFN_ERROR_TYPE_ARGS;
sint32 goodsubtype;
if(!args->GetInt(1, goodsubtype))
return SFN_ERROR_TYPE_ARGS;
if(goodsubtype<0 || goodsubtype>4)
return SFN_ERROR_OUT_OF_RANGE;
g_theWorld->SetGood(pos.x, pos.y, goodsubtype);
g_tiledMap->PostProcessTile(pos, g_theWorld->GetTileInfo(pos));
g_tiledMap->TileChanged(pos);
g_tiledMap->RedrawTile(&pos);
#endif
return SFN_ERROR_OK;
}
//----------------------------------------------------------------------------
//
// Authored : MrBaggins
//
// Name : Slic_RemoveGood
//
// Description: New complimentary function to PlantGood
//
// Parameters : SlicArg 0: location
//
// Globals : g_theWorld : World gamestate functionality
// g_tiledMap : UI update functionality
//
// Returns : SFN_ERROR : execution result
//
//----------------------------------------------------------------------------
SFN_ERROR Slic_RemoveGood::Call(SlicArgList *args)
{
#if !defined(ACTIVISION_ORIGINAL)
if(args->m_numArgs != 1)
return SFN_ERROR_NUM_ARGS;
MapPoint pos;
if(!args->GetPos(0, pos))
return SFN_ERROR_TYPE_ARGS;
g_theWorld->SetGood(pos.x, pos.y, 0);
// plants a good of subtype 0 AKA no good, at location x,y.
g_tiledMap->PostProcessTile(pos, g_theWorld->GetTileInfo(pos));
g_tiledMap->TileChanged(pos);
g_tiledMap->RedrawTile(&pos);
#endif
return SFN_ERROR_OK;
}
Comment