diff options
author | Nipun Garg | 2019-06-30 00:47:45 +0530 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:17:05 +0200 |
commit | b58b5b7ff538ce820e9fca4d26547674e481c241 (patch) | |
tree | 2c592174a70e8d0fede3e5967ca43da365455abb | |
parent | 8cf8a9663961c22a72c34fcc8e67b9228b50a387 (diff) | |
download | scummvm-rg350-b58b5b7ff538ce820e9fca4d26547674e481c241.tar.gz scummvm-rg350-b58b5b7ff538ce820e9fca4d26547674e481c241.tar.bz2 scummvm-rg350-b58b5b7ff538ce820e9fca4d26547674e481c241.zip |
HDB: Add _deliveries functions
-rw-r--r-- | engines/hdb/ai-inventory.cpp | 37 | ||||
-rw-r--r-- | engines/hdb/ai.h | 10 |
2 files changed, 47 insertions, 0 deletions
diff --git a/engines/hdb/ai-inventory.cpp b/engines/hdb/ai-inventory.cpp index 09fee3b5b8..cfa45e342f 100644 --- a/engines/hdb/ai-inventory.cpp +++ b/engines/hdb/ai-inventory.cpp @@ -104,4 +104,41 @@ AIEntity *AI::getInvItem(int which) { return NULL; return _inventory[which].ent; } + +void AI::newDelivery(const char *itemTextName, const char *itemGfxName, const char *destTextName, const char *destGfxName, const char *id) { + int i = _numDeliveries; + + if (i == kMaxDeliveries) { + g_hdb->_window->openMessageBar("You have too many deliveries already!", 3); + return; + } + + if (itemTextName) + strcpy(_deliveries[i].itemTextName, itemTextName); + if (itemGfxName) + strcpy(_deliveries[i].itemGfxName, itemGfxName); + if (destTextName) + strcpy(_deliveries[i].destTextName, destTextName); + if (destGfxName) + strcpy(_deliveries[i].destGfxName, destGfxName); + + strcpy(_deliveries[i].id, id); + + _numDeliveries++; + + g_hdb->_window->openDeliveries(true); +} + +bool AI::completeDelivery(const char *id) { + for (int i = 0; i < _numDeliveries; i++) + if (!scumm_stricmp(_deliveries[i].id, id)) { + for (; i < _numDeliveries; i++) + memcpy(&_deliveries[i], &_deliveries[i + 1], sizeof(_deliveries[0])); + _numDeliveries--; + warning("STUB: Play Voice: GUY_COMPLETED"); + return true; + } + return false; +} + } // End of Namespace diff --git a/engines/hdb/ai.h b/engines/hdb/ai.h index 41337082f1..40be5af840 100644 --- a/engines/hdb/ai.h +++ b/engines/hdb/ai.h @@ -935,6 +935,16 @@ public: AIEntity *getInvItem(int which); + // Delivery Functions + void newDelivery(const char *itemTextName, const char *itemGfxName, const char *destTextName, const char *destGfxName, const char *id); + int getDeliveriesAmount() { + return _numDeliveries; + } + DlvEnt *getDeliveryItem(int which) { + return &_deliveries[which]; + } + bool completeDelivery(const char *id); + // Player Variables bool _playerDead; bool _playerInvisible; // While on RailRider for example |