From 011caf4eafd5faf1cd8c4c850467faf99ae30ae6 Mon Sep 17 00:00:00 2001 From: Flugente Date: Thu, 28 Aug 2014 01:32:53 +0000 Subject: [PATCH] Missing xml data could lead to mine income always being 0 if playing with strategic disease. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7443 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Disease.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Tactical/Disease.cpp b/Tactical/Disease.cpp index 2e18d8d1..16f121b9 100644 --- a/Tactical/Disease.cpp +++ b/Tactical/Disease.cpp @@ -715,6 +715,12 @@ FLOAT GetWorkforceEffectivenessWithDisease( INT8 bTownId, UINT8 usTeam ) // workforce effectivity in a sector is population minus cumulated effectivity loss of all infected, divided by entire population val += (population - min( pSectorInfo->usInfected, population ) * pSectorInfo->fInfectionSeverity ) / population; } + // if no population is here, then there is no part of te population that is not working, so retrun 1.0 here :-) + // this is basically a fix for players using this feature who have faulty xmls with population 0 + else + { + val += 1.0f; + } ++sectors; }