Decoded: OpenTTD (2003) v1.8 (2018) Source file: pool_func.cpp Line-by-line code walkthrough by MaiZure pool_func.cpp defines memory pool base type functions Original code: https://github.com/MaiZure/OpenTTD-1.8/blob/master/src/core/pool_func.hpp 1 COMMENT (*) 2 BLANK (-) 3 * 4 * 5 * 6 * 7 * 8 * 9 - 10 * 11 - 12 Includes the OpenTTD platform-specific header 13 Includes the OpenTTD memory pool header 14 - 15 Includes the OpenTTD safeguards header 16 - 17 * 18 * 19 * 20 * 21 Defines PoolBase destructor 22 BLOCK START - PoolBase destructor, removes this object and possibly the whole vector 23 Initializes a local pointer to the global memory pool vector 24 Removes this pool instance from the global vector 25 If this is the last pool, remove the vector too 26 BLOCK END - PoolBase 27 - 28 * 29 * 30 * 31 * 32 Defines PoolBase::Clean with one argument for the memory pool type 33 BLOCK START - PoolBase::Clean, calls type-specific Clean method for pools of matching types 34 Initializes a local pointer to the global memory pool vector 35 Initializes a local pointer to the last pool in memory 36 Begins a loop across the global memory pool vector of all types 37 Gets a local pointer to the current pool we're iterating over 38 If the types match -- call pool-specific CleanPool function 39 Redo loop until all pools tested 40 BLOCK END - PoolBase::Clean