[Scummvm-cvs-logs] scummvm master -> da0669b82bcc29fd6b926d27c63812aa17164f10
dreammaster
dreammaster at scummvm.org
Sun Aug 7 17:45:33 CEST 2016
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
da0669b82b TITANIC: Add getNewRandomNumber to CGameObject
Commit: da0669b82bcc29fd6b926d27c63812aa17164f10
https://github.com/scummvm/scummvm/commit/da0669b82bcc29fd6b926d27c63812aa17164f10
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-08-07T11:45:27-04:00
Commit Message:
TITANIC: Add getNewRandomNumber to CGameObject
Changed paths:
engines/titanic/core/game_object.cpp
engines/titanic/core/game_object.h
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp
index 73e3511..89e3ded 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 fdbbcd6..665fc6c 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;
More information about the Scummvm-git-logs
mailing list