CGameContainer Class

The structure used for this class is CGameContainer

Quick Ref

void CGameContainer::CGameContainer(CGameArea* pArea, CRect& rBound)

void CGameContainer::CGameContainer(CGameArea* pArea, CAreaFileContainer* pContainerObject, CAreaPoint* pPoints, unsigned short maxPts, CCreatureFileItem* pItems, unsigned long maxItems)

virtual void CGameContainer::~CGameContainer()

virtual void CGameContainer::AIUpdate()

virtual void CGameContainer::AddEffect(CGameEffect* pEffect, unsigned char list, int noSave, int immediateApply)

virtual unsigned char CGameContainer::CanSaveGame(unsigned long& strError, int restCheck, int combatCheck)

void CGameContainer::CompressContainer()

virtual unsigned char CGameContainer::CompressTime(unsigned long deltaTime)

short CGameContainer::CountItem(CResRef& res)

virtual void CGameContainer::DebugDump(CString& message, unsigned char bEchoToScreen)

virtual unsigned char CGameContainer::DoAIUpdate(unsigned char active, long counter)

short CGameContainer::FindItemSlot(CResRef& res)

virtual CRect CGameContainer::GetBounding()

CItem* CGameContainer::GetItem(short nSlotNum)

virtual short CGameContainer::GetNPoly()

short CGameContainer::GetNumTrueItems()

virtual CPoint* CGameContainer::GetPoly()

unsigned char CGameContainer::HasItemType(unsigned long type)

unsigned char CGameContainer::HasItemWithFlag(unsigned long flag, int ignoreDestructible)

virtual int CGameContainer::IsOver(CPoint& pt)

void CGameContainer::Marshal(SAreaFileWrapper* pContainerWrapper)

void CGameContainer::MarshalMessage(unsigned char** pData, unsigned long* dwSize)

virtual void CGameContainer::OnActionButton(CPoint& pt)

void CGameContainer::OpenContainer(CAIObjectType& user)

void CGameContainer::PlaceAllGold(unsigned long gold)

unsigned char CGameContainer::PlaceItemInBlankSlot(CItem* pItem, unsigned char bCompressContainer, short nRecommendedSlotNum, int useMessage)

void CGameContainer::RefreshRenderPile()

virtual void CGameContainer::Render(CGameArea* pArea, CVidMode* pVidMode)

virtual void CGameContainer::SetCursor(long nToolTip)

void CGameContainer::SetDrawPoly(short time)

void CGameContainer::SetFlags(unsigned long dwFlags)

void CGameContainer::SetItem(short nSlotNum, CItem* pItem)

void CGameContainer::SetTrapActivated(unsigned short active)

void CGameContainer::SetTrapDetected(unsigned short state)

unsigned long CGameContainer::TakeAllGold()

void CGameContainer::TakeCreatureItems(CGameSprite* pSprite, int Type)

virtual void CGameContainer::RemoveFromArea()


Constructors

Name

Description

CGameContainer::CGameContainer

Constructs a CGameContainer object

CGameContainer::~CGameContainer

Destroys a CGameContainer object

CGameContainer::CGameContainer

Constructs a CGameContainer object

void CGameContainer::CGameContainer(
   CGameArea* pArea,
   CRect& rBound);

Parameters

  • CGameArea* pArea - pointer to area

  • CRect& rBound - bounding rectanble of the container to add to area

Remarks

Constructs a CGameContainer object


CGameContainer::CGameContainer

Constructs a CGameContainer object

void CGameContainer::CGameContainer(
   CGameArea* pArea,
   CAreaFileContainer* pContainerObject,
   CAreaPoint* pPoints,
   unsigned short maxPts,
   CCreatureFileItem* pItems,
   unsigned long maxItems);

Parameters

  • CGameArea* pArea - pointer to area

  • CAreaFileContainer* pContainerObject - pointer to container object

  • CAreaPoint* pPoints - pointer to array of points used for polygon to highlight container

  • unsigned short maxPts - count of points in array for polygon

  • CCreatureFileItem* pItems - pointer to array of items to add to container

  • unsigned long maxItems - count of items in array to add to container

Remarks

Constructs a CGameContainer object


CGameContainer::~CGameContainer

Destroys the CGameContainer object

virtual void CGameContainer::~CGameContainer();

Remarks

Destroys the CGameContainer object


Methods

Name

Description

CGameContainer::AIUpdate

CGameContainer::AddEffect

Add a game effect to a container

CGameContainer::CanSaveGame

CGameContainer::CompressContainer

CGameContainer::CompressTime

CGameContainer::CountItem

Returns the number of items in container

CGameContainer::DebugDump

Debug message from container class

CGameContainer::DoAIUpdate

CGameContainer::FindItemSlot

Return the slot id for a specific item in a container

CGameContainer::GetBounding

Get the bounding rectangle for the container

CGameContainer::GetItem

