Skip to content

Commit

Permalink
Interactive: Use range-based for loops
Browse files Browse the repository at this point in the history
  • Loading branch information
dscharrer committed Aug 2, 2021
1 parent c567333 commit 2a1e477
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/scene/Interactive.cpp
Expand Up @@ -182,10 +182,12 @@ void ARX_INTERACTIVE_DestroyDynamicInfo(Entity * io) {

ARX_INTERACTIVE_ForceIOLeaveZone(io);

for(size_t i = 0; i < MAX_EQUIPED; i++) {
if(player.equiped[i] == io->index()) {
ARX_EQUIPMENT_UnEquip(entities.player(), entities.get(player.equiped[i]), 1);
player.equiped[i] = EntityHandle();
for(EntityHandle & equipment : player.equiped) {
if(equipment == io->index()) {
ARX_EQUIPMENT_UnEquip(entities.player(), io, 1);
equipment = EntityHandle();
arx_assert(!isEquippedByPlayer(io));
break;
}
}

Expand Down Expand Up @@ -469,13 +471,10 @@ void PrepareIOTreatZone(long flag) {
long Cam_Room = ARX_PORTALS_GetRoomNumForPosition(cameraPos, 1);
long PlayerRoom = ARX_PORTALS_GetRoomNumForPosition(player.pos, 1);
TREATZONE_AddIO(entities.player());

short sGlobalPlayerRoom = checked_range_cast<short>(PlayerRoom);

for(size_t i = 0; i < MAX_EQUIPED; i++) {
Entity * toequip = entities.get(player.equiped[i]);
if(toequip) {
toequip->room = sGlobalPlayerRoom;

for(EntityHandle equipment : player.equiped) {
if(Entity * toequip = entities.get(equipment)) {
toequip->room = checked_range_cast<short>(PlayerRoom);
toequip->requestRoomUpdate = false;
}
}
Expand Down

0 comments on commit 2a1e477

Please sign in to comment.