Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ SMAUG
➜ SMAUG coding
➜ Format with FUSS
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1
2
Posted by
| Samson
USA (683 posts) Bio
|
Date
| Reply #15 on Fri 25 Nov 2005 04:25 PM (UTC) |
Message
| You may find this one a bit less problematic - all it does is patch the existing editor to include a /f option.
http://www.afkmud.com/scripts/download.php?file=Sadiq/Format.txt
Do let me know if there are any problems with it not behaving properly, it's been awhile since this one was last looked at since it's one of Sadiq's older ones. | Top |
|
Posted by
| Mopop
(115 posts) Bio
|
Date
| Reply #16 on Fri 25 Nov 2005 08:06 PM (UTC) |
Message
| cc1: warnings being treated as errors
build.c: In function `edit_buffer':
build.c:5265: warning: declaration of `x' shadows a previous local
build.c:5150: warning: shadowed declaration is here
I added everything here are the bugs, I tried making some sense of it and failed. If you are gonna explain it to me, explain it in idiot terms as ive only been coding for bout 12 days =) | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #17 on Fri 25 Nov 2005 09:01 PM (UTC) Amended on Fri 25 Nov 2005 09:02 PM (UTC) by Nick Gammon
|
Message
| The variable "x" was already used earlier up. Rename the snippet's x to x1 to work around this. That is, the major part of it could be:
if ( !str_cmp( cmd+1, "f" ) )
{
char temp_buf[MAX_STRING_LENGTH+max_buf_lines];
int x1, ep, old_p, end_mark;
int p = 0;
pager_printf( ch, "Reformating...\n\r");
for ( x1 = 0; x1 < edit->numlines; x1++ )
{
strcpy ( temp_buf+p , edit->line[x1] );
p += strlen( edit->line[x1] );
temp_buf[p] = ' ';
p++;
}
temp_buf[p] = '\0';
end_mark = p;
p = 75;
old_p =0;
edit->on_line =0;
edit->numlines =0;
while ( old_p < end_mark )
{
while ( temp_buf[p] != ' ' && p > old_p )
p--;
if ( p == old_p )
p +=75;
if ( p > end_mark )
p = end_mark;
ep =0;
for ( x1= old_p ; x1 < p ; x1++ )
{
edit->line[edit->on_line][ep] = temp_buf[x1];
ep++;
}
edit->line[edit->on_line][ep] = '\0';
edit->on_line++;
edit->numlines++;
old_p = p+1 ;
p += 75;
}
pager_printf( ch, "Reformating done.\n\r> ");
return;
}
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Mopop
(115 posts) Bio
|
Date
| Reply #18 on Fri 25 Nov 2005 10:06 PM (UTC) |
Message
| Nice, It compiled clean and I tested it out. It doesnt even format
Begin entering your text now (/? = help /s = save /c = clear /l = list)
-----------------------------------------------------------------------
>
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
(Long line trimmed)
> >
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
(Long line trimmed)
> >
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
(Long line trimmed)
> >
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
(Long line trimmed)
> >
/f
Reformating...
Reformating done.
>
/s
Done.
<32700hp 102m 110mv> <#7>
l
Floating in a void
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
SSS
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
SSS
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
SSS
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
SSS
Exits: none.
Would anyone happen to know why? I hate having all these format problems -.- I just want to get it off my to do list lol. | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #19 on Fri 25 Nov 2005 11:12 PM (UTC) |
Message
| A line full of S isn't a good test, there are no word breaks to format at. It worked for me, see this:
>
/l
------------------
1> You stand inside the northern gate of Darkhaven.
2> To the south lies the
3> intersection of Vertic Avenue and Justice Road.
------------------
>
/f
Reformating...
Reformating done.
>
/l
------------------
1> You stand inside the northern gate of Darkhaven. To the south lies the
2> intersection of Vertic Avenue and Justice Road.
------------------
>
Before the formatting I had 3 lines, the middle one was too short. After formatting it looked better.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Mopop
(115 posts) Bio
|
Date
| Reply #20 on Fri 25 Nov 2005 11:16 PM (UTC) |
Message
| Gosh, How silly of me. I didnt know how it worked *blush* Thanks Nick and everyone else for your help!!! *crosses format off list* | Top |
|
Posted by
| Gatewaysysop2
USA (146 posts) Bio
|
Date
| Reply #21 on Sun 27 Nov 2005 01:08 AM (UTC) |
Message
| Anyone else notice that the -pedantic flag doesn't like this snippet? It complains about variable sized arrays if memory serves. Has anyone come up with a work around for this or do they just ignore the error or not use -pedantic?
|
"The world of men is dreaming, it has gone mad in its sleep, and a snake is strangling it, but it can't wake up." -D.H. Lawrence | Top |
|
Posted by
| Samson
USA (683 posts) Bio
|
Date
| Reply #22 on Sun 27 Nov 2005 04:05 AM (UTC) |
Message
| The error doesn't come up when compiling C++ but it is a legitimate issue in C since C does not technically allow variable sized arrays. What amazes me is that it takes using the -pedantic switch just to catch this. | Top |
|
Posted by
| Gatewaysysop2
USA (146 posts) Bio
|
Date
| Reply #23 on Sun 27 Nov 2005 11:50 PM (UTC) |
Message
| Has anyone come up with a work around on this particular snippet? Looks like a handy feature to have, but since my code otherwise gets passed cleanly by the -pedantic flag, I'd rather not remove it from the makefile just for the sake of having a format option in the line editor. Would be neat to have otherwise though. :-/ |
"The world of men is dreaming, it has gone mad in its sleep, and a snake is strangling it, but it can't wake up." -D.H. Lawrence | Top |
|
Posted by
| Samson
USA (683 posts) Bio
|
Date
| Reply #24 on Mon 28 Nov 2005 02:38 AM (UTC) |
Message
|
max_buf_lines = 24;
if( ch->substate == SUB_MPROG_EDIT || ch->substate == SUB_HELP_EDIT )
max_buf_lines = 48;
In stock code, that's the variable that causes all this: max_buf_lines. Notice they have 2 different values for it. I'm not entirely sure why Sadiq had that variable array setup in his code. I don't think it really needs to be there.
So instead of:
char temp_buf[MAX_STRING_LENGTH + max_buf_lines];
Perhaps just:
char temp_buf[MAX_STRING_LENGTH];
Cause in the grand scheme of things, all he's really done is let another 48 chars go into temp_buf which doesn't seem very useful.
This line will need changing too:
strncpy( temp_buf + p, edit->line[x], MAX_STRING_LENGTH + max_buf_lines - p );
| Top |
|
Posted by
| Gatewaysysop2
USA (146 posts) Bio
|
Date
| Reply #25 on Tue 29 Nov 2005 04:52 AM (UTC) |
Message
| will give it a shot, thanks for the suggestion. :)
|
"The world of men is dreaming, it has gone mad in its sleep, and a snake is strangling it, but it can't wake up." -D.H. Lawrence | Top |
|
Posted by
| Gatewaysysop2
USA (146 posts) Bio
|
Date
| Reply #26 on Wed 30 Nov 2005 04:40 AM (UTC) |
Message
| Just as a follow-up, what Samson suggested worked perfectly.
Kudos for the tip. You the man, as always. ;)
|
"The world of men is dreaming, it has gone mad in its sleep, and a snake is strangling it, but it can't wake up." -D.H. Lawrence | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
68,475 views.
This is page 2, subject is 2 pages long:
1
2
It is now over 60 days since the last post. This thread is closed.
Refresh page
top