mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 14:27:16 +00:00
(svn r4707) - NewGRF: minor code duffage; return early and less indentation.
This commit is contained in:
parent
36d1e4a1a1
commit
102ca98c1c
@ -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 (i == 256) return -1;
|
||||
|
||||
if (st->num_specs == 2) {
|
||||
/* Initial allocation */
|
||||
st->speclist[0].spec = NULL;
|
||||
st->speclist[0].grfid = 0;
|
||||
st->speclist[0].localidx = 0;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user