aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/titanic/core/game_object.cpp10
-rw-r--r--engines/titanic/core/game_object.h5
2 files changed, 15 insertions, 0 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp
index 73e3511319..89e3ded248 100644
--- a/engines/titanic/core/game_object.cpp
+++ b/engines/titanic/core/game_object.cpp
@@ -1392,6 +1392,16 @@ void CGameObject::resetMail() {
mailMan->resetValue();
}
+int CGameObject::getNewRandomNumber(int max, int *oldVal) {
+ if (oldVal) {
+ int startingVal = *oldVal;
+ while (*oldVal == startingVal && max > 0)
+ *oldVal = g_vm->getRandomNumber(max);
+ } else {
+ return g_vm->getRandomNumber(max);
+ }
+}
+
/*------------------------------------------------------------------------*/
CRoomItem *CGameObject::getRoom() const {
diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h
index fdbbcd6959..665fc6cf37 100644
--- a/engines/titanic/core/game_object.h
+++ b/engines/titanic/core/game_object.h
@@ -513,6 +513,11 @@ protected:
* Scroll text down
*/
void scrollTextDown();
+
+ /**
+ * Gets a new random number
+ */
+ int getNewRandomNumber(int max, int *oldVal = nullptr);
public:
bool _isMail;
int _id;