Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Tactical/Item Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,7 @@ extern OBJECTTYPE gTempObject;
#define ITEM_fProvidesRobotCamo 0x0000010000000000 // rftr: robot attachments
#define ITEM_fProvidesRobotNightVision 0x0000020000000000 // rftr: robot attachments
#define ITEM_fProvidesRobotLaserBonus 0x0000040000000000 // rftr: robot attachments
#define ITEM_FoodSystemExclusive 0x0000080000000000 // kitty: item exclusively available with food feature

// ----------------------------------------------------------------

Expand Down
13 changes: 8 additions & 5 deletions Tactical/Items.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1271,12 +1271,14 @@ BOOLEAN ItemIsLegal( UINT16 usItemIndex, BOOLEAN fIgnoreCoolness )
if ( Item[usItemIndex].ubCoolness == 0 && !fIgnoreCoolness )
return FALSE;

// silversurfer: no food items if the food system is off
if ( !UsingFoodSystem() && Item[ usItemIndex ].foodtype > 0 )

// kitty: no food items if the food system is off
// whether the item is exclusive is defined by tag
// replaced previous system which used Item[usItemIndex].foodtype > 0 as criteria
// that also restricted dual use items (i.e. drugs that also have a foodtype, like coffee, etc.)
if (!gGameExternalOptions.fFoodSystem && ItemIsOnlyInFood(usItemIndex))
{
// Only restrict food for now. Water can be used to replenish lost energy so it is useful even without the food system.
if ( Food[Item[usItemIndex].foodtype].bFoodPoints > 0 )
return FALSE;
return FALSE;
}

// kitty: no disease items if the disease system is off
Expand Down Expand Up @@ -16128,3 +16130,4 @@ BOOLEAN ItemIsOnlyInDisease(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_Di
BOOLEAN ItemProvidesRobotCamo(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_fProvidesRobotCamo); }
BOOLEAN ItemProvidesRobotNightvision(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_fProvidesRobotNightVision); }
BOOLEAN ItemProvidesRobotLaserBonus(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_fProvidesRobotLaserBonus); }
BOOLEAN ItemIsOnlyInFood(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_FoodSystemExclusive); }
1 change: 1 addition & 0 deletions Tactical/Items.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ BOOLEAN ItemIsOnlyInDisease(UINT16 usItem);
BOOLEAN ItemProvidesRobotCamo(UINT16 usItem);
BOOLEAN ItemProvidesRobotNightvision(UINT16 usItem);
BOOLEAN ItemProvidesRobotLaserBonus(UINT16 usItem);
BOOLEAN ItemIsOnlyInFood(UINT16 usItem);

//Existing functions without header def's, added them here, just incase I'll need to call
//them from the editor.
Expand Down
7 changes: 7 additions & 0 deletions Utils/XML_Items.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1592,6 +1592,12 @@ itemEndElementHandle(void *userData, const XML_Char *name)
pData->curElement = ELEMENT;
pData->curItem.iTransportGroupMaxProgress = (INT8)atoi(pData->szCharData);
}
else if (strcmp(name, "FoodSystemExclusive") == 0)
{
pData->curElement = ELEMENT;
if ((BOOLEAN)atol(pData->szCharData))
pData->curItem.usItemFlag2 |= ITEM_FoodSystemExclusive;
}

--pData->maxReadDepth;
}
Expand Down Expand Up @@ -2225,6 +2231,7 @@ BOOLEAN WriteItemStats()
if (ItemProvidesRobotNightvision(cnt)) FilePrintf(hFile, "\t\t<ProvidesRobotNightVision>%d</ProvidesRobotNightVision>\r\n", 1);
if (ItemProvidesRobotLaserBonus(cnt)) FilePrintf(hFile, "\t\t<ProvidesRobotLaserBonus>%d</ProvidesRobotLaserBonus>\r\n", 1);
if (ItemIsOnlyInDisease(cnt)) FilePrintf(hFile, "\t\t<DiseaseSystemExclusive>%d</DiseaseSystemExclusive>\r\n", 1);
if (ItemIsOnlyInFood(cnt)) FilePrintf(hFile, "\t\t<FoodSystemExclusive>%d</FoodSystemExclusive>\r\n", 1);

FilePrintf(hFile,"\t</ITEM>\r\n");
}
Expand Down