Rework Class Creature, Cylinder and Item from Raw Pointer to Smart Pointer
- Change from Raw Pointer to Smart Pointer (Shared Pointer in this cases);
- Use enable_shared_from_this for compatibility with Shared Pointer;
- Use "weak_ptr" when necessary;
- Create using "Class_ptr" for each Class;
- Keep the object alive and send only the reference to subsequent functions with "Class_ptr&" to get the best performance + good naming semantics;
- Create virtual function on Class Thing "getClass()" for each Class and Sub-Class, this way we avoid using dynamic_cast which is more expensive.
We're (me and @ramon-bernardo) are halfway there in https://github.com/ranisalt/forgottenserver/pull/9 but there are a few issues still. I'm going to open a PR here when it's done
I hadn't seen that branch!
Very good, I'll take a look and try to contribute some details as well
Not directly related to shared_ptr, but we intend to remove Cylinder class 😃 (https://github.com/otland/forgottenserver/pull/5058)
@ramon-bernardo In this case, are you continuing what was started in PR #5022 ?
@alysonjacomin something that is present in the shared PR and we reviewed it for another
The smart pointer PR is just getting split so it's easier to track issues and review