22 #ifndef CRYOMNI3D_OBJECTS_H 23 #define CRYOMNI3D_OBJECTS_H 25 #include "common/array.h" 26 #include "common/func.h" 27 #include "common/str.h" 29 #include "cryomni3d/sprites.h" 37 Object() : _valid(
false), _idCA(uint(-1)), _idCl(uint(-1)), _idSA(uint(-1)), _idSl(uint(-1)),
39 _viewCallback(
nullptr) {}
41 Object(
const Sprites &sprites, uint id_CA, uint id_OBJ) : _idCA(id_CA),
42 _idCl(sprites.calculateSpriteId(id_CA, 1)), _idSA(sprites.calculateSpriteId(id_CA, 2)),
43 _idSl(sprites.calculateSpriteId(id_CA, 3)),
44 _valid(
true), _idOBJ(id_OBJ), _viewCallback(
nullptr) {}
46 ~
Object() {
delete _viewCallback; }
48 uint valid()
const {
return _valid; }
49 uint idCA()
const {
return _idCA; }
50 uint idCl()
const {
return _idCl; }
51 uint idSA()
const {
return _idSA; }
52 uint idSl()
const {
return _idSl; }
53 uint idOBJ()
const {
return _idOBJ; }
54 ViewCallback viewCallback()
const {
return _viewCallback; }
56 void setViewCallback(ViewCallback callback) { _viewCallback = callback; }
58 void rename(uint newIdOBJ) { _idOBJ = newIdOBJ; }
67 ViewCallback _viewCallback;
72 Object *findObjectByNameID(uint nameID);
73 Object *findObjectByIconID(uint iconID);
79 Inventory() : _selectedObject(
nullptr), _changeCallback(
nullptr) { }
85 void remove(uint position);
86 void removeByNameID(uint nameID);
87 void removeByIconID(uint iconID);
88 bool inInventoryByNameID(uint nameID)
const;
89 bool inInventoryByIconID(uint iconID)
const;
91 Object *selectedObject()
const {
return _selectedObject; }
92 void setSelectedObject(
Object *obj) { _selectedObject = obj; }
93 void deselectObject() { _selectedObject =
nullptr; }
Definition: cryomni3d.h:62