Return an item from a specified slot in a container

CGameContainer::GetNPoly

Returns no of polygons points for the container

CGameContainer::GetNumTrueItems

CGameContainer::GetPoly

Returns a pointer to an array of points which define the container polygon

CGameContainer::HasItemType

Determines if a container contains a specific item type

CGameContainer::HasItemWithFlag

Determines if a container contains a specific item type with an item flag

CGameContainer::IsOver

Determines if mouse position is over the container

CGameContainer::Marshal

CGameContainer::MarshalMessage

CGameContainer::OnActionButton

Event action for when mouse is clicked on the container

CGameContainer::OpenContainer

Opens container by the specified character

CGameContainer::PlaceAllGold

Takes gold and places the specified amount into the shared party gold stash

CGameContainer::PlaceItemInBlankSlot

Places an item into a blank slot of the container

CGameContainer::RefreshRenderPile

CGameContainer::Render

CGameContainer::SetCursor

Set the cursor and tooltip when mouse is over the container

CGameContainer::SetDrawPoly

CGameContainer::SetFlags

Set container flags

CGameContainer::SetItem

Set an item in a container slot

CGameContainer::SetTrapActivated

Sets or clears if a trap is activated on the container

CGameContainer::SetTrapDetected

Sets if a trap on a container has been detected yet

CGameContainer::TakeAllGold

Take all gold

CGameContainer::TakeCreatureItems

Take items from a creature

CGameContainer::RemoveFromArea

Remove from area

CGameContainer::AIUpdate

virtual void CGameContainer::AIUpdate();

Remarks


CGameContainer::AddEffect

Add a game effect to a container

virtual void CGameContainer::AddEffect(
   CGameEffect* pEffect,
   unsigned char list,
   int noSave,
   int immediateApply);

Parameters

  • CGameEffect* pEffect - pointer to game effect to add to container

  • unsigned char list -

  • int noSave - if a saving throw is allowed to avoid or reduce effect if trap is triggered

  • int immediateApply - if the effect is immediate or delayed

Remarks

Used for setting trap effects on containers, eg. fireball, lightning, poison, or piercing, slashing damage etc


CGameContainer::CanSaveGame

virtual unsigned char CGameContainer::CanSaveGame(
   unsigned long& strError,
   int restCheck,
   int combatCheck);

Parameters

  • unsigned long& strError -

  • int restCheck -

  • int combatCheck -

Return Value

Returns unsigned char

Remarks


CGameContainer::CompressContainer

void CGameContainer::CompressContainer();

Remarks


CGameContainer::CompressTime

virtual unsigned char CGameContainer::CompressTime(unsigned long deltaTime);

Parameters

  • unsigned long deltaTime -

Return Value

Returns unsigned char

Remarks


CGameContainer::CountItem

Returns the number of items in container

short CGameContainer::CountItem(CResRef& res)

Parameters

  • CResRef& res - resource reference of the container to return count of items for

Return Value

Returns a short value reprenting the number of items in the container

Remarks


CGameContainer::DebugDump

Debug message from container class

virtual void CGameContainer::DebugDump(
   CString& message,
   unsigned char bEchoToScreen);

Parameters

  • CString& message - debug message to output to console

  • unsigned char bEchoToScreen - output debug message to screen as well as console

Remarks


CGameContainer::DoAIUpdate

virtual unsigned char CGameContainer::DoAIUpdate(
   unsigned char active,
   long counter);

Parameters

  • unsigned char active -

  • long counter -

Return Value

Returns unsigned char

Remarks


CGameContainer::FindItemSlot

Return the slot id for a specific item in a container

short CGameContainer::FindItemSlot(CResRef& res);

Parameters

  • CResRef& res - resource reference of item in container

Return Value

Returns a short value representing the slot id for the item in a container

Remarks

Does this return 0 or -1 if item not found in container ?


CGameContainer::GetBounding

Get the bounding rectangle for the container

virtual CRect CGameContainer::GetBounding();

Return Value

Returns a CRect which defines the bounding dimensions of the container

Remarks


CGameContainer::GetItem

Return an item from a specified slot in a container

CItem* CGameContainer::GetItem(short nSlotNum);

Parameters

  • short nSlotNum - slot id to return the item associated with this slot

Return Value

Returns CItem*

Remarks


CGameContainer::GetNPoly

Returns the number of polygons points for the container

virtual short CGameContainer::GetNPoly();

Return Value

Returns a short value indicating no of points that define the containers polygon

Remarks

Polygons are used when highlighting containers with a bright colored outline

See also CGameContainer::GetPoly and CGameContainer::SetDrawPoly


CGameContainer::GetNumTrueItems

short CGameContainer::GetNumTrueItems();

Return Value

Returns short

Remarks


CGameContainer::GetPoly

Returns a pointer to an array of points which define the container polygon

virtual CPoint* CGameContainer::GetPoly();

Return Value

