Time Nick Message 19:34 lhofhansl Hi... Will merge #16931 soon (trivial and slight client performance change) 19:34 ShadowBot https://github.com/luanti-org/luanti/issues/16931 -- Avoid a copy of block pointers in client timer update by lhofhansl 19:35 lhofhansl Maybe a related change is possible on the server (in a different PR) 19:44 lhofhansl Done 19:50 Krock lhofhansl: why do you need the const_cast at all? 20:01 lhofhansl The direct access to the sectors block is only allowed for const sectors. In the second loop the sectors are modified (blocks get removed) and so there it needs to be non-const. 20:03 lhofhansl ... sector's block... :) 20:05 Krock > This is explicitly only allowed on a const object since modifying anything while iterating is unsafe. 20:07 Krock so if the returned container could be made constant but not its MapBlock value, that would be technically the best solution 20:07 Krock since it addresses both concerns 20:08 lhofhansl Yes. That would be better, indeed. 20:08 sfan5 it's casting the sector, not the block 20:09 sfan5 but I suppose the TimeOrderedMapBlock() constructor could take a const sector 20:10 lhofhansl When I added that API while back, I forced this to be a const method for safety. I can try casting the returned collection to const so that I cannot be modified. 20:10 Krock unfortunately "b.sect->deleteBlock(block);" cannot be made const 20:11 lhofhansl In thise case TimeOrderedMapBlock needs a non-const sector, because it is later used to call non-const methods that modify it's block collection. 20:15 lhofhansl Actually, no. Not the collection, but the Sector must be const. The Sector needs to be const, so that it is safe to use the returned collection. I think the API is good the way it is. (Of course there might other pointers to the same sector. but that's a different problem). 20:23 rubenwardy Anyone able to give this a second review please https://github.com/luanti-org/luanti/pull/14543 20:46 Krock what happens if two games claim to be an alias? 20:46 Krock ( .. of the same game?) 20:46 Krock nvm. pkgmgr.find_by_gameid logs a warning