Some questing about UniverseObject usage
Posted: Thu Sep 06, 2018 9:58 am
When I worked on https://github.com/freeorion/freeorion/issues/1897 I got some question about code to discuss:
- Should GeneralizedLocation in universe/Pathfinder.cpp accept std::shared_ptr by value? It doesn't looks like it takes ownership on this parameter.
- GeneralizedLocation outputs simple error to log if object is very wrong but actually it foreshadows segfaults. When I fixed segfault I also fix this error. Should GeneralizedLocation throw exception instead of logging error?
- m_existing maps aren't specialized by type but appropriate main objects' maps are. Is it intended?
- m_existing maps don't require to own objects because those objects are owned by appropriate main objects' maps. What if use std::weak_ptr?
- I suppose in possible to change boost::remove_const<T>::type to std::remove_const<T>::type as the game uses c++11.