X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/9e8281bc8ffdbb5555ee6082a3de0db421b092c0..39c6313308afb248b140d98b8052f1b484549df2:/projects/stargazer/user_impl.cpp?ds=sidebyside diff --git a/projects/stargazer/user_impl.cpp b/projects/stargazer/user_impl.cpp index 6aca9cea..733e6256 100644 --- a/projects/stargazer/user_impl.cpp +++ b/projects/stargazer/user_impl.cpp @@ -484,7 +484,7 @@ for (int i = 0; i < DIR_NUM; i++) enabledDirs[i] = dirs & (1 << i); } -if (authorizedBy.size()) +if (!authorizedBy.empty()) { if (currIP != ip) { @@ -1243,11 +1243,11 @@ switch (settings->GetFeeChargeType()) property.cash.Set(c - fee, sysAdmin, login, store, "Subscriber fee charge"); break; case 1: - if (c > 0) + if (c + credit >= 0) property.cash.Set(c - fee, sysAdmin, login, store, "Subscriber fee charge"); break; case 2: - if (c > fee) + if (c + credit >= fee) property.cash.Set(c - fee, sysAdmin, login, store, "Subscriber fee charge"); break; } @@ -1285,8 +1285,10 @@ if (fee == 0.0) } double c = cash; -printfd(__FILE__, "login: %8s Fee=%f PassiveTimePart=%f fee=%f\n", +printfd(__FILE__, "login: %8s Cash=%f Credit=%f Fee=%f PassiveTimePart=%f fee=%f\n", login.c_str(), + cash.ConstData(), + credit.ConstData(), tariff->GetFee(), passiveTimePart, fee); @@ -1297,14 +1299,14 @@ switch (settings->GetFeeChargeType()) SetPrepaidTraff(); break; case 1: - if (c > 0) + if (c + credit >= 0) { property.cash.Set(c - fee, sysAdmin, login, store, "Subscriber fee charge"); SetPrepaidTraff(); } break; case 2: - if (c > fee) + if (c + credit >= fee) { property.cash.Set(c - fee, sysAdmin, login, store, "Subscriber fee charge"); SetPrepaidTraff();