AVALANCHE: use nullptr for empty pointers

This commit is contained in:
Strangerke 2013-09-25 07:46:09 +02:00
parent 5637987bd7
commit 1b1655d0c8
2 changed files with 8 additions and 8 deletions

View File

@ -264,7 +264,7 @@ Avalot::Avalot(AvalancheEngine *vm) : _fxHidden(false), _clock(vm), _interrogati
// Needed because of Lucerna::load_also() // Needed because of Lucerna::load_also()
for (int i = 0; i < 31; i++) { for (int i = 0; i < 31; i++) {
for (int j = 0; j < 2; j++) for (int j = 0; j < 2; j++)
_also[i][j] = 0; _also[i][j] = nullptr;
} }
_totalTime = 0; _totalTime = 0;
@ -273,9 +273,9 @@ Avalot::Avalot(AvalancheEngine *vm) : _fxHidden(false), _clock(vm), _interrogati
Avalot::~Avalot() { Avalot::~Avalot() {
for (int i = 0; i < 31; i++) { for (int i = 0; i < 31; i++) {
for (int j = 0; j < 2; j++) { for (int j = 0; j < 2; j++) {
if (_also[i][j] != 0) { if (_also[i][j] != nullptr) {
delete _also[i][j]; delete _also[i][j];
_also[i][j] = 0; _also[i][j] = nullptr;
} }
} }
} }
@ -437,7 +437,7 @@ void Avalot::runAvalot() {
void Avalot::init() { void Avalot::init() {
for (int i = 0; i < 31; i++) { for (int i = 0; i < 31; i++) {
for (int j = 0; j < 2; j++) for (int j = 0; j < 2; j++)
_also[i][j] = 0; _also[i][j] = nullptr;
} }
#if 0 #if 0
@ -520,7 +520,7 @@ void Avalot::scram(Common::String &str) {
void Avalot::unScramble() { void Avalot::unScramble() {
for (int i = 0; i < 31; i++) { for (int i = 0; i < 31; i++) {
for (int j = 0; j < 2; j++) { for (int j = 0; j < 2; j++) {
if (_also[i][j] != 0) if (_also[i][j] != nullptr)
scram(*_also[i][j]); scram(*_also[i][j]);
} }
} }
@ -531,9 +531,9 @@ void Avalot::unScramble() {
void Avalot::loadAlso(byte num) { void Avalot::loadAlso(byte num) {
for (int i = 0; i < 31; i++) { for (int i = 0; i < 31; i++) {
for (int j = 0; j < 2; j++) { for (int j = 0; j < 2; j++) {
if (_also[i][j] != 0) { if (_also[i][j] != nullptr) {
delete _also[i][j]; delete _also[i][j];
_also[i][j] = 0; _also[i][j] = nullptr;
} }
} }
} }

View File

@ -761,7 +761,7 @@ void Parser::parse() {
// Check also[] first, which contains words about the actual room. // Check also[] first, which contains words about the actual room.
if (!thisword.empty()) { if (!thisword.empty()) {
for (int i = 0; i < 31; i++) { for (int i = 0; i < 31; i++) {
if ((_vm->_avalot->_also[i][0] != 0) && (getPos(',' + thisword, *_vm->_avalot->_also[i][0]) > -1)) { if ((_vm->_avalot->_also[i][0]) && (getPos(',' + thisword, *_vm->_avalot->_also[i][0]) > -1)) {
_thats += Common::String(99 + i); _thats += Common::String(99 + i);
notfound = false; notfound = false;
} }