MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / EndResolve

Method EndResolve

src/newgrf_profiling.cpp:63–93  ·  view source on GitHub ↗

* Capture the completion of a sprite group resolution. */

Source from the content-addressed store, hash-verified

61 * Capture the completion of a sprite group resolution.
62 */
63void NewGRFProfiler::EndResolve(const ResolverResult &result)
64{
65 using namespace std::chrono;
66 this->cur_call.time = (uint32_t)time_point_cast<microseconds>(high_resolution_clock::now()).time_since_epoch().count() - this->cur_call.time;
67
68 struct visitor {
69 uint32_t operator()(std::monostate)
70 {
71 return 0;
72 }
73 uint32_t operator()(CallbackResult cb_result)
74 {
75 return cb_result;
76 }
77 uint32_t operator()(const ResultSpriteGroup *group)
78 {
79 return group == nullptr ? 0 : GetSpriteLocalID(group->sprite);
80 }
81 uint32_t operator()(const TileLayoutSpriteGroup *group)
82 {
83 return group == nullptr ? 0 : group->nfo_line;
84 }
85 uint32_t operator()(const IndustryProductionSpriteGroup *group)
86 {
87 return group == nullptr ? 0 : group->nfo_line;
88 }
89 };
90 this->cur_call.result = std::visit(visitor{}, result);
91
92 this->calls.push_back(this->cur_call);
93}
94
95/**
96 * Capture a recursive sprite group resolution.

Callers 1

ResolveMethod · 0.80

Calls 3

nowClass · 0.85
push_backMethod · 0.80
countMethod · 0.45

Tested by

no test coverage detected