forked from mirror/OpenTTD
Codechange: Split GoodsEntry cargo and flows data to unique_ptr. (#13058)
This allows cargo packets and cargo flow data to be empty if not in use, which is the case for the majority of station goods entries, and data is allocated when needed. This reduces the initial size of a Station from 9192 bytes to 2024 bytes (on 64 bit platforms), although an allocation of 120 bytes is made for each active cargo type at a station. Based on similar changes in JGRPP.
This commit is contained in:
@@ -1387,7 +1387,7 @@ static void MaybeCrashAirplane(Aircraft *v)
|
||||
/* Crash the airplane. Remove all goods stored at the station. */
|
||||
for (GoodsEntry &ge : st->goods) {
|
||||
ge.rating = 1;
|
||||
ge.cargo.Truncate();
|
||||
if (ge.HasData()) ge.GetData().cargo.Truncate();
|
||||
}
|
||||
|
||||
CrashAirplane(v);
|
||||
|
Reference in New Issue
Block a user