Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Replace custom MS types with STL types #179

Open
SaintWish opened this issue Feb 25, 2023 · 3 comments
Open

Replace custom MS types with STL types #179

SaintWish opened this issue Feb 25, 2023 · 3 comments
Labels
enhancement 🔧 New feature or request good first issue Good for newcomers help wanted Extra attention is needed med priority Issue that should be addressed as time allows.

Comments

@SaintWish
Copy link
Contributor

SaintWish commented Feb 25, 2023

The types that need replacing:

  • msstring - It's a C style fixed string type. Replacing it with std::string isn't advised since it's dynamically allocated. It'll probably be best to make our fix fixed string inherited from std::basic_string or use a library like this that contains a fixed string.
  • msvariant - A variant variable that fits a c string, int, or float
  • msstring_ref - Type defined as a const char*
  • mslist - a linked list list that is used a vector throughout the code as well. Should be replaced with a std::vector or std::list depending on what should be used there.
  • string_i - In debug mode, a normal string. In release mode its created within the engine and released each level
  • msnew - Should probably be replaced with just new.

This should be done after angelscript is embedded.

@SaintWish SaintWish added enhancement 🔧 New feature or request low priority Low prority stuff that may or may not get done. game Related to the game's code. labels Feb 25, 2023
@Aze-M
Copy link
Contributor

Aze-M commented Feb 25, 2023

I believe MSLists are a custom implementation of a linked list rather than a vector, would have to look into which is more efficient for our purposes.

@SaintWish
Copy link
Contributor Author

From what I was reading traditional linked lists are bad for reading random data inside, so in such a case a vector would be better. Though I'm not sure if such would apply to mslist list since it's a custom implementation, though it might be worth it to just switch to std list in such a case.

Here's a future note: differences between vector and std list https://stackoverflow.com/questions/2209224/vector-vs-list-in-stl#2209564

Anyways, I did start doing this but I reverted it. I figured we should probably wait for angelscript to avoid breaking the already fragile scripting system.

@SaintWish SaintWish added med priority Issue that should be addressed as time allows. and removed low priority Low prority stuff that may or may not get done. labels Mar 19, 2023
@SaintWish SaintWish added this to MS:R Mar 23, 2023
@SaintWish SaintWish moved this to Todo in MS:R Mar 23, 2023
@SaintWish SaintWish added this to the Angelscript milestone Mar 23, 2023
@SaintWish SaintWish changed the title Replace mslist with std vector and msstring with std string Replace custom MS types with STL types Sep 23, 2024
@SaintWish SaintWish removed this from the Angelscript milestone Sep 23, 2024
@SaintWish SaintWish added good first issue Good for newcomers help wanted Extra attention is needed and removed game Related to the game's code. labels Oct 6, 2024
@tschumann
Copy link
Contributor

I've removed some unused bits in #268 - the rest looks reasonably set in for now.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement 🔧 New feature or request good first issue Good for newcomers help wanted Extra attention is needed med priority Issue that should be addressed as time allows.
Projects
No open projects
Status: Todo
Development

No branches or pull requests

3 participants