@@ -105,7 +105,7 @@ void GoodMarket::execute_orders(
105105 max_affordable_price = affordable_price;
106106 }
107107
108- demand_sum += buy_up_to_order.get_max_quantity () ;
108+ demand_sum += buy_up_to_order.max_quantity ;
109109 buy_up_to_order.call_after_trade (BuyResult::no_purchase_result (good_definition));
110110 }
111111
@@ -123,11 +123,11 @@ void GoodMarket::execute_orders(
123123 IndexedFlatMap<CountryInstance, fixed_point_t >& supply_per_country = reusable_country_map_0;
124124 IndexedFlatMap<CountryInstance, fixed_point_t >& actual_bought_per_country = reusable_country_map_1;
125125 for (GoodMarketSellOrder const & market_sell_order : market_sell_orders) {
126- CountryInstance const * const country_nullable = market_sell_order.get_country_nullable () ;
126+ CountryInstance const * const country_nullable = market_sell_order.country_nullable ;
127127 if (country_nullable != nullptr ) {
128- supply_per_country.at (*country_nullable) += market_sell_order.get_quantity () ;
128+ supply_per_country.at (*country_nullable) += market_sell_order.quantity ;
129129 }
130- supply_sum += market_sell_order.get_quantity () ;
130+ supply_sum += market_sell_order.quantity ;
131131 }
132132 memory::vector<fixed_point_t >& quantity_bought_per_order = reusable_vectors[0 ];
133133 memory::vector<fixed_point_t >& purchasing_power_per_order = reusable_vectors[1 ];
@@ -139,8 +139,8 @@ void GoodMarket::execute_orders(
139139 fixed_point_t purchasing_power_sum = 0 ;
140140 for (size_t i = 0 ; i < buy_up_to_orders.size (); i++) {
141141 GoodBuyUpToOrder const & buy_up_to_order = buy_up_to_orders[i];
142- const fixed_point_t max_quantity = buy_up_to_order.get_max_quantity () ;
143- const fixed_point_t money_to_spend = buy_up_to_order.get_money_to_spend () ;
142+ const fixed_point_t max_quantity = buy_up_to_order.max_quantity ;
143+ const fixed_point_t money_to_spend = buy_up_to_order.money_to_spend ;
144144
145145 if (game_rules_manager.get_use_optimal_pricing ()) {
146146 const fixed_point_t affordable_price = buy_up_to_order.get_affordable_price ();
@@ -185,13 +185,13 @@ void GoodMarket::execute_orders(
185185 someone_bought_max_quantity = false ;
186186 for (size_t i = 0 ; i < buy_up_to_orders.size (); i++) {
187187 GoodBuyUpToOrder const & buy_up_to_order = buy_up_to_orders[i];
188- const fixed_point_t max_quantity = buy_up_to_order.get_max_quantity () ;
188+ const fixed_point_t max_quantity = buy_up_to_order.max_quantity ;
189189 fixed_point_t & distributed_supply = quantity_bought_per_order[i];
190190 if (distributed_supply == max_quantity) {
191191 continue ;
192192 }
193193
194- CountryInstance const * const country_nullable = buy_up_to_order.get_country_nullable () ;
194+ CountryInstance const * const country_nullable = buy_up_to_order.country_nullable ;
195195 if (country_nullable != nullptr ) {
196196 // subtract as it might be updated below
197197 actual_bought_per_country.at (*country_nullable) -= distributed_supply;
@@ -247,14 +247,14 @@ void GoodMarket::execute_orders(
247247
248248 for (size_t i = 0 ; i < buy_up_to_orders.size (); i++) {
249249 GoodBuyUpToOrder const & buy_up_to_order = buy_up_to_orders[i];
250- if (quantity_bought_per_order[i] == buy_up_to_order.get_max_quantity () ) {
250+ if (quantity_bought_per_order[i] == buy_up_to_order.max_quantity ) {
251251 continue ;
252252 }
253253
254- if (buy_up_to_order.get_money_to_spend () >= new_price * buy_up_to_order.get_max_quantity () ) {
255- quantity_bought_per_order[i] = buy_up_to_order.get_max_quantity () ;
256- remaining_supply -= buy_up_to_order.get_max_quantity () ;
257- money_left_to_spend_sum -= buy_up_to_order.get_money_to_spend () ;
254+ if (buy_up_to_order.money_to_spend >= new_price * buy_up_to_order.max_quantity ) {
255+ quantity_bought_per_order[i] = buy_up_to_order.max_quantity ;
256+ remaining_supply -= buy_up_to_order.max_quantity ;
257+ money_left_to_spend_sum -= buy_up_to_order.money_to_spend ;
258258 }
259259 }
260260 }
@@ -274,11 +274,11 @@ void GoodMarket::execute_orders(
274274 const fixed_point_t quantity_bought
275275 = quantity_bought_per_order[i]
276276 = std::min (
277- buy_up_to_order.get_max_quantity () ,
278- buy_up_to_order.get_money_to_spend () / new_price
277+ buy_up_to_order.max_quantity ,
278+ buy_up_to_order.money_to_spend / new_price
279279 );
280280
281- CountryInstance const * const country_nullable = buy_up_to_order.get_country_nullable () ;
281+ CountryInstance const * const country_nullable = buy_up_to_order.country_nullable ;
282282 if (country_nullable != nullptr ) {
283283 actual_bought_per_country.at (*country_nullable) += quantity_bought_per_order[i];
284284 }
@@ -300,7 +300,7 @@ void GoodMarket::execute_orders(
300300 if (quantity_traded_yesterday == supply_sum) {
301301 // everything was sold
302302 for (GoodMarketSellOrder const & market_sell_order : market_sell_orders) {
303- const fixed_point_t quantity_sold = market_sell_order.get_quantity () ;
303+ const fixed_point_t quantity_sold = market_sell_order.quantity ;
304304 fixed_point_t money_gained;
305305 if (quantity_sold == 0 ) {
306306 money_gained = 0 ;
@@ -331,21 +331,21 @@ void GoodMarket::execute_orders(
331331 const fixed_point_t total_quantity_traded_as_export = quantity_traded_yesterday - total_quantity_traded_domestically;
332332 const fixed_point_t total_quantity_offered_as_export = supply_sum - total_quantity_traded_domestically;
333333 for (GoodMarketSellOrder const & market_sell_order : market_sell_orders) {
334- const fixed_point_t quantity_offered = market_sell_order.get_quantity () ;
334+ const fixed_point_t quantity_offered = market_sell_order.quantity ;
335335
336336 fixed_point_t quantity_sold_domestically;
337337 fixed_point_t quantity_offered_as_export;
338- CountryInstance const * const country_nullable = market_sell_order.get_country_nullable () ;
338+ CountryInstance const * const country_nullable = market_sell_order.country_nullable ;
339339 if (country_nullable == nullptr ) {
340340 quantity_sold_domestically = 0 ;
341341 quantity_offered_as_export = quantity_offered;
342342 } else {
343343 const fixed_point_t total_bought_domestically = actual_bought_per_country.at (*country_nullable);
344344 const fixed_point_t total_domestic_supply = supply_per_country.at (*country_nullable);
345345 quantity_sold_domestically = total_bought_domestically >= total_domestic_supply
346- ? market_sell_order. get_quantity ()
346+ ? quantity_offered
347347 : fixed_point_t::mul_div (
348- market_sell_order. get_quantity () ,
348+ quantity_offered ,
349349 total_bought_domestically,
350350 total_domestic_supply // > 0 as we're selling
351351 );
@@ -417,7 +417,7 @@ void GoodMarket::execute_buy_orders(
417417 );
418418
419419 fixed_point_t money_spent_on_imports;
420- CountryInstance const * const country_nullable = buy_up_to_order.get_country_nullable () ;
420+ CountryInstance const * const country_nullable = buy_up_to_order.country_nullable ;
421421 if (country_nullable == nullptr ) {
422422 // could be trade between native Americans and tribal Africa, so it's all imported
423423 money_spent_on_imports = money_spent_total;
0 commit comments