The International Simutrans Forum

Development => Technical Documentation => Topic started by: jamespetts on September 28, 2013, 11:11:29 PM

Title: Chat history?
Post by: jamespetts on September 28, 2013, 11:11:29 PM
May I ask - where can I find the parameter that determines how much chat history is saved in network games? I should like to be able to increase the parameter in Experimental, as this is useful for the very long games that we have.
Title: Re: Chat history?
Post by: Dwachs on September 29, 2013, 10:10:11 AM
The chat messages also appear in the log, there you can filter them out if you like. Iirc, that is what Timothy did.
Title: Re: Chat history?
Post by: jamespetts on September 29, 2013, 12:14:34 PM
I was thinking more of how to make the in-game listing of chat messages cover a longer period of history for the convenience of players: it would be useful to see a longer chat history in very long games, at least of the last 25 years or so.
Title: Re: Chat history?
Post by: Ters on September 29, 2013, 12:49:23 PM
There can't be much chatting going on if 25 game years of in-game chat log is a convenience. Or is there a search function I'm not aware of?
Title: Re: Chat history?
Post by: jamespetts on September 29, 2013, 01:01:20 PM
There often is not a great deal of chatting going on, actually: people are often not online at the same time, so there are brief conversations when people are simultaneously online, followed by a smattering of one off remarks. These remarks are often things that it would be useful for other players to have a history of, as they are usually closely related to the game.

Where in the code is the parameter that controls how much of this is retained?
Title: Re: Chat history?
Post by: prissi on October 02, 2013, 11:29:57 AM
The graphic engine cannot display any chat which has more than 2730 lines (i.e. 32768ßscreenheigh pixels). Hence only the last 2500 lines are saved. Look for this number.
Title: Re: Chat history?
Post by: Fabio on October 02, 2013, 11:42:22 AM
Could we save them all but show in game only last 2500? the complete history could be exported as .txt
Title: Re: Chat history?
Post by: jamespetts on October 02, 2013, 08:49:14 PM
Thank you very much for that - that is helpful. May I ask - if I were merely to increase the number, would it potentially result in crashes when the message window was opened, or would it truncate cleanly?
Title: Re: Chat history?
Post by: prissi on October 02, 2013, 08:51:54 PM
The slider may do wierd thing, but checking for this should not be too difficult. I once wanted to fix this too, but then 2500 was already a lot of text and you are the first to complain.

EDIT: in void message_t::rdwr( loadsave_t *file ) there are only 2000 messages saved. You need to remove "if(++msg_count == 2000) break;" and instead "min( 2000u, " only "msg_count = min( 32760u, list.get_count() );"

Title: Re: Chat history?
Post by: jamespetts on October 02, 2013, 09:01:04 PM
Thank you very much - that is very helpful.

Edit: Should I remove all of the following code:


FOR(slist_tpl<node*>, const i, list) {
                if (!(i->type & local_flag)) {
                    if (++msg_count == 2000) break;
                }
            }


as the whole loop is redundant without the " if (++msg_count == 2000) break;" line?
Title: Re: Chat history?
Post by: prissi on October 02, 2013, 10:28:15 PM
Obviously this counts the local messages. I.e. you have to replace it by
"if (++msg_count == 2000) break;" by "msg_count++;"
Title: Re: Chat history?
Post by: jamespetts on October 03, 2013, 09:26:33 PM
Thank you very much!