/// <summary> /// Do checks outside. Currently sends only to 1 market /// </summary> public void SendToMarket(Storage what) { var market = Market.GetReachestMarket(what); if (market == null) { market = Country.market; } sentToMarket.Add(market, what); storage.subtract(what); market.ReceiveProducts(what); //if (Game.logMarket) // Debug.Log(this + " sent to market " + what + " costing " + Country.market.getCost(what)); }
//public Storage getSentToMarket(Product product) //{ // return sentToMarket.GetFirstSubstituteStorage(product); //} /// <summary> Assuming product is abstract product</summary> //public Storage getSentToMarketIncludingSubstituts(Product product) //{ // var res = new Value(0f); // foreach (var item in product.getSubstitutes()) // if (item.isTradable()) // { // res.Add(sentToMarket.GetFirstSubstituteStorage(item)); // } // return new Storage(product, res); //} /// <summary> /// Do checks outside /// </summary> public void SendToMarket(Storage what) { var market = Market.GetReachestMarket(what); if (market == null) { market = Country.market; } sentToMarket.Add(new KeyValuePair <Market, Storage>(market, what)); //countryStorageSet.subtract(what); countryStorageSet.subtractNoStatistic(what); // to avoid getting what in "howMuchUsed" statistics market.ReceiveProducts(what); }