MCPcopy Create free account
hub / github.com/Norbyte/ositools / AddDamage

Method AddDamage

OsiInterface/DivInterface.cpp:546–571  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

544
545
546 void DamagePairList::AddDamage(DamageType DamageType, int32_t Amount)
547 {
548 bool added{ false };
549 for (uint32_t i = 0; i < Size; i++) {
550 if (Buf[i].DamageType == DamageType) {
551 auto newAmount = Buf[i].Amount + Amount;
552 if (newAmount == 0) {
553 Remove(i);
554 } else {
555 Buf[i].Amount += newAmount;
556 }
557
558 added = true;
559 break;
560 }
561 }
562
563 if (!added && Amount != 0) {
564 TDamagePair dmg;
565 dmg.DamageType = DamageType;
566 dmg.Amount = Amount;
567 if (!SafeAdd(dmg)) {
568 OsiError("DamageList capacity exceeded!");
569 }
570 }
571 }
572
573
574

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected