summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-05-03 11:19:17 +0000
committerpeter1138 <peter1138@openttd.org>2006-05-03 11:19:17 +0000
commita364ec2397c234029b7b35dc904f5f9634893343 (patch)
treef2448ec6140204730fdba7486c52ea60c850924b
parent744e917c34d600e31694908f29b9b712ccba8bc6 (diff)
downloadopenttd-a364ec2397c234029b7b35dc904f5f9634893343.tar.xz
(svn r4707) - NewGRF: minor code duffage; return early and less indentation.
-rw-r--r--newgrf_station.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/newgrf_station.c b/newgrf_station.c
index 657b310e1..4bc410dd8 100644
--- a/newgrf_station.c
+++ b/newgrf_station.c
@@ -264,28 +264,27 @@ int AllocateSpecToStation(const StationSpec *statspec, Station *st, bool exec)
if (st->speclist[i].spec == NULL && st->speclist[i].grfid == 0) break;
}
- if (i < 256) {
- if (exec) {
- if (i >= st->num_specs) {
- st->num_specs = i + 1;
- st->speclist = realloc(st->speclist, st->num_specs * sizeof(*st->speclist));
-
- if (st->num_specs == 2) {
- /* Initial allocation */
- st->speclist[0].spec = NULL;
- st->speclist[0].grfid = 0;
- st->speclist[0].localidx = 0;
- }
+ if (i == 256) return -1;
+
+ if (exec) {
+ if (i >= st->num_specs) {
+ st->num_specs = i + 1;
+ st->speclist = realloc(st->speclist, st->num_specs * sizeof(*st->speclist));
+
+ if (st->num_specs == 2) {
+ /* Initial allocation */
+ st->speclist[0].spec = NULL;
+ st->speclist[0].grfid = 0;
+ st->speclist[0].localidx = 0;
}
-
- st->speclist[i].spec = statspec;
- st->speclist[i].grfid = statspec->grfid;
- st->speclist[i].localidx = statspec->localidx;
}
- return i;
+
+ st->speclist[i].spec = statspec;
+ st->speclist[i].grfid = statspec->grfid;
+ st->speclist[i].localidx = statspec->localidx;
}
- return -1;
+ return i;
}