Skip to content

Commit

Permalink
notify attacked cells even if attack was not successful
Browse files Browse the repository at this point in the history
  • Loading branch information
chrxh committed Jul 14, 2023
1 parent 78b12f2 commit ecda97e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions source/EngineGpuKernels/AttackerProcessor.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ __device__ __inline__ void AttackerProcessor::processCell(SimulationData& data,
return;
}
if (!otherCell->barrier /*&& otherCell->livingState != LivingState_UnderConstruction*/) {
//notify attacked cell
if (otherCell->cellFunction != CellFunction_None) {
atomicAdd(&otherCell->activity.channels[7], 1.0f);
}

auto energyToTransfer = (atomicAdd(&otherCell->energy, 0) - cellMinEnergy) * cudaSimulationParameters.cellFunctionAttackerStrength[cell->color];
if (energyToTransfer < 0) {
return;
Expand Down Expand Up @@ -127,11 +132,6 @@ __device__ __inline__ void AttackerProcessor::processCell(SimulationData& data,
return;
}

//notify attacked cell
if (otherCell->cellFunction != CellFunction_None) {
atomicAdd(&otherCell->activity.channels[7], 1.0f);
}

someOtherCell = otherCell;
if (energyToTransfer >= 0) {
auto origEnergy = atomicAdd(&otherCell->energy, -energyToTransfer);
Expand Down

0 comments on commit ecda97e

Please sign in to comment.