LOL: fix some valgrind warnings

svn-id: r41052
This commit is contained in:
Florian Kagerer 2009-05-31 00:25:05 +00:00
parent 76406c35ec
commit f2516e648e
2 changed files with 17 additions and 5 deletions

View File

@ -114,8 +114,10 @@ bool LoLEngine::checkSceneUpdateNeed(int func) {
int LoLEngine::olol_setWallType(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_setWallType(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2));
if (_wllWallFlags[stackPos(2)] & 4)
deleteMonstersFromBlock(stackPos(0));
if (stackPos(2) != -1) {
if (_wllWallFlags[stackPos(2)] & 4)
deleteMonstersFromBlock(stackPos(0));
}
setWallType(stackPos(0), stackPos(1), stackPos(2));
return 1;
}
@ -227,7 +229,7 @@ int LoLEngine::olol_testGameFlag(EMCState *script) {
int LoLEngine::olol_loadLevelGraphics(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_loadLevelGraphics(%p) (%s, %d, %d, %d, %d, %d)", (const void *)script, stackPosString(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5));
loadLevelGraphics(stackPosString(0), stackPos(1), stackPos(2), (uint16)stackPos(3), (uint16)stackPos(4), (stackPos(5) == -1) ? 0 : stackPosString(5));
loadLevelGraphics(stackPosString(0), stackPos(1), stackPos(2), stackPos(3) == -1 ? -1 : (uint16)stackPos(3), stackPos(4) == -1 ? -1 : (uint16)stackPos(4), (stackPos(5) == -1) ? 0 : stackPosString(5));
return 1;
}

View File

@ -506,6 +506,7 @@ int LoLEngine::calcMonsterSkillLevel(int id, int a) {
const uint16 *c = getCharacterOrMonsterStats(id);
int r = (a << 8) / c[4];
/*
if (!(id & 0x8000))
r = (r * _monsterModifiers[3 + _monsterDifficulty]) >> 8;
@ -514,9 +515,18 @@ int LoLEngine::calcMonsterSkillLevel(int id, int a) {
if (_characters[id].skillLevels[1] <= 3)
return r;
else if (_characters[id].skillLevels[1] <= 7)
return (r- (r >> 2));
return (r- (r >> 2));*/
return (r- (r >> 1));
if (id & 0x8000) {
r = (r * _monsterModifiers[3 + _monsterDifficulty]) >> 8;
} else {
if (_characters[id].skillLevels[1] > 7)
r = (r- (r >> 1));
else if (_characters[id].skillLevels[1] > 3 && _characters[id].skillLevels[1] <= 7)
r = (r- (r >> 2));
}
return r;
}
int LoLEngine::checkBlockOccupiedByParty(int x, int y, int testFlag) {