gecube / opencaesar3

opencaesar3 fork from sourceforge
Other
139 stars 33 forks source link

Fix crash on accessing past-the-end of a vector #200

Closed AMDmi3 closed 11 years ago

AMDmi3 commented 11 years ago

WG_ANIMAL_SHEEP_WALK == 30, so it won't fit to 30-element vector, so the game crashes. Use safer enum to specify vector size.

dalerank commented 11 years ago

thanks, i already take this bug... i think std::map will be a mostly usefull for it, what you think about???

AMDmi3 commented 11 years ago

Map would be safer, but slower. As the vector is filled without gaps (except for element 0), I think it's more suitable, given that it's of correct size.