Skip to content

Commit

Permalink
fixup chat history synopsis system
Browse files Browse the repository at this point in the history
It was truncating all of the history because of some unexpected
behavior with find and npos.
  • Loading branch information
cbeck88 committed Jul 14, 2014
1 parent 5fc02ca commit e07f8e3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/game_display.cpp
Expand Up @@ -924,9 +924,14 @@ void game_display::send_notification(const std::string& /*owner*/, const std::st

if (i != i_end) {
i->message = message + "\n" + i->message;
int endl_pos = -1;
for (int ctr = 0; ctr < 5; ctr++)

size_t endl_pos = i->message.find('\n');
size_t ctr = 1;

while(ctr < 5 && endl_pos != std::string::npos) {
endl_pos = i->message.find('\n', endl_pos+1);
ctr++;
}

i->message = i->message.substr(0,endl_pos);

Expand Down

0 comments on commit e07f8e3

Please sign in to comment.