Hi - Clean SmaugFuss map/description issue..
< Newer Topic
:: Older Topic >
Pages:<< prev 1 next >>
#1 Nov 25, 2024 1:35 pm
Last edited Nov 25, 2024 2:45 pm by dexio
Fledgling
GroupMembers
Posts4
JoinedNov 25, 2024
Hello! I have the config +automap on. So it shows a small map with the description on SmaugFuss. I had to turn off AddressSanitizer as my host has a debugger(as weather kept bugging and d/c players). However, it only shows the first and last line of the description. Again, this is a fresh install - curious how I can resolve this. Thanks for any info - I am not truly knowledgeable with C++, just a 20 year vet to web design and modding.
If I config -automap -then the full room description shows proper.
https://i.imgur.com/b2MoaiY.png
https://i.imgur.com/WcVdQee.png
If I config -automap -then the full room description shows proper.
https://i.imgur.com/b2MoaiY.png
https://i.imgur.com/WcVdQee.png
#2 Nov 25, 2024 3:32 pm
Geomancer
GroupAdministrators
Posts1,946
JoinedJul 26, 2005
ok so first thing i would do is take a good look at the screen when its doing it and see if you highlight the screen it shows the characters you couldn't see before. Could be as simple as a color display issue. No point in chasing the wrong issue . If it doesn't show up then you will want to take a look at the code in mapper.c draw_room_map function and all the stuff it calls.
#3 Nov 25, 2024 4:01 pm
Fledgling
GroupMembers
Posts4
JoinedNov 25, 2024
highlighting the screen shows nothing, it just ends at the map... as to say, it's not filled with black text, or spaces.. it just does not show, like it's not printing out from the code to begin with.
https://i.imgur.com/oRXLoFd.png
https://i.imgur.com/pERXX6A.png
https://i.imgur.com/oRXLoFd.png
https://i.imgur.com/pERXX6A.png
#4 Nov 25, 2024 4:27 pm
Geomancer
GroupAdministrators
Posts1,946
JoinedJul 26, 2005
odd that it is skipping it all then lets see.
id say start in mapper.c show_map function at the parts for !alldesc The object is of course to do the part of the map (which all seems fine with the map) then add in some of the text on each line as well.
id say start in mapper.c show_map function at the parts for !alldesc The object is of course to do the part of the map (which all seems fine with the map) then add in some of the text on each line as well.
#5 Nov 25, 2024 8:04 pm
Last edited Nov 25, 2024 11:20 pm by dexio
Fledgling
GroupMembers
Posts4
JoinedNov 25, 2024
I was looking at that before i posted here. I'll just go back to rom sadly thanks anyways though!
https://i.imgur.com/wnVLwdc.png
https://i.imgur.com/wnVLwdc.png
#6 Nov 26, 2024 4:49 am
Geomancer
GroupAdministrators
Posts1,946
JoinedJul 26, 2005
You will always have things like this to chase down regardless of the base you start with sadly. It looks like the first is doing what it should without any issues and the second part of sending text has issues and only adds the last line of text into the map part. id start there if I was having the issue and add in logs to see where it is going crazy. does it have the text in question (my guess is yes since it seems to be giving the correct space between the first line of text and the last line of text).
#7 Nov 26, 2024 12:00 pm
Fledgling
GroupMembers
Posts4
JoinedNov 25, 2024
Hey thanks, no stress! It's the first issue anyone sees when logging in with smaugfuss, so I just had hoped there was public documentation for it, but seems anyone fixing it isn't discussing the resolution. Regardless, with my level of knowledge, I can't repair experienced coders errors haha. I'll check in the future perhaps though, I gave it another 3-4 hours moving stuff around on mapper.c though, literally can not get any room description to print past the first or last line of description, 100% baffled as to why. I am of no help to fix this sorry, but cheers for the responses!
#8 Nov 26, 2024 3:36 pm
Geomancer
GroupAdministrators
Posts1,946
JoinedJul 26, 2005
what are you running it on and all? i can try to help but just messing with it i can tell ill have to update a copy to even run in cygwin lol.
#9 Nov 26, 2024 5:16 pm
Geomancer
GroupAdministrators
Posts1,946
JoinedJul 26, 2005
well now that i took some time to get it to compile i can verify the copy i have also has this issue im guessing lots never turn it on lol ill try to see what i can figure out give me a few
#10 Nov 26, 2024 6:50 pm
Geomancer
GroupAdministrators
Posts1,946
JoinedJul 26, 2005
ok so it took a bit of testing to see what the issue was but it seems like it is in a few spots like this in show_map
instead make it look like this
It is always cutting it off make sure you get all the spots with it doing that ( I think there were 3 )
mudstrlcat( buf, p, pos );
instead make it look like this
mudstrlcat( buf, p, ( strlen( buf ) + pos ) );
It is always cutting it off make sure you get all the spots with it doing that ( I think there were 3 )
#11 Nov 26, 2024 6:53 pm
Geomancer
GroupAdministrators
Posts1,946
JoinedJul 26, 2005
so change
to this
/* Display the map to the player */ void show_map( CHAR_DATA * ch, char *text ) { char buf[MAX_STRING_LENGTH * 2]; int x, y, pos; char *p; bool alldesc = FALSE; /* Has desc been fully displayed? */ if( !text ) alldesc = TRUE; pos = 0; p = text; buf[0] = '\0'; /* * Show exits */ if( xIS_SET( ch->act, PLR_AUTOEXIT ) ) snprintf( buf, MAX_STRING_LENGTH * 2, "%s%s", color_str( AT_EXITS, ch ), get_exits( ch ) ); else mudstrlcpy( buf, "", MAX_STRING_LENGTH * 2 ); /* * Top of map frame */ mudstrlcat( buf, "&z+-----------+&w ", MAX_STRING_LENGTH * 2 ); if( !alldesc ) { pos = get_line( p, 63 ); if( pos > 0 ) { mudstrlcat( buf, color_str( AT_RMDESC, ch ), MAX_STRING_LENGTH * 2 ); strncat( buf, p, pos ); p += pos; } else { mudstrlcat( buf, color_str( AT_RMDESC, ch ), MAX_STRING_LENGTH * 2 ); mudstrlcat( buf, p, MAX_STRING_LENGTH * 2 ); alldesc = TRUE; } } mudstrlcat( buf, "\r\n", MAX_STRING_LENGTH * 2 ); /* * Write out the main map area with text */ for( y = 0; y <= MAPY; ++y ) { mudstrlcat( buf, "&z|&D", MAX_STRING_LENGTH * 2 ); for( x = 0; x <= MAPX; ++x ) { switch ( dmap[x][y].tegn ) { case '-': case '|': case '\\': case '/': snprintf( buf + strlen( buf ), ( MAX_STRING_LENGTH * 2 ) - strlen( buf ), "&O%c&d", dmap[x][y].tegn ); break; case '@': // Character is standing here snprintf( buf + strlen( buf ), ( MAX_STRING_LENGTH * 2 ) - strlen( buf ), "&R%c&d", dmap[x][y].tegn ); break; case 'O': // Indoors snprintf( buf + strlen( buf ), ( MAX_STRING_LENGTH * 2 ) - strlen( buf ), "&w%c&d", dmap[x][y].tegn ); break; case '=': snprintf( buf + strlen( buf ), ( MAX_STRING_LENGTH * 2 ) - strlen( buf ), "&B%c&d", dmap[x][y].tegn ); break; case '~': snprintf( buf + strlen( buf ), ( MAX_STRING_LENGTH * 2 ) - strlen( buf ), "&C%c&d", dmap[x][y].tegn ); break; case '+': snprintf( buf + strlen( buf ), ( MAX_STRING_LENGTH * 2 ) - strlen( buf ), "&Y%c&d", dmap[x][y].tegn ); break; case '*': snprintf( buf + strlen( buf ), ( MAX_STRING_LENGTH * 2 ) - strlen( buf ), "&g%c&d", dmap[x][y].tegn ); break; case 'X': snprintf( buf + strlen( buf ), ( MAX_STRING_LENGTH * 2 ) - strlen( buf ), "&R%c&d", dmap[x][y].tegn ); break; case ':': snprintf( buf + strlen( buf ), ( MAX_STRING_LENGTH * 2 ) - strlen( buf ), "&Y%c&d", dmap[x][y].tegn ); break; default: // Empty space snprintf( buf + strlen( buf ), ( MAX_STRING_LENGTH * 2 ) - strlen( buf ), "%c", dmap[x][y].tegn ); break; } } mudstrlcat( buf, "&z|&D ", MAX_STRING_LENGTH * 2 ); /* * Add the text, if necessary */ if( !alldesc ) { pos = get_line( p, 63 ); char col[10], c[2]; mudstrlcpy( c, whatColor( text, p ), 2 ); if( c[0] == '\0' ) mudstrlcpy( col, color_str( AT_RMDESC, ch ), 10 ); else snprintf( col, 10, "%s", c ); if( pos > 0 ) { mudstrlcat( buf, col, MAX_STRING_LENGTH * 2 ); mudstrlcat( buf, p, pos ); p += pos; } else { mudstrlcat( buf, col, MAX_STRING_LENGTH * 2 ); mudstrlcat( buf, p, MAX_STRING_LENGTH * 2 ); alldesc = TRUE; } } mudstrlcat( buf, "\r\n", MAX_STRING_LENGTH * 2 ); } /* * Finish off map area */ mudstrlcat( buf, "&z+-----------+&D ", MAX_STRING_LENGTH * 2 ); if( !alldesc ) { char col[10], c[2]; pos = get_line( p, 63 ); mudstrlcpy( c, whatColor( text, p ), 2 ); if( c[0] == '\0' ) mudstrlcpy( col, color_str( AT_RMDESC, ch ), 10 ); else snprintf( col, 10, "%s", c ); if( pos > 0 ) { mudstrlcat( buf, col, MAX_STRING_LENGTH * 2 ); mudstrlcat( buf, p, pos ); p += pos; mudstrlcat( buf, "\r\n", MAX_STRING_LENGTH * 2 ); } else { mudstrlcat( buf, col, MAX_STRING_LENGTH * 2 ); mudstrlcat( buf, p, MAX_STRING_LENGTH * 2 ); alldesc = TRUE; } } /* * Deal with any leftover text */ if( !alldesc ) { char col[10], c[2]; do { /* * Note the number - no map to detract from width */ pos = get_line( p, 78 ); mudstrlcpy( c, whatColor( text, p ), 2 ); if( c[0] == '\0' ) mudstrlcpy( col, color_str( AT_RMDESC, ch ), 10 ); else snprintf( col, 10, "%s", c ); if( pos > 0 ) { mudstrlcat( buf, col, MAX_STRING_LENGTH * 2 ); mudstrlcat( buf, p, pos ); p += pos; mudstrlcat( buf, "\r\n", MAX_STRING_LENGTH * 2 ); } else { mudstrlcat( buf, col, MAX_STRING_LENGTH * 2 ); mudstrlcat( buf, p, MAX_STRING_LENGTH * 2 ); alldesc = TRUE; } } while( !alldesc ); } mudstrlcat( buf, "&D\r\n", MAX_STRING_LENGTH * 2 ); send_to_char( buf, ch ); }
to this
/* Display the map to the player */ void show_map( CHAR_DATA * ch, char *text ) { char buf[MAX_STRING_LENGTH * 2]; int x, y, pos; char *p; bool alldesc = FALSE; /* Has desc been fully displayed? */ if( !text ) alldesc = TRUE; pos = 0; p = text; buf[0] = '\0'; /* * Show exits */ if( xIS_SET( ch->act, PLR_AUTOEXIT ) ) snprintf( buf, MAX_STRING_LENGTH * 2, "%s%s", color_str( AT_EXITS, ch ), get_exits( ch ) ); else mudstrlcpy( buf, "", MAX_STRING_LENGTH * 2 ); /* * Top of map frame */ mudstrlcat( buf, "&z+-----------+&w ", MAX_STRING_LENGTH * 2 ); if( !alldesc ) { pos = get_line( p, 63 ); if( pos > 0 ) { mudstrlcat( buf, color_str( AT_RMDESC, ch ), MAX_STRING_LENGTH * 2 ); strncat( buf, p, pos ); p += pos; } else { mudstrlcat( buf, color_str( AT_RMDESC, ch ), MAX_STRING_LENGTH * 2 ); mudstrlcat( buf, p, MAX_STRING_LENGTH * 2 ); alldesc = TRUE; } } mudstrlcat( buf, "\r\n", MAX_STRING_LENGTH * 2 ); /* * Write out the main map area with text */ for( y = 0; y <= MAPY; ++y ) { mudstrlcat( buf, "&z|&D", MAX_STRING_LENGTH * 2 ); for( x = 0; x <= MAPX; ++x ) { switch ( dmap[x][y].tegn ) { case '-': case '|': case '\\': case '/': snprintf( buf + strlen( buf ), ( MAX_STRING_LENGTH * 2 ) - strlen( buf ), "&O%c&d", dmap[x][y].tegn ); break; case '@': // Character is standing here snprintf( buf + strlen( buf ), ( MAX_STRING_LENGTH * 2 ) - strlen( buf ), "&R%c&d", dmap[x][y].tegn ); break; case 'O': // Indoors snprintf( buf + strlen( buf ), ( MAX_STRING_LENGTH * 2 ) - strlen( buf ), "&w%c&d", dmap[x][y].tegn ); break; case '=': snprintf( buf + strlen( buf ), ( MAX_STRING_LENGTH * 2 ) - strlen( buf ), "&B%c&d", dmap[x][y].tegn ); break; case '~': snprintf( buf + strlen( buf ), ( MAX_STRING_LENGTH * 2 ) - strlen( buf ), "&C%c&d", dmap[x][y].tegn ); break; case '+': snprintf( buf + strlen( buf ), ( MAX_STRING_LENGTH * 2 ) - strlen( buf ), "&Y%c&d", dmap[x][y].tegn ); break; case '*': snprintf( buf + strlen( buf ), ( MAX_STRING_LENGTH * 2 ) - strlen( buf ), "&g%c&d", dmap[x][y].tegn ); break; case 'X': snprintf( buf + strlen( buf ), ( MAX_STRING_LENGTH * 2 ) - strlen( buf ), "&R%c&d", dmap[x][y].tegn ); break; case ':': snprintf( buf + strlen( buf ), ( MAX_STRING_LENGTH * 2 ) - strlen( buf ), "&Y%c&d", dmap[x][y].tegn ); break; default: // Empty space snprintf( buf + strlen( buf ), ( MAX_STRING_LENGTH * 2 ) - strlen( buf ), "%c", dmap[x][y].tegn ); break; } } mudstrlcat( buf, "&z|&D ", MAX_STRING_LENGTH * 2 ); /* * Add the text, if necessary */ if( !alldesc ) { pos = get_line( p, 63 ); char col[10], c[2]; mudstrlcpy( c, whatColor( text, p ), 2 ); if( c[0] == '\0' ) mudstrlcpy( col, color_str( AT_RMDESC, ch ), 10 ); else snprintf( col, 10, "%s", c ); if( pos > 0 ) { mudstrlcat( buf, col, MAX_STRING_LENGTH * 2 ); mudstrlcat( buf, p, ( strlen( buf ) + pos ) ); p += pos; } else { mudstrlcat( buf, col, MAX_STRING_LENGTH * 2 ); mudstrlcat( buf, p, MAX_STRING_LENGTH * 2 ); alldesc = TRUE; } } mudstrlcat( buf, "\r\n", MAX_STRING_LENGTH * 2 ); } /* * Finish off map area */ mudstrlcat( buf, "&z+-----------+&D ", MAX_STRING_LENGTH * 2 ); if( !alldesc ) { char col[10], c[2]; pos = get_line( p, 63 ); mudstrlcpy( c, whatColor( text, p ), 2 ); if( c[0] == '\0' ) mudstrlcpy( col, color_str( AT_RMDESC, ch ), 10 ); else snprintf( col, 10, "%s", c ); if( pos > 0 ) { mudstrlcat( buf, col, MAX_STRING_LENGTH * 2 ); mudstrlcat( buf, p, ( strlen( buf ) + pos ) ); p += pos; mudstrlcat( buf, "\r\n", MAX_STRING_LENGTH * 2 ); } else { mudstrlcat( buf, col, MAX_STRING_LENGTH * 2 ); mudstrlcat( buf, p, MAX_STRING_LENGTH * 2 ); alldesc = TRUE; } } /* * Deal with any leftover text */ if( !alldesc ) { char col[10], c[2]; do { /* * Note the number - no map to detract from width */ pos = get_line( p, 78 ); mudstrlcpy( c, whatColor( text, p ), 2 ); if( c[0] == '\0' ) mudstrlcpy( col, color_str( AT_RMDESC, ch ), 10 ); else snprintf( col, 10, "%s", c ); if( pos > 0 ) { mudstrlcat( buf, col, MAX_STRING_LENGTH * 2 ); mudstrlcat( buf, p, ( strlen( buf ) + pos ) ); p += pos; mudstrlcat( buf, "\r\n", MAX_STRING_LENGTH * 2 ); } else { mudstrlcat( buf, col, MAX_STRING_LENGTH * 2 ); mudstrlcat( buf, p, MAX_STRING_LENGTH * 2 ); alldesc = TRUE; } } while( !alldesc ); } mudstrlcat( buf, "&D\r\n", MAX_STRING_LENGTH * 2 ); send_to_char( buf, ch ); }
#12 Dec 6, 2024 6:21 am
Last edited Dec 6, 2024 6:26 am by Elwood
Fledgling
GroupMembers
Posts12
JoinedMar 29, 2024
But that show_map code... it didn't have issues for me.. i downloaded 1.9.4 and tried it.. it displayed everything..
but i made code robust, i dunno if its much help but heres my copy..
Also i really don't play with Smaug much besides the Swfote.. im more with Rom/Rot lol
Also using....
Supported LTO compression algorithms: zlib zstd
gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04)
but i made code robust, i dunno if its much help but heres my copy..
/* Display the map to the player */ void show_map( CHAR_DATA * ch, char *text ) { char buf[8192]; // Large buffer for map and descriptions int x, y, pos; char *p; bool alldesc = FALSE; /* Has desc been fully displayed? */ if( !text ) alldesc = TRUE; pos = 0; p = text; buf[0] = '\0'; /* * Show exits */ if( xIS_SET( ch->act, PLR_AUTOEXIT ) ) snprintf( buf, sizeof(buf), "%s%s", color_str( AT_EXITS, ch ), get_exits( ch ) ); else mudstrlcpy( buf, "", sizeof(buf) ); /* * Top of map frame */ mudstrlcat( buf, "&z+-----------+&w ", sizeof(buf) ); if( !alldesc ) { pos = get_line( p, 63 ); if( pos > 0 ) { mudstrlcat( buf, color_str( AT_RMDESC, ch ), sizeof(buf) ); strncat( buf, p, pos ); // No mudstrlcat for partial strings p += pos; } else { mudstrlcat( buf, color_str( AT_RMDESC, ch ), sizeof(buf) ); mudstrlcat( buf, p, sizeof(buf) ); alldesc = TRUE; } } mudstrlcat( buf, "\r\n", sizeof(buf) ); /* * Write out the main map area with text */ for( y = 0; y <= MAPY; ++y ) { mudstrlcat( buf, "&z|&D", sizeof(buf) ); for( x = 0; x <= MAPX; ++x ) { const char *color_code; switch ( dmap[x][y].tegn ) { case '-': case '|': case '\\': case '/': color_code = "&O"; break; case '@': // Character is standing here color_code = "&R"; break; case 'O': // Indoors color_code = "&w"; break; case '=': color_code = "&B"; break; case '~': color_code = "&C"; break; case '+': color_code = "&Y"; break; case '*': color_code = "&g"; break; case 'X': color_code = "&R"; break; case ':': color_code = "&Y"; break; default: // Empty space color_code = ""; break; } if( *color_code ) { char temp[16]; snprintf( temp, sizeof(temp), "%s%c&d", color_code, dmap[x][y].tegn ); mudstrlcat( buf, temp, sizeof(buf) ); } else { char temp[4]; snprintf( temp, sizeof(temp), "%c", dmap[x][y].tegn ); mudstrlcat( buf, temp, sizeof(buf) ); } } mudstrlcat( buf, "&z|&D ", sizeof(buf) ); /* * Add the text, if necessary */ if( !alldesc ) { pos = get_line( p, 63 ); char col[10], c[2]; mudstrlcpy( c, whatColor( text, p ), sizeof(c) ); if( c[0] == '\0' ) mudstrlcpy( col, color_str( AT_RMDESC, ch ), sizeof(col) ); else snprintf( col, sizeof(col), "%s", c ); if( pos > 0 ) { mudstrlcat( buf, col, sizeof(buf) ); strncat( buf, p, pos ); // Append only the next line p += pos; } else { mudstrlcat( buf, col, sizeof(buf) ); mudstrlcat( buf, p, sizeof(buf) ); alldesc = TRUE; } } mudstrlcat( buf, "\r\n", sizeof(buf) ); } /* * Finish off map area */ mudstrlcat( buf, "&z+-----------+&D ", sizeof(buf) ); if( !alldesc ) { char col[10], c[2]; pos = get_line( p, 63 ); mudstrlcpy( c, whatColor( text, p ), sizeof(c) ); if( c[0] == '\0' ) mudstrlcpy( col, color_str( AT_RMDESC, ch ), sizeof(col) ); else snprintf( col, sizeof(col), "%s", c ); if( pos > 0 ) { mudstrlcat( buf, col, sizeof(buf) ); strncat( buf, p, pos ); // Append partial string p += pos; mudstrlcat( buf, "\r\n", sizeof(buf) ); } else { mudstrlcat( buf, col, sizeof(buf) ); mudstrlcat( buf, p, sizeof(buf) ); alldesc = TRUE; } } /* * Deal with any leftover text */ if( !alldesc ) { char col[10], c[2]; do { /* * Note the number - no map to detract from width */ pos = get_line( p, 78 ); mudstrlcpy( c, whatColor( text, p ), sizeof(c) ); if( c[0] == '\0' ) mudstrlcpy( col, color_str( AT_RMDESC, ch ), sizeof(col) ); else snprintf( col, sizeof(col), "%s", c ); if( pos > 0 ) { mudstrlcat( buf, col, sizeof(buf) ); strncat( buf, p, pos ); // Append partial string p += pos; mudstrlcat( buf, "\r\n", sizeof(buf) ); } else { mudstrlcat( buf, col, sizeof(buf) ); mudstrlcat( buf, p, sizeof(buf) ); alldesc = TRUE; } } while( !alldesc ); } mudstrlcat( buf, "&D\r\n", sizeof(buf) ); send_to_char( buf, ch ); }
Also i really don't play with Smaug much besides the Swfote.. im more with Rom/Rot lol
Also using....
Supported LTO compression algorithms: zlib zstd
gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04)
#13 Dec 6, 2024 11:54 am
Geomancer
GroupAdministrators
Posts1,946
JoinedJul 26, 2005
Well I gave it a shot and it doesn't have the display issue the stock one did for me in ubunto lol so if the original poster comes back it should work for him as well.
#14 Dec 15, 2024 7:29 pm
Black Hand
GroupAdministrators
Posts3,697
JoinedJan 1, 2002
Just FYI - I've verified that Remcon's fix works to restore the descriptions that were being suppressed. They'll be part of the next codebase update.
Pages:<< prev 1 next >>