src/town_cmd.cpp
branchNewGRF_ports
changeset 6800 6c09e1e86fcb
parent 6743 cabfaa4a0295
child 6868 7eb395287b3d
--- a/src/town_cmd.cpp	Sun Aug 12 18:18:48 2007 +0000
+++ b/src/town_cmd.cpp	Sun Aug 12 18:32:47 2007 +0000
@@ -47,11 +47,16 @@
 
 Town::Town(TileIndex tile)
 {
+	if (tile != 0) _total_towns++;
 	this->xy = tile;
 }
 
 Town::~Town()
 {
+	DeleteName(this->townnametype);
+
+	if (CleaningPool()) return;
+
 	Industry *i;
 
 	/* Delete town authority window
@@ -86,15 +91,9 @@
 
 	MarkWholeScreenDirty();
 
-	this->QuickFree();
 	this->xy = 0;
 }
 
-void Town::QuickFree()
-{
-	DeleteName(this->townnametype);
-}
-
 // Local
 static int _grow_town_result;
 
@@ -1354,8 +1353,6 @@
 	extern int _nb_orig_names;
 	int x, i;
 
-	_total_towns++;
-
 	t->xy = tile;
 	t->num_houses = 0;
 	t->time_until_rebuild = 10;
@@ -2292,8 +2289,8 @@
 	Subsidy *s;
 
 	/* Clean the town pool and create 1 block in it */
-	CleanPool(&_Town_pool);
-	AddBlockToPool(&_Town_pool);
+	_Town_pool.CleanPool();
+	_Town_pool.AddBlockToPool();
 
 	memset(_subsidies, 0, sizeof(_subsidies));
 	for (s=_subsidies; s != endof(_subsidies); s++)