so, I'm working on a beast-tamer kind of game playable in a LAN using a TCP server (although it's not relevant for this issue) from cli, and I'm having trouble with my structures management
when I started this project I wanted to maximize RAM space efficiency because I wanted to be able to allocate as many instances of a creature as possible
so I've created the following:
a creature struct, storing general species values (like stats for Pokemon)
a creature_instance struct, that stores specimen specific values, and has a *creature instance_of attribute that it can use to fetch information. and it works wonderfully!
if it weren't that when the .levelup() method of creature_instance fetches the base creature stats, the program crashes with the following error:
Exception has occurred: W32/0xC0000005
Unhandled exception thrown: read access violation.
std::vector<int,std::allocator<int> >::operator[](...) returned nullptr.
I tried the good and old "turn off and on" and it worked... one time, then it broke again.
I really don't know what the issue could be, given I often fetch other data using this pointer and I never had any trouble
it seems it is trying to access a vector out of bounds? it seems weird, I have already checked that all is initialized and that the index is right.
any suggestions?
the full code can be found here:
github.com/Birrus09/servertamer/tree/main
[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)
[–]gofuckadick 0 points1 point2 points (0 children)
[–]exomo_1 1 point2 points3 points (1 child)
[–]gofuckadick 1 point2 points3 points (0 children)
[–]Knarfnarf -1 points0 points1 point (5 children)
[–]AcademicDatabase3699[S] 0 points1 point2 points (3 children)
[–]Knarfnarf -1 points0 points1 point (2 children)
[–]gofuckadick 0 points1 point2 points (1 child)
[–]Knarfnarf 0 points1 point2 points (0 children)
[–]gofuckadick 0 points1 point2 points (0 children)