X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/blobdiff_plain/b4d90a50ce65a5efb75c0a28b269120ea51d57cf..5f6e6cd0b35a54b63928307bed66047235500ad6:/process.cpp diff --git a/process.cpp b/process.cpp index 97f2a69..b5531b0 100644 --- a/process.cpp +++ b/process.cpp @@ -421,7 +421,11 @@ void process::data_send(neighbor& nb) else excess_load = real_load; - double balance = nb.get_debt() - nb.get_credit(); + double balance; + if (nb.get_credit() > 0.0) + balance = nb.get_debt() - nb.get_credit(); + else + balance = nb.get_debt(); load_to_send = std::min(excess_load, std::max(0.0, balance));