(svn r12889) [NewGRF_ports] -Change: Optimise before commit ;) NewGRF_ports
authorrichk
Fri, 25 Apr 2008 02:12:41 +0000
branchNewGRF_ports
changeset 10348 a9b20fd61175
parent 10347 63399f8b90bc
child 10349 ff900a23e102
(svn r12889) [NewGRF_ports] -Change: Optimise before commit ;)
src/newgrf_fsmports.cpp
--- a/src/newgrf_fsmports.cpp	Fri Apr 25 01:56:20 2008 +0000
+++ b/src/newgrf_fsmports.cpp	Fri Apr 25 02:12:41 2008 +0000
@@ -611,22 +611,7 @@
 
 	if (i < MAX_SPECLIST) {
 		/* This specindex is no longer in use, so deallocate it */
-		st->fsmportsspeclist[i].spec     = NULL;
-		st->fsmportsspeclist[i].grfid    = 0;
-		st->fsmportsspeclist[i].localidx = 0;
-
-		/* If this was the highest spec index, reallocate */
-		if (i == st->num_fsmportsspecs - 1) {
-			for (; st->fsmportsspeclist[st->num_fsmportsspecs - 1].grfid == 0 && st->num_fsmportsspecs > 1; st->num_fsmportsspecs--);
-
-			if (st->num_specs > 1) {
-				st->fsmportsspeclist = ReallocT(st->fsmportsspeclist, st->num_fsmportsspecs);
-			} else {
-				free(st->fsmportsspeclist);
-				st->num_fsmportsspecs = 0;
-				st->fsmportsspeclist  = NULL;
-			}
-		}
+		DeallocateSpecFromFSMports(st, i);
 	}
 }