From 64c71f5136f215fada5969b7a674a14e16c396f8 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sun, 5 Aug 2018 11:32:05 +0100 Subject: [PATCH] Add recalculated total to AssertCountConsistency assertion message --- src/cargopacket.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/cargopacket.h b/src/cargopacket.h index ed2047cb11..4342ed5764 100644 --- a/src/cargopacket.h +++ b/src/cargopacket.h @@ -309,6 +309,15 @@ protected: template void PopCargo(Taction action); + inline uint RecalculateCargoTotal() const + { + uint total = 0; + for (const auto &cp : this->packets) { + total += cp->Count(); + } + return total; + } + public: /** @@ -320,12 +329,14 @@ public: this->action_counts[MTA_DELIVER] + this->action_counts[MTA_TRANSFER] + this->action_counts[MTA_LOAD] == this->count, - "%u + %u + %u + %u != %u", + "%u + %u + %u + %u != %u, (%u in %u packets)", this->action_counts[MTA_KEEP], this->action_counts[MTA_DELIVER], this->action_counts[MTA_TRANSFER], this->action_counts[MTA_LOAD], - this->count); + this->count, + this->RecalculateCargoTotal(), + (uint) this->packets.size()); } protected: