Skip to content

Commit

Permalink
Fix groundDecals->GetDecalById() returning nullptr for valid decal id
Browse files Browse the repository at this point in the history
  • Loading branch information
lhog committed Sep 4, 2024
1 parent 1cda625 commit 70e99d3
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions rts/Rendering/Env/Decals/GroundDecalHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -691,10 +691,10 @@ void CGroundDecalHandler::AddExplosion(AddExplosionInfo&& ei)

if (vi.scarGlowColorMap && !vi.scarGlowColorMap->Empty()) {
auto idcs = vi.scarGlowColorMap->GetIndices(0.0f);
idToCmInfo.emplace(decal.info.id, std::make_tuple(vi.scarGlowColorMap, idcs));
idToCmInfo[decal.info.id] = std::make_tuple(vi.scarGlowColorMap, idcs);
}

idToPos.emplace(decal.info.id, decals.size() - 1);
idToPos[decal.info.id] = decals.size() - 1;
decalsUpdateList.EmplaceBackUpdate();
}

Expand Down Expand Up @@ -921,8 +921,8 @@ void CGroundDecalHandler::MoveSolidObject(const CSolidObject* object, const floa
});

decalsUpdateList.EmplaceBackUpdate();
idToPos.emplace(decal.info.id, decals.size() - 1);
decalOwners.emplace(object, decals.size() - 1);
idToPos[decal.info.id] = decals.size() - 1;
decalOwners[object] = decals.size() - 1;
}

void CGroundDecalHandler::RemoveSolidObject(const CSolidObject* object, const GhostSolidObject* gb)
Expand Down Expand Up @@ -1021,7 +1021,7 @@ uint32_t CGroundDecalHandler::CreateLuaDecal()
.glowColorMap = { SColor{0.0f, 0.0f, 0.0f, 0.0f}, SColor{0.0f, 0.0f, 0.0f, 0.0f} }
});
decalsUpdateList.EmplaceBackUpdate();
idToPos.emplace(decal.info.id, decals.size() - 1);
idToPos[decal.info.id] = decals.size() - 1;

return decal.info.id;
}
Expand Down Expand Up @@ -1269,8 +1269,8 @@ void CGroundDecalHandler::AddTrack(const CUnit* unit, const float3& newPos, bool

mm = {};

decalOwners.emplace(unit, decals.size() - 1);
idToPos.emplace(decal.info.id, decals.size() - 1);
decalOwners[unit] = decals.size() - 1;
idToPos[decal.info.id] = decals.size() - 1;
decalsUpdateList.EmplaceBackUpdate();

return;
Expand Down Expand Up @@ -1359,7 +1359,7 @@ void CGroundDecalHandler::AddTrack(const CUnit* unit, const float3& newPos, bool
// replace the old entry
decalOwners[unit] = decals.size() - 1;

idToPos.emplace(newDecal.info.id, decals.size() - 1);
idToPos[newDecal.info.id], decals.size() - 1;
decalsUpdateList.EmplaceBackUpdate();
}

Expand Down

0 comments on commit 70e99d3

Please sign in to comment.