(svn r9165) [gamebalance] -Add: Towns now have different levels of wealth. Alas, it doesn't have any influence either up to now gamebalance
authorcelestar
Wed, 14 Mar 2007 10:00:56 +0000
branchgamebalance
changeset 9889 cfd2278f9099
parent 9888 7cf72895ca8c
child 9890 37b56728c471
(svn r9165) [gamebalance] -Add: Towns now have different levels of wealth. Alas, it doesn't have any influence either up to now
src/economy_new.cpp
src/town.h
src/town_cmd.cpp
--- a/src/economy_new.cpp	Tue Mar 13 22:03:23 2007 +0000
+++ b/src/economy_new.cpp	Wed Mar 14 10:00:56 2007 +0000
@@ -22,7 +22,7 @@
 
 	FOR_ALL_TOWNS(t) {
 		total_activity += (t->GetActivity() * t->population * m_activity_level);
-		DEBUG(eco, 6, "Obtained EAL of %f, total %f", (double)t->GetActivity());
+		DEBUG(eco, 6, "Obtained EAL of %f", (double)t->GetActivity());
 	}
 
 	DEBUG(eco, 5, "Global EAL is             %f", (double)m_activity_level * GetWorldPopulation());
--- a/src/town.h	Tue Mar 13 22:03:23 2007 +0000
+++ b/src/town.h	Wed Mar 14 10:00:56 2007 +0000
@@ -88,7 +88,7 @@
 	template <typename T>
 	void SetActivity(T level)
 	{
-		DEBUG(eco, 7, "Setting EAL of town %d [0x%x], to %f", index, xy, (double)level);
+		DEBUG(eco, 7, "Setting EAL of town %d [0x%x] to %f", index, xy, (double)level);
 		m_activity_level = level;
 	}
 };
--- a/src/town_cmd.cpp	Tue Mar 13 22:03:23 2007 +0000
+++ b/src/town_cmd.cpp	Wed Mar 14 10:00:56 2007 +0000
@@ -962,9 +962,22 @@
 	t->exclusive_counter = 0;
 	t->statues = 0;
 
-	FixedT<int32, 16> activity = 1;
+	FixedT<int32, 12> activity;
+	int r = InteractiveRandom() % 20;
+	switch (r) {
+		case 0:                    /* A very poor town */
+			activity =  5 + RandomRange(2); break;
+		case 1: case 2: case 3:    /* A poor town */
+			activity =  7 + RandomRange(2); break;
+		case 16: case 17: case 18: /* A rich town */
+			activity = 12 + RandomRange(3); break;
+		case 19:                   /* A very rich town */
+			activity = 14 + RandomRange(6); break;
+		default:                   /* normal towns */
+			activity =  9 + RandomRange(3); break;
+	}
 
-	t->SetActivity(activity);
+	t->SetActivity(activity / 10);
 	t->townnametype = SPECSTR_TOWNNAME_START + _opt.town_name;
 	t->townnameparts = townnameparts;