Fix crash in _map_age_dead_critters (#258)
Co-authored-by: Alexander Batalov <alex.batalov@gmail.com>
This commit is contained in:
parent
61293bd39c
commit
42c541012c
|
@ -2133,26 +2133,17 @@ Object* objectFindFirst()
|
||||||
{
|
{
|
||||||
gObjectFindElevation = 0;
|
gObjectFindElevation = 0;
|
||||||
|
|
||||||
ObjectListNode* objectListNode;
|
|
||||||
for (gObjectFindTile = 0; gObjectFindTile < HEX_GRID_SIZE; gObjectFindTile++) {
|
for (gObjectFindTile = 0; gObjectFindTile < HEX_GRID_SIZE; gObjectFindTile++) {
|
||||||
objectListNode = gObjectListHeadByTile[gObjectFindTile];
|
ObjectListNode* objectListNode = gObjectListHeadByTile[gObjectFindTile];
|
||||||
if (objectListNode) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gObjectFindTile == HEX_GRID_SIZE) {
|
|
||||||
gObjectFindLastObjectListNode = NULL;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (objectListNode != NULL) {
|
while (objectListNode != NULL) {
|
||||||
if (artIsObjectTypeHidden(FID_TYPE(objectListNode->obj->fid)) == 0) {
|
Object* object = objectListNode->obj;
|
||||||
|
if (!artIsObjectTypeHidden(FID_TYPE(object->fid))) {
|
||||||
gObjectFindLastObjectListNode = objectListNode;
|
gObjectFindLastObjectListNode = objectListNode;
|
||||||
return objectListNode->obj;
|
return object;
|
||||||
}
|
}
|
||||||
objectListNode = objectListNode->next;
|
objectListNode = objectListNode->next;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
gObjectFindLastObjectListNode = NULL;
|
gObjectFindLastObjectListNode = NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2167,9 +2158,14 @@ Object* objectFindNext()
|
||||||
|
|
||||||
ObjectListNode* objectListNode = gObjectFindLastObjectListNode->next;
|
ObjectListNode* objectListNode = gObjectFindLastObjectListNode->next;
|
||||||
|
|
||||||
while (gObjectFindTile < HEX_GRID_SIZE) {
|
while (true) {
|
||||||
if (objectListNode == NULL) {
|
if (objectListNode == NULL) {
|
||||||
objectListNode = gObjectListHeadByTile[gObjectFindTile++];
|
gObjectFindTile++;
|
||||||
|
if (gObjectFindTile >= HEX_GRID_SIZE) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
objectListNode = gObjectListHeadByTile[gObjectFindTile];
|
||||||
}
|
}
|
||||||
|
|
||||||
while (objectListNode != NULL) {
|
while (objectListNode != NULL) {
|
||||||
|
@ -2219,9 +2215,14 @@ Object* objectFindNextAtElevation()
|
||||||
|
|
||||||
ObjectListNode* objectListNode = gObjectFindLastObjectListNode->next;
|
ObjectListNode* objectListNode = gObjectFindLastObjectListNode->next;
|
||||||
|
|
||||||
while (gObjectFindTile < HEX_GRID_SIZE) {
|
while (true) {
|
||||||
if (objectListNode == NULL) {
|
if (objectListNode == NULL) {
|
||||||
objectListNode = gObjectListHeadByTile[gObjectFindTile++];
|
gObjectFindTile++;
|
||||||
|
if (gObjectFindTile >= HEX_GRID_SIZE) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
objectListNode = gObjectListHeadByTile[gObjectFindTile];
|
||||||
}
|
}
|
||||||
|
|
||||||
while (objectListNode != NULL) {
|
while (objectListNode != NULL) {
|
||||||
|
|
Loading…
Reference in New Issue