(svn r9310) [gamebalance] -Feature: Player performance now influences the wealth level of a town (albeit only on a small scale). This is the first feedback effect that the player has on the local and global economy. Please refrain from using the AI too much for the time being because it'll trash the ratings most likely.
--- a/src/town.h Sun Mar 18 17:45:27 2007 +0000
+++ b/src/town.h Mon Mar 19 09:33:17 2007 +0000
@@ -101,6 +101,41 @@
if (level < 15) return 3;
return 4;
}
+
+ /**
+ * Adjusts the activity level of a town dependent
+ * on player performance. Towns with a high share of
+ * transported passengers are increasing the EAL, those
+ * with a low share of transported passengers will
+ * see a reduction in activity. In order to not wreck
+ * new games (where no or almost no towns) are connected
+ * and thus have zero transported passengers, These
+ * will be untouched.
+ * @pre Must be called BEFORE UpdateAmounts
+ */
+ void UpdateActivity()
+ {
+ if (new_act_pass == 0 && act_pass == 0) {
+ DEBUG(eco, 7, "Town is not connected, bailing out");
+ return;
+ }
+
+ static const FixedT<int, 12> max_activity_change (1, 400);
+ static const FixedT<int, 12> min_activity_change = -max_activity_change;
+ FixedT<int, 12> activity_change (1, 200);
+
+ activity_change *= act_pass;
+ activity_change /= max_pass;
+ activity_change -= max_activity_change;
+ DEBUG(eco, 6, "Raw EAL change for town at 0x%x is %f", xy, (double)activity_change);
+
+ if (activity_change > max_activity_change) activity_change = max_activity_change;
+ if (activity_change < min_activity_change) activity_change = min_activity_change;
+
+ this->SetActivity(this->GetActivity() + activity_change);
+
+ DEBUG(eco, 5, "Modifying EAL for town at 0x%x by %f to %f", xy, (double)activity_change, (double)this->GetActivity());
+ }
};
uint32 GetWorldPopulation(void);
--- a/src/town_cmd.cpp Sun Mar 18 17:45:27 2007 +0000
+++ b/src/town_cmd.cpp Mon Mar 19 09:33:17 2007 +0000
@@ -1829,6 +1829,7 @@
if (t->exclusive_counter != 0)
if (--t->exclusive_counter == 0) t->exclusivity = INVALID_PLAYER;
+ t->UpdateActivity();
UpdateTownGrowRate(t);
UpdateTownAmounts(t);
UpdateTownUnwanted(t);