Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
Bug in get_exp_worth( )
Oct 10, 2017, 1:26 am
By GatewaySysop
Bug in do_drag( )
Oct 8, 2017, 12:40 am
By GatewaySysop
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Beastmaster 6D sound files
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl, Google, Bing, Yahoo!

Members: 0
Guests: 12
Stats
Files
Topics
Posts
Members
Newest Member
476
3,704
19,231
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » SWFOTE FUSS » Question about editor.c
Forum Rules | Mark all | Recent Posts

Question about editor.c
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Apr 8, 2009, 11:35 pm
Go to the top of the page
Go to the bottom of the page

ayuri
Magician
GroupMembers
Posts239
JoinedJun 13, 2008

I've had a few requests to up the buffer size for our in-game editor. From my understanding max_size is defined to have character space for 4096.
struct editor_data
{
   EDITOR_LINE *first_line;   /* list of lines */
   short line_count; /* number of lines allocated */
   EDITOR_LINE *on_line;   /* pointer to the line being edited */
   int text_size; /* total size of text (not counting
                   * newlines). */
   int max_size;  /* max size in chars of string being
                   * edited (counting newlines) */
   char *desc; /* buffer description */
};
/* "max_size" is the maximum size of the final text converted to string */
/* "text_size" is equal to the strlen of all lines added up; the actual
 * total length when converted to string is equal to this number plus
 * line_count * 2, because of the trailing "\r\n" that has to be added
 * to each line (of course, plus 1 because of the final \0).
 * Thus, if(total_size + line_count * 2 +1) > max_size, the buffer cant
 * hold more data.
 */
/* Hence, this define: */
#define TOTAL_BUFFER_SIZE( edd )    (edd->text_size + edd->line_count * 2 +1 )


I'd like to increase it to 8192 or 12288. That should be enough for anyone but I've no clue where to begin. I ask for the guidance of the masses here. The editor code looks to be Cronel of FrozenMUD.

Thanks,
ayuri
       
Post is unread #2 Apr 9, 2009, 5:39 am
Go to the top of the page
Go to the bottom of the page

David Haley
Sorcerer
GroupMembers
Posts903
JoinedJan 29, 2007

Where do you see 4096? Why couldn't you just change that as-is to whatever you wanted it to be?
       
Post is unread #3 Apr 9, 2009, 9:04 am
Go to the top of the page
Go to the bottom of the page

ayuri
Magician
GroupMembers
Posts239
JoinedJun 13, 2008

I get its 4096 from when I'm in-game and drop in some text. If I do a char count in notepad++ and then drop that into the in-game editor do a /p to print info.
Begin entering your text now (/? = help /s = save /c = clear /l = list)
-----------------------------------------------------------------------
> /p
Currently editing: Unknown buffer
Total lines:   67   On line:    67
Buffer size: 3792   Max size: 4096

I know the count is slightly off due to \n\r.
So, using what I find from /p I went looking for 'Buffer size' and 'Max size'. It seems to be all contained in editor.c with one ref in mud.h

editor.c
void editor_print_info( CHAR_DATA * ch, EDITOR_DATA * edd, char *argument )
{
   short i;
   EDITOR_LINE *eline;

   eline = edd->first_line;
   i = 0;
   while( eline )
   {
      i++;
      if( eline == edd->on_line )
         break;
      eline = eline->next;
   }

   ch_printf( ch,
              "Currently editing: %s\r\n"
              "Total lines: %4d   On line:  %4d\r\n"
              "Buffer size: %4d   Max size: %4d\r\n",
              edd->desc ? edd->desc : "(Null description)", edd->line_count, i, TOTAL_BUFFER_SIZE( edd ), edd->max_size );
}


Now max_size is thrown all over the place. Set mostly as a short with the exception of the int in the struct.

I do hope I'm making some coherent thought here, I just woke up.
ayuri
       
Post is unread #4 Apr 9, 2009, 10:33 am
Go to the top of the page
Go to the bottom of the page

David Haley
Sorcerer
GroupMembers
Posts903
JoinedJan 29, 2007

You'd have to find where max_size is actually assigned, e.g.
ed->max_size = XYZ

I guess that is probably happening wherever the buffer is created.
       
Post is unread #5 Apr 9, 2009, 12:43 pm
Go to the top of the page
Go to the bottom of the page

ayuri
Magician
GroupMembers
Posts239
JoinedJun 13, 2008

Ok, I'm a fool.
Its nothing to do with editor.c. Its all in mud.h. I think I may have talked about this with Keb or Caius or both, once but never followed though cause I was under the impression it was all in editor.c.
Anyhow, mud.h #define MAX_STRING_LENGTH 8192 seemed to do the trick. I changed it from 4096.

Thanks DavidHaley.
ayuri
       
Post is unread #6 Apr 9, 2009, 12:49 pm
Go to the top of the page
Go to the bottom of the page

David Haley
Sorcerer
GroupMembers
Posts903
JoinedJan 29, 2007

Glad that it works now :smile:
Note that that will be changing the maximum length for quite a lot of stuff, which might or might not be a problem for you. It's not a "problem" other than several string buffers will be far larger than they need to be, but that's not the end of the world.
       
Post is unread #7 Apr 9, 2009, 1:42 pm
Go to the top of the page
Go to the bottom of the page

ayuri
Magician
GroupMembers
Posts239
JoinedJun 13, 2008

I don't forsee having MSL causing a lot of problems. Not unless someone's output buf is full of junk. Only thing I can think of is that disconnect from buffer overflow.
I'll play around when I get some time and see what comes up.
ayuri
       
Pages:<< prev 1 next >>