MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / FindPos

Method FindPos

Descent3/Inventory.cpp:840–859  ·  view source on GitHub ↗

searches the inventory for the specified type/id, sets the pos to it

Source from the content-addressed store, hash-verified

838
839// searches the inventory for the specified type/id, sets the pos to it
840bool Inventory::FindPos(int type, int id) {
841 int oldt, oldi;
842 int ttype, tid;
843
844 // save current pos
845 GetPosTypeID(oldt, oldi);
846
847 // try to move to the specified pos
848 GotoPos(type, id);
849
850 // see if we got there
851 GetPosTypeID(ttype, tid);
852 if ((ttype == type) && (tid == id))
853 return true;
854 else {
855 // nope, so restore the old pos
856 GotoPos(oldt, oldi);
857 return false;
858 }
859}
860
861// uses an item in the inventory (currently selected one) (returns false if the item doesn't exist)
862bool Inventory::UsePos(object *parent) {

Callers 2

dInven_FindPosFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected