]> git.stg.codes - stg.git/blobdiff - projects/stargazer/tariff_impl.cpp
Ticket 26. The const MODULE_SETTINGS & ms parameter added to the
[stg.git] / projects / stargazer / tariff_impl.cpp
index 63164a27bd634f7bf8dd2d48d2a17553f09d3406..c6785cead85c26f71ea5e273014f0d71428a8d5f 100644 (file)
 #include "stg_timer.h"
 
 //-----------------------------------------------------------------------------
-TARIFF & TARIFF_IMPL::operator=(const TARIFF_DATA & td)
+TARIFF_IMPL & TARIFF_IMPL::operator=(const TARIFF_DATA & td)
 {
 tariffData = td;
 return *this;
 }
 //-----------------------------------------------------------------------------
-TARIFF & TARIFF_IMPL::operator=(const TARIFF & t)
+TARIFF_IMPL & TARIFF_IMPL::operator=(const TARIFF_IMPL & t)
 {
-tariffData = t.GetTariffData();
+tariffData = t.tariffData;
 return *this;
 }
 //-----------------------------------------------------------------------------
@@ -119,7 +119,7 @@ else
     }
 }
 //-----------------------------------------------------------------------------
-double TARIFF_IMPL::GetPriceWithoutFreeMb(int dir, int mb, time_t t) const
+double TARIFF_IMPL::GetPriceWithoutFreeMb(int dir, int64_t mb, time_t t) const
 {
 int interval = Interval(dir, t);
 
@@ -143,45 +143,5 @@ else if (!sp && th)
     return tariffData.dirPrice[dir].priceNightA;
 else
     return tariffData.dirPrice[dir].priceDayA;
-
-/*if (tariffData.dirPrice[dir].noDiscount && tariffData.dirPrice[dir].singlePrice)
-    {
-    return tariffData.dirPrice[dir].priceDayA;
-    }
-else
-    {
-    if (tariffData.dirPrice[dir].noDiscount)
-        {
-        // Without threshold
-        if (interval == TARIFF_DAY)
-            return tariffData.dirPrice[dir].priceDayA;
-        else
-            return tariffData.dirPrice[dir].priceNightA;
-        }
-
-    if (tariffData.dirPrice[dir].singlePrice)
-        {
-        // Without day/night
-        if (mb < tariffData.dirPrice[dir].threshold)
-            return tariffData.dirPrice[dir].priceDayA;
-        else
-            return tariffData.dirPrice[dir].priceDayB;
-        }
-
-    if (mb < tariffData.dirPrice[dir].threshold)
-        {
-        if (interval == TARIFF_DAY)
-            return tariffData.dirPrice[dir].priceDayA;
-        else
-            return tariffData.dirPrice[dir].priceNightA;
-        }
-    else
-        {
-        if (interval == TARIFF_DAY)
-            return tariffData.dirPrice[dir].priceDayB;
-        else
-            return tariffData.dirPrice[dir].priceNightB;
-        }
-    }*/
 }
 //-----------------------------------------------------------------------------