mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-03 17:33:05 +00:00
HOPKINS: Improve test on lineData in testLine. CID 1003821
This commit is contained in:
parent
f279cc0e51
commit
be0f082ab6
@ -2440,21 +2440,22 @@ int LinesManager::testLine(int paramX, int paramY, int *testValue, int *foundLin
|
||||
for (int idx = _lastLine + 1; idx < _linesNumb + 1; idx++) {
|
||||
lineData = _lineItem[idx]._lineData;
|
||||
lineDataEndIdx = _lineItem[idx]._lineDataEndIdx;
|
||||
if (lineData) {
|
||||
if (lineData[0] == paramX && lineData[1] == paramY) {
|
||||
*testValue = 1;
|
||||
int posX = lineData[2 * (lineDataEndIdx - 1)];
|
||||
int posY = lineData[2 * (lineDataEndIdx - 1) + 1];
|
||||
if (_lineItem[idx]._directionRouteInc == DIR_DOWN || _lineItem[idx]._directionRouteInc == DIR_UP)
|
||||
posY += 2;
|
||||
if (_lineItem[idx]._directionRouteInc == DIR_RIGHT || _lineItem[idx]._directionRouteDec == DIR_LEFT)
|
||||
posX += 2;
|
||||
if (!checkCollisionLine(posX, posY, &collDataIdx, &collLineIdx, 0, _lastLine))
|
||||
error("Error in test line");
|
||||
*foundLineIdx = collLineIdx;
|
||||
*foundDataIdx = collDataIdx;
|
||||
return idx;
|
||||
}
|
||||
if (!lineData)
|
||||
continue;
|
||||
|
||||
if (lineData[0] == paramX && lineData[1] == paramY) {
|
||||
*testValue = 1;
|
||||
int posX = lineData[2 * (lineDataEndIdx - 1)];
|
||||
int posY = lineData[2 * (lineDataEndIdx - 1) + 1];
|
||||
if (_lineItem[idx]._directionRouteInc == DIR_DOWN || _lineItem[idx]._directionRouteInc == DIR_UP)
|
||||
posY += 2;
|
||||
if (_lineItem[idx]._directionRouteInc == DIR_RIGHT || _lineItem[idx]._directionRouteDec == DIR_LEFT)
|
||||
posX += 2;
|
||||
if (!checkCollisionLine(posX, posY, &collDataIdx, &collLineIdx, 0, _lastLine))
|
||||
error("Error in test line");
|
||||
*foundLineIdx = collLineIdx;
|
||||
*foundDataIdx = collDataIdx;
|
||||
return idx;
|
||||
}
|
||||
|
||||
if (lineDataEndIdx > 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user