# HG changeset patch # User peter1138 # Date 1162988234 0 # Node ID 2d577061b0ec796f13db0dc42fd5d6b21b07c0af # Parent dbded6ba1f916ace0854b91f49d0e577bc4648a1 (svn r7113) -Codechange: [NewStations] Add support for copying custom station layouts diff -r dbded6ba1f91 -r 2d577061b0ec newgrf.c --- a/newgrf.c Wed Nov 08 10:09:46 2006 +0000 +++ b/newgrf.c Wed Nov 08 12:17:14 2006 +0000 @@ -952,6 +952,8 @@ FOR_EACH_OBJECT { StationSpec *statspec = _cur_grffile->stations[stid + i]; + statspec->copied_layouts = false; + while (buf < *bufp + len) { byte length = grf_load_byte(&buf); byte number = grf_load_byte(&buf); @@ -1001,11 +1003,16 @@ break; case 0x0F: /* Copy custom layout */ - /* TODO */ FOR_EACH_OBJECT { - grf_load_byte(&buf); + StationSpec *statspec = _cur_grffile->stations[stid + i]; + byte srcid = grf_load_byte(&buf); + const StationSpec *srcstatspec = _cur_grffile->stations[srcid]; + + statspec->lengths = srcstatspec->lengths; + statspec->platforms = srcstatspec->platforms; + statspec->layouts = srcstatspec->layouts; + statspec->copied_layouts = true; } - ret = true; break; case 0x10: /* Little/lots cargo threshold */ diff -r dbded6ba1f91 -r 2d577061b0ec newgrf_station.h --- a/newgrf_station.h Wed Nov 08 10:09:46 2006 +0000 +++ b/newgrf_station.h Wed Nov 08 12:17:14 2006 +0000 @@ -67,6 +67,7 @@ byte lengths; byte *platforms; StationLayout **layouts; + bool copied_layouts; /** * NUM_GLOBAL_CID sprite groups.