is_ot_type checks if a given overmap id is of a given type by comparing string ids directly (this part is tolerable) and then, if it fails, by checking if part of the id before first underscore matches the entire second id.
That is, is_ot_type( "road", "road_ns" ) == true because "road_ns" without the part after underscore is just "road".
This type of a check is horrible to maintain and extend and should be changed into at the very least direct id checks. Where that isn't possible (few mapgen entries), a group of ids should be given a flag to represent their grouping.
Just to point it out, the even better solution is to add an explicit overmap tile flyweight object that can hold attributes of a particular tile instead of encoding them in the ID. That requires significantly more infrastructure, but brings these objects to parity with most other game objects.
I was making gradual steps towards getting rid of this kind of check. It's not only messy, it's quite slow.
See #19518: 30% boost was gained due to reducing the number of such string comparisons.
Kevin's suggestion is already partially implemented: we have oter_t and oter_type_t (where oter_type_t is a flyweight).
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not \'bump\' or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.
This issue has been automatically closed due to lack of activity. This does not mean that we do not value the issue. Feel free to request that it be re-opened if you are going to actively work on it
Most helpful comment
I was making gradual steps towards getting rid of this kind of check. It's not only messy, it's quite slow.
See #19518: 30% boost was gained due to reducing the number of such string comparisons.
Kevin's suggestion is already partially implemented: we have
oter_tandoter_type_t(whereoter_type_tis a flyweight).