* ResolverObject (re)entry point. * This cannot be made a call to a virtual function because virtual functions * do not like nullptr and checking for nullptr *everywhere* is more cumbersome than * this little helper function. * @param group the group to resolve for * @param object information needed to resolve the group * @param top_level true if this is a top-level SpriteGroup, false if use
| 32 | * @return the resolved group |
| 33 | */ |
| 34 | /* static */ ResolverResult SpriteGroup::Resolve(const SpriteGroup *group, ResolverObject &object, bool top_level) |
| 35 | { |
| 36 | if (group == nullptr) return std::monostate{}; |
| 37 | |
| 38 | const GRFFile *grf = object.grffile; |
| 39 | auto profiler = std::ranges::find(_newgrf_profilers, grf, &NewGRFProfiler::grffile); |
| 40 | |
| 41 | if (profiler == _newgrf_profilers.end() || !profiler->active) { |
| 42 | return group->Resolve(object); |
| 43 | } else if (top_level) { |
| 44 | profiler->BeginResolve(object); |
| 45 | auto result = group->Resolve(object); |
| 46 | profiler->EndResolve(result); |
| 47 | return result; |
| 48 | } else { |
| 49 | profiler->RecursiveResolve(); |
| 50 | return group->Resolve(object); |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | static inline uint32_t GetVariable(const ResolverObject &object, ScopeResolver *scope, uint8_t variable, uint32_t parameter, bool &available) |
| 55 | { |
no test coverage detected