tov / ge211

A relatively simple C++ student game engine
https://tov.github.io/ge211/
6 stars 3 forks source link

Bugfix: adding messages to a builder #5

Closed brghena closed 2 years ago

brghena commented 2 years ago

Builders use a std::ostreamstring internally to store the message. Builder::message() overwrites this, but surprisingly doesn't update the position to the end of the stream by default, so future Builder::add_message() calls overwrite the base message.

This is "the design" of std::ostreamstring and can be fixed with a constructor argument: https://stackoverflow.com/questions/62238203/stdostringstream-overwriting-initializing-string

tov commented 2 years ago

Nice catch! Thanks.