Skip to content

Commit

Permalink
Merge pull request Atlantis-PBEM#25 from snowgoon88/fix_edit_g
Browse files Browse the repository at this point in the history
Fix edit region terrain and then g key
  • Loading branch information
sgb authored Jun 27, 2016
2 parents 5317f86 21cae84 commit 22af9a9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions economy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 280,12 @@ void ARegion::SetIncome()
int maxwages = (int) ((float) (pp * (Wages() - 10 * Globals->MAINTENANCE_COST) /50));
if (maxwages < 0) maxwages = 0;
Production * w = products.GetProd(I_SILVER,-1);
// In some cases (ie. after products.DeleteAll() in EditGameRegionTerrain)
// I_SILVER is not in ProductionList
if( !w ) {
w = new Production;
products.Add(w);
}
w->itemtype = I_SILVER;
w->amount = maxwages / Globals->WORK_FRACTION;
w->baseamount = maxwages / Globals->WORK_FRACTION;
Expand All @@ -296,6 302,12 @@ void ARegion::SetIncome()
int maxent = (int) ((float) (ep * ((Wages() - 10 * Globals->MAINTENANCE_COST) 10) /50));
if (maxent < 0) maxent = 0;
Production * e = products.GetProd(I_SILVER,S_ENTERTAINMENT);
// In some cases (ie. after products.DeleteAll() in EditGameRegionTerrain)
// I_SILVER is not in ProductionList
if( !e ) {
e = new Production;
products.Add(e);
}
e->itemtype = I_SILVER;
e->amount = maxent / Globals->ENTERTAIN_FRACTION;
e->baseamount = maxent / Globals->ENTERTAIN_FRACTION;
Expand Down

0 comments on commit 22af9a9

Please sign in to comment.