TempusMUD / Tempuscode

Codebase for TempusMUD
http://tempusmud.com/
Other
7 stars 6 forks source link

Editing an action desc adds a blank line #157

Open mikeclemson opened 11 years ago

mikeclemson commented 11 years ago

Editing an action desc adds a blank line, causing output in game to show a blank line, e.g. clan recalls:

Tortured souls mist up from a shadow below, pulling Fuzzy within it.

< 766H 437M 2131V -53A > Temptation projects, 'He's a good guy.'

< 766H 437M 2131V -53A > A watery vortex appears, sucking in Freedom!

< 766H 437M 2131V -53A >

dlowe-net commented 11 years ago

I think the issue here is that a) some action descs don't have a CRLF at the end, and b) a CRLF is added at the end when displayed. The best thing would be if all action descs had the CRLF and then the CRLF wasn't added.

This is an issue from when you used to set action descs instead of edit them in the editor.

mikeclemson commented 10 years ago

I spent a long time and am no closer, but have learned a fair bit about how olc is written to file and how arrays of chars are read as strings. How would I eliminate the extra line when reading? Wouldn't I have to work backward from the end of the array? (going backward) if \n then \r then \n then \r then remove the last two chars for display (strlen - 2)?

Alternatively I considered a new @@ option for closing the editor which closes it without the extra blank line.

dlowe-net commented 10 years ago
size_t len = strlen(s);
if (len >= 2 && s[len-2] == '\r' && s[len-1] == '\n') {
    s[len-2] = '\0'
}
mikeclemson commented 10 years ago

Ah, I found the line in obj_data.c as well when it reads from file. obj->action_desc = strdup(tmp_gsub(str, "\n", "\r\n"));