H-uru / Plasma

Cyan Worlds's Plasma game engine
http://h-uru.github.io/Plasma/
GNU General Public License v3.0
203 stars 80 forks source link

Port plVaultClientApi to standard C++ containers #1468

Closed dgelessus closed 11 months ago

dgelessus commented 1 year ago

Here I go, touching more important and complex code - what could go wrong?

More seriously, this makes the vault logic a bit more readable and less complex, because it eliminates some manual memory management and wrapper structs. Some of the code is still quite verbose though, because of how the C++ map API is designed.

This eliminates the last use of the weird custom intrusive hash table pnUtHash (aka HASHTABLEDECL/HASHLINK).

dgelessus commented 1 year ago

I wonder... considering that all RelVaultNodes are stored in a big global map, perhaps it would be possible to have that be the owner of all RelVaultNodes and skip the dynamic refcounting. No idea how well that would interact with the rest of the codebase though. In any case, that's not something I'll try in this PR 😅

Hoikas commented 1 year ago

I think that would be ideal (in another PR), but we'd want to make sure that pyVaultNode would be able to cope with that. I think that, strictly speaking, it is possible for Python scripts to persist after an Age's vault nodes have been culled, so we would probably be forced into maintaining a reference count for vault nodes.