[Scummvm-git-logs] scummvm master -> 0b26c38193307dbac74137318ceb27b163b31e6a

dreammaster dreammaster at scummvm.org
Fri Dec 30 21:06:49 CET 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:
0b26c38193 TITANIC: Cleanup of CAnnounce class


Commit: 0b26c38193307dbac74137318ceb27b163b31e6a
    https://github.com/scummvm/scummvm/commit/0b26c38193307dbac74137318ceb27b163b31e6a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-12-30T15:06:37-05:00

Commit Message:
TITANIC: Cleanup of CAnnounce class

Changed paths:
    engines/titanic/game/announce.cpp
    engines/titanic/game/announce.h


diff --git a/engines/titanic/game/announce.cpp b/engines/titanic/game/announce.cpp
index 74c1264..16298f7 100644
--- a/engines/titanic/game/announce.cpp
+++ b/engines/titanic/game/announce.cpp
@@ -30,14 +30,14 @@ BEGIN_MESSAGE_MAP(CAnnounce, CGameObject)
 	ON_MESSAGE(ActMsg)
 END_MESSAGE_MAP()
 
-CAnnounce::CAnnounce() : _nameIndex(0), _soundHandle(0), _leaveFlag(1), _enabled(false) {
+CAnnounce::CAnnounce() : _nameIndex(0), _soundHandle(0), _notActivatedFlag(true), _enabled(false) {
 }
 
 void CAnnounce::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
 	file->writeNumberLine(_nameIndex, indent);
 	file->writeNumberLine(_soundHandle, indent);
-	file->writeNumberLine(_leaveFlag, indent);
+	file->writeNumberLine(_notActivatedFlag, indent);
 	file->writeNumberLine(_enabled, indent);
 
 	CGameObject::save(file, indent);
@@ -47,7 +47,7 @@ void CAnnounce::load(SimpleFile *file) {
 	file->readNumber();
 	_nameIndex = file->readNumber();
 	_soundHandle = file->readNumber();
-	_leaveFlag = file->readNumber();
+	_notActivatedFlag = file->readNumber();
 	_enabled = file->readNumber();
 
 	CGameObject::load(file);
@@ -97,6 +97,7 @@ bool CAnnounce::TimerMsg(CTimerMsg *msg) {
 			break;
 		}
 
+		// Schedule another announcement for a random future time
 		addTimer(1, 300000 + getRandomNumber(30000), 0);
 		if (getRandomNumber(3) == 0)
 			addTimer(2, 4000, 0);
@@ -111,9 +112,10 @@ bool CAnnounce::TimerMsg(CTimerMsg *msg) {
 }
 
 bool CAnnounce::LeaveRoomMsg(CLeaveRoomMsg *msg) {
-	if (_leaveFlag) {
+	// The very first time the player leaves the Embarklation Lobby, start announcements
+	if (_notActivatedFlag) {
 		addTimer(1, 1000, 0);
-		_leaveFlag = 0;
+		_notActivatedFlag = false;
 		_enabled = true;
 	}
 
@@ -121,6 +123,7 @@ bool CAnnounce::LeaveRoomMsg(CLeaveRoomMsg *msg) {
 }
 
 bool CAnnounce::ActMsg(CActMsg *msg) {
+	// Handle enabling or disabling announcements
 	if (msg->_action == "Enable")
 		_enabled = true;
 	else if (msg->_action == "Disable")
diff --git a/engines/titanic/game/announce.h b/engines/titanic/game/announce.h
index 9bf060d..caacb8f 100644
--- a/engines/titanic/game/announce.h
+++ b/engines/titanic/game/announce.h
@@ -35,7 +35,7 @@ class CAnnounce : public CGameObject {
 private:
 	int _nameIndex;
 	int _soundHandle;
-	bool _leaveFlag;
+	bool _notActivatedFlag;
 	bool _enabled;
 public:
 	CLASSDEF;





More information about the Scummvm-git-logs mailing list