Пример #1
0
void Parallaction::allocateLocationSlot(const char *name) {
	// WORKAROUND: the original code erroneously incremented
	// _currentLocationIndex, thus producing inconsistent
	// savegames. This workaround modified the following loop
	// and if-statement, so the code exactly matches the one
	// in Big Red Adventure.
	_currentLocationIndex = -1;
	uint16 _di = 0;
	while (_locationNames[_di][0] != '\0') {
		if (!scumm_stricmp(_locationNames[_di], name)) {
			_currentLocationIndex = _di;
		}
		_di++;
	}

	if (_di == 120)
		error("No more location slots available. Please report this immediately to ScummVM team");

	if (_currentLocationIndex  == -1) {
		strcpy(_locationNames[_numLocations], name);
		_currentLocationIndex = _numLocations;

		_numLocations++;
		_locationNames[_numLocations][0] = '\0';
		_localFlags[_numLocations] = 0;
	} else {
		setLocationFlags(kFlagsVisited);	// 'visited'
	}
}
Пример #2
0
void Parallaction_br::testCounterCondition(const Common::String &name, int op, int value) {
	int index = _countersNames->lookup(name.c_str());
	if (index == Table::notFound) {
		clearLocationFlags(kFlagsTestTrue);
		return;
	}

	int c = _counters[index - 1];

// these definitions must match those in parser_br.cpp
#define CMD_TEST		25
#define CMD_TEST_GT		26
#define CMD_TEST_LT		27

	bool res = false;
	switch (op) {
	case CMD_TEST:
		res = (c == value);
		break;

	case CMD_TEST_GT:
		res = (c > value);
		break;

	case CMD_TEST_LT:
		res = (c < value);
		break;

	default:
		error("unknown operator in testCounterCondition");
	}

	if (res) {
		setLocationFlags(kFlagsTestTrue);
	} else {
		clearLocationFlags(kFlagsTestTrue);
	}
}