Returns CPoint*, an array of points which define the container polygon

Remarks

Polygons are used when highlighting containers with a bright colored outline

See also CGameContainer::GetNPoly and CGameContainer::SetDrawPoly


CGameContainer::HasItemType

Determines if a container contains a specific item type

unsigned char CGameContainer::HasItemType(unsigned long type);

Parameters

  • unsigned long type - the type of item to check for

Return Value

Returns unsigned char

Remarks


CGameContainer::HasItemWithFlag

Determines if a container contains a specific item type with an item flag

unsigned char CGameContainer::HasItemWithFlag(
   unsigned long flag,
   int ignoreDestructible);

Parameters

  • unsigned long flag - item flag to check for

  • int ignoreDestructible - ignore destructible items

Return Value

Returns unsigned char

Remarks


CGameContainer::IsOver

Determines if mouse position is over the container

virtual int CGameContainer::IsOver(CPoint& pt);

Parameters

  • CPoint& pt - x and y coordinates of the mouse position

Return Value

Returns an int value representing 1 true, or 0 false

Remarks


CGameContainer::Marshal

void CGameContainer::Marshal(SAreaFileWrapper* pContainerWrapper);

Parameters

Remarks


CGameContainer::MarshalMessage

void CGameContainer::MarshalMessage(
   unsigned char** pData,
   unsigned long* dwSize);

Parameters

  • unsigned char** pData - pointer to data

  • unsigned long* dwSize - size of data

Remarks


CGameContainer::OnActionButton

Event action for when mouse is clicked on the container

virtual void CGameContainer::OnActionButton(CPoint& pt);

Parameters

  • CPoint& pt - x and y coordinates of the mouse pointer

Remarks


CGameContainer::OpenContainer

Opens container by the specified character

void CGameContainer::OpenContainer(CAIObjectType& user);

Parameters

Remarks


CGameContainer::PlaceAllGold

Takes gold and places the specified amount into the shared party gold stash

void CGameContainer::PlaceAllGold(unsigned long gold);

Parameters

  • unsigned long gold - amount of gold

Remarks


CGameContainer::PlaceItemInBlankSlot

Places an item into a blank slot of the container

unsigned char CGameContainer::PlaceItemInBlankSlot(
   CItem* pItem,
   unsigned char bCompressContainer,
   short nRecommendedSlotNum,
   int useMessage);

Parameters

  • CItem* pItem - item to place in container

  • unsigned char bCompressContainer - if the container should be compressed

  • short nRecommendedSlotNum - the slot id to place the item into the container at

  • int useMessage -

Return Value

Returns unsigned char

Remarks


CGameContainer::RefreshRenderPile

void CGameContainer::RefreshRenderPile();

Remarks


CGameContainer::Render

virtual void CGameContainer::Render(
   CGameArea* pArea,
   CVidMode* pVidMode);

Parameters

Remarks


CGameContainer::SetCursor

Set the cursor and tooltip when mouse is over the container

virtual void CGameContainer::SetCursor(long nToolTip);

Parameters

  • long nToolTip - pointer to tooltip text?

Remarks


CGameContainer::SetDrawPoly

void CGameContainer::SetDrawPoly(short time);

Parameters

  • short time - time value

Remarks

Polygons are used when highlighting containers with a bright colored outline

See also CGameContainer::GetNPoly and CGameContainer::GetPoly


CGameContainer::SetFlags

Set container flags

void CGameContainer::SetFlags(unsigned long dwFlags);

Parameters

  • unsigned long dwFlags - flags to set for container

Remarks


CGameContainer::SetItem

Set an item in a container slot

void CGameContainer::SetItem(
   short nSlotNum,
   CItem* pItem);

Parameters

  • short nSlotNum - slot id to set item for

  • CItem* pItem - pointer to item to associate with this slot id

Remarks


CGameContainer::SetTrapActivated

Sets or clears if a trap is activated on the container

void CGameContainer::SetTrapActivated(unsigned short active);

Parameters

  • unsigned short active - trap activated state

Remarks

if trap is to be activated or already sprung, or not enabled


CGameContainer::SetTrapDetected

Sets if a trap on a container has been detected yet

void CGameContainer::SetTrapDetected(unsigned short state);

Parameters

  • unsigned short state - trap detected state

Remarks


CGameContainer::TakeAllGold

Take all gold

unsigned long CGameContainer::TakeAllGold();

Return Value

Returns unsigned long

Remarks


CGameContainer::TakeCreatureItems

Take items from a creature

void CGameContainer::TakeCreatureItems(
   CGameSprite* pSprite,
   int Type);

Parameters

  • CGameSprite* pSprite - pointer to creature to take items from

  • int Type - type of item to take

Remarks

Typically a dead creature is seen as a container for looting purposes.


CGameContainer::RemoveFromArea

Remove from area

virtual void CGameContainer::RemoveFromArea();

Remarks