Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
Couple bugs
Yesterday, 5:42 pm
By Remcon
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
LOP 1.45
Author: Remcon
Submitted by: Remcon
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
Users Online
CommonCrawl, Yahoo!, Yandex, DotBot, Bing, Google

Members: 0
Guests: 6
Stats
Files
Topics
Posts
Members
Newest Member
477
3,705
19,232
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » AFKMud Support & Development » Map help GOTO [Explained] -- ...
Forum Rules | Mark all | Recent Posts

Map help GOTO [Explained] -- Editor.cpp Editor Buffer [Fix]
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Jul 31, 2009, 7:32 am
Go to the top of the page
Go to the bottom of the page

apocalypticNRG
Fledgling
GroupMembers
Posts35
JoinedJul 29, 2009

I logged in as Admin, map drew perfectly. I could run around etc.. I left the map, tried to reenter, and of course it didn't load the mapfile.

Somewhere on the Continent                                 NW    N    NE
-<---- Vnum:  50000 ----------------------------->-        W<---(*)--->E
                                                           SW    S    SE
[Area Flags: nobeacon]
[Room Flags: indoors map]
[Sector Type: indoors] [Continent or Plane: one]
[Area name: The Continent]  [Area filename: one.are]
[Exits: North East South West Northeast Northwest Southeast Southwest]
+-----------+ If you can read this description online, then something REALLY 
|           | bad has happened, contact the immortals at once. You should be 
|           | seeing the ASCII color map of the continent instead of this 
|           | lousy description :) 


I believe I'm at the right VNUM for the map, as it says. Not sure if there's a thread on this, did a search, found people trying to conver the maps to smaugfuss etc.. any idea's?
       
Post is unread #2 Jul 31, 2009, 11:42 am
Go to the top of the page
Go to the bottom of the page

apocalypticNRG
Fledgling
GroupMembers
Posts35
JoinedJul 29, 2009

Another bug I'd like to note... If you type Practice, Hit "Q" (for quit), its not resetting the mem. So when you go to hit PRAC or HELP, not sure what other commands, it just gives an extra line. Doesn't compute. Unless you relog.
       
Post is unread #3 Aug 1, 2009, 9:51 am   Last edited Aug 1, 2009, 11:56 am by apocalypticNRG
Go to the top of the page
Go to the bottom of the page

apocalypticNRG
Fledgling
GroupMembers
Posts35
JoinedJul 29, 2009

Anyone have an idea on how to reenter the overland map after you leave?

EDIT:

Also the buffers aren't clearing properly. After doing anything that uses "Edit", OLC etc... Seems to be stuck afterwords. Won't let you use anything that requires a buffer. Until you relog.


Yeah, definitely some error's with this editor, I remember back in the old days, being able to crash a mud via their editor. Just spam a certain line length and bam buffer overflow, crash. Used it to dupe items, back when I was a pain in the ass to mud owners :).

I'll work on that for the next few hours, correcting it, and posting a fix for AFKmud owners.
       
Post is unread #4 Aug 1, 2009, 2:15 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

Re: Map issue - The exist you walked out of to get the bad map display, is it flagged as Overland? And does it have exit coordinates assigned?

There's likely some residual issues with the prompt buffer that are causing the "Q" problem as well as the OLC mode getting stuck. I never had the OLC issue but the Q thing is something I wasn't able to track down.
       
Post is unread #5 Aug 1, 2009, 3:26 pm   Last edited Aug 1, 2009, 3:27 pm by apocalypticNRG
Go to the top of the page
Go to the bottom of the page

apocalypticNRG
Fledgling
GroupMembers
Posts35
JoinedJul 29, 2009

Samson I found why the Editor is getting stuck...

In Editor.cpp

The edit mode does a check only if you exit the editor first then try to reenter then type something.

Which means, you can by-pass the MAX amount of lines, when you go to save, bam, crash.


-- With the Overland, I don't know how to exactly get back to the overland map. once you leave it. Can you on your stock code, leave the map and reenter it? If so, how do you venture back using the GOTO command.

Goto 50000 just leads you to the "Really bad Description".
       
Post is unread #6 Aug 1, 2009, 3:30 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

Oh, you used the goto command? To use that to get back to a map, you need to do: goto <mapname> [x] [y]

That editor thing sounds like a pretty big screwup. I really haven't done much to that code other than std::string updates so I wonder if that's also the case with the SmaugFUSS code as well.
       
Post is unread #7 Aug 1, 2009, 3:36 pm   Last edited Aug 1, 2009, 4:14 pm by apocalypticNRG
Go to the top of the page
Go to the bottom of the page

apocalypticNRG
Fledgling
GroupMembers
Posts35
JoinedJul 29, 2009

That's what I'm getting from that too... It used to be a really old bug and back in the day, I fixed it relatively easy. but that was on a different editor code, from circlemud. On this one, it looks like the values don't match. Allowing you to bypass the check and enter up to the max amount, I'm going to set it really high, like over 100 and see if it bflow's. If not, then it must be a value some place else. I'll update here in a sec.


EDIT:

It seems the board gets corrupted somehow too. After putting the max_line to 120, I could go as far as 120 lines, but typing /l shows signs of corrupted data. And doesn't even give me the "BUFFER FULL" check near the bottom of the code.


SCENARIO:

This is what should happen....

Its default is at 80 lines, 81 saying, hey wait, you've reached 81 lines, your buffer is full, we are going to close the editor. Giving you the buffer is full msg, and exiting back to the game.

Whats happening, once it reaches line 60, because thats the default value of the max_line. = Crash.

Even if we set max_line above 82+, it just reaches that number to meet its end once again.

What we want to do here, is set it to 81, do the check for over 80, and once its reached, it closes, giving the buff full msg, and returning back to the game.


Theory:
if( edit->size + argument.length(  ) + 1 >= MSL )
      print( "Your buffer is full.\r\n" );
   else
   {
      if( argument.length(  ) > 80 )
      {
         mudstrlcpy( buf, argument.c_str(  ), 80 );
         print( "(Long line trimmed)\r\n> " );
      }
      else
         mudstrlcpy( buf, argument.c_str(  ), 80 );
      mudstrlcpy( edit->line[edit->on_line++], buf, 81 );
      if( edit->on_line > edit->numlines )
         ++edit->numlines;
      if( edit->numlines > max_buf_lines)
      {
         edit->numlines = max_buf_lines;
         print( "Buffer full.\r\n" );
         esave = true;
      }
   }



If you type in more than 80 characters, works fine, says line is trimmed etc... if you go over 80 lines there is no check.
       
Post is unread #8 Aug 1, 2009, 5:00 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

Ok. Two things.

1. Your initial mention of buffers not clearing right. That I think has been identified. In the part where the "c" argument is called to clear a buffer, the line of code reads:
memset( edit, '\0', sizeof( editor_data ) );
and it needs to become:
init_memory( &edit->line, &edit->size, sizeof( edit->size ) );


The reason being is that there's a "desc" member in the struct that is a std::string and the blind memset command obliterates that string. memset and the STL do not mix, I'm surprised this never came up, cause I clear buffers all the time with the /c argument.

2. The part at the end where it counts lines and should say the buffer is full, can you see if this makes any difference?
   if( edit->size + argument.length(  ) + 1 >= MSL - 2 )
      print( "You buffer is full.\r\n" );
   else
   {
      if( argument.length(  ) > 80 )
      {
         mudstrlcpy( buf, argument.c_str(  ), 80 );
         print( "(Long line trimmed)\r\n> " );
      }
      else
         mudstrlcpy( buf, argument.c_str(  ), 80 );
      mudstrlcpy( edit->line[edit->on_line++], buf, 81 );
      while( edit->on_line > edit->numlines )
         ++edit->numlines;
      if( edit->numlines > max_buf_lines )
      {
         edit->numlines = max_buf_lines;
         print( "Buffer full.\r\n" );
         esave = true;
      }
   }


The two things there are leaving 2 spots at the end of edit->size so you don't go right up against MSL, and a while instead of an if to bump the line number counter up.
       
Post is unread #9 Aug 1, 2009, 5:29 pm   Last edited Aug 1, 2009, 5:43 pm by apocalypticNRG
Go to the top of the page
Go to the bottom of the page

apocalypticNRG
Fledgling
GroupMembers
Posts35
JoinedJul 29, 2009

Okay... I found a solution, does it mean its right... not sure, do I care to exit the descriptor and save? not really... So here's my fix.

With your code which will include a credit.

   if( edit->size + argument.length(  ) + 1 >= MSL - 2 )
      print( "You buffer is full.\r\n" );
   else
   {
      if( argument.length(  ) > 80 )
      {
         mudstrlcpy( buf, argument.c_str(  ), 80 );
         print( "(Long line trimmed)\r\n> " );
      }
      else
         mudstrlcpy( buf, argument.c_str(  ), 80 );
      mudstrlcpy( edit->line[edit->on_line++], buf, 81 );
      while( edit->on_line > edit->numlines )
         ++edit->numlines;
      if( edit->numlines > 20 )
      {
         edit->numlines = 20;
         print( "Buffer full.\r\n" );
         return;
      }
   }


I made it 20 so i could reach it fairly quickly, I can go as high as the Max_line, just by adjusting the > 20 .... = 20.

I also added a return, so it won't close the description, but will print a buffer full. or reached your limit.

This works for the buffer flood, but doesn't seem to let me clear the buffer, and save. weird.
       
Post is unread #10 Aug 1, 2009, 5:48 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

It's not going to let you save and exit the buffer like that, the "esave" flag was mean to trigger it to save once it had been determined the buffer was full. You've now cut that off from happening, it's the next block of code right below the block we're looking at:
   if( esave )
   {
      d->connected = CON_PLAYING;

      if( !last_cmd )
         return;

      ( *last_cmd ) ( this, "" );
      return;
   }


It looks weird but basically it drops down, checks to see if there was a "last command" issued, and if so, calls it with an empty argument. All of the hooks elsewhere that deal with handling the buffer contents will trigger their code to copy the contents out to the final destination and properly end the editing session.

You need to keep in mind this editor code is used by more than just the menu OLC or the OLC in general, other places will too and trapping the person inside the buffer isn't going to work out well :)
       
Post is unread #11 Aug 1, 2009, 7:16 pm
Go to the top of the page
Go to the bottom of the page

apocalypticNRG
Fledgling
GroupMembers
Posts35
JoinedJul 29, 2009

  if( edit->size + argument.length(  ) + 1 >= MSL - 2 )
      print( "You buffer is full.\r\n" );
   else
   {
      if( argument.length(  ) > 80 )
      {
         mudstrlcpy( buf, argument.c_str(  ), 80 );
         print( "(Long line trimmed)\r\n> " );
      }
      else
         mudstrlcpy( buf, argument.c_str(  ), 80 );
      mudstrlcpy( edit->line[edit->on_line++], buf, 81 );
      while( edit->on_line > edit->numlines )
         ++edit->numlines;
      if( edit->numlines > max_buf_lines )
      {
         edit->numlines = 40;
         print( "Buffer full.\r\n" );
         esave = true;
      }
   }

      
   

   if( esave )
   {
      d->connected = CON_PLAYING;

      if( !last_cmd )
         return;

      ( *last_cmd ) ( this, "" );
      return;
   }
   print( "> " );
}


This right here works great, only thing I can't do right now is clear the buffer and save.
       
Post is unread #12 Aug 1, 2009, 7:39 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

This piece:
      if( !str_cmp( cmd, "c" ) )
      {
         memset( edit, '\0', sizeof( editor_data ) );
         
         edit->numlines = 0;
         edit->on_line = 0;
         print( "Buffer cleared.\r\n> " );
         return;
      }


Needs to be come this:
      if( !str_cmp( cmd, "c" ) )
      {
         init_memory( &edit->line, &edit->size, sizeof( edit->size ) );
         
         edit->numlines = 0;
         edit->on_line = 0;
         print( "Buffer cleared.\r\n> " );
         return;
      }


If you're unable to save because you tried to clear the buffer first, this will fix that. Or should. If not then I don't know what else is messed up because the /s block does the exact same thing as the esave block at the bottom.
       
Post is unread #13 Aug 1, 2009, 7:46 pm   Last edited Aug 1, 2009, 7:59 pm by apocalypticNRG
Go to the top of the page
Go to the bottom of the page

apocalypticNRG
Fledgling
GroupMembers
Posts35
JoinedJul 29, 2009

Yeah, I can save just fine, I can delete, run any other command, going to try this bit of code out and see.

EDIT:

Awesome Job Samson, this took care of everything. The editor now runs like it should. Thanks!!!

EDIT2:

Yep, found no problems, except now it doesn't show a buffer full. But it doesn't crash it. And spamming doesn't seem to crash it either.

EDIT3:

Yes, it does show buff full!! Just have to set the max_buff line to the line you want it to say its full.

Samson, may want to include this change in your 2.1.3, I think I'm the only one so far who's dl'd it.


Man awesome awesome stuff.... good thing this is fixed.
       
Post is unread #14 Aug 1, 2009, 8:05 pm   Last edited Aug 1, 2009, 8:06 pm by apocalypticNRG
Go to the top of the page
Go to the bottom of the page

apocalypticNRG
Fledgling
GroupMembers
Posts35
JoinedJul 29, 2009

SUMMARY OF THE FIX CODE:

Replace old with...

Around line <--- 1330 in [editor.cpp ]
      if( !str_cmp( cmd, "c" ) )
      {
         init_memory( &edit->line, &edit->size, sizeof( edit->size ) );
         
         edit->numlines = 0;
         edit->on_line = 0;
         print( "Buffer cleared.\r\n> " );
         return;
      }

Around line <--- 1595 [Editor.cpp]

if( edit->size + argument.length(  ) + 1 >= MSL - 2 )
      print( "You buffer is full.\r\n" );
   else
   {
      if( argument.length(  ) > 80 )
      {
         mudstrlcpy( buf, argument.c_str(  ), 80 );
         print( "(Long line trimmed)\r\n> " );
      }
      else
         mudstrlcpy( buf, argument.c_str(  ), 80 );
      mudstrlcpy( edit->line[edit->on_line++], buf, 81 );
      while( edit->on_line > edit->numlines )
         ++edit->numlines;
      if( edit->numlines > max_buf_lines )
      {
         edit->numlines = max_buf_lines;
         print( "Buffer full.\r\n" );
         esave = true;
      }
   }

      
   
   if( esave )
   {
      d->connected = CON_PLAYING;

      if( !last_cmd )
         return;

      ( *last_cmd ) ( this, "" );
      return;
   }
   print( "> " );
}
       
Post is unread #15 Aug 1, 2009, 8:10 pm   Last edited Aug 1, 2009, 8:13 pm by apocalypticNRG
Go to the top of the page
Go to the bottom of the page

apocalypticNRG
Fledgling
GroupMembers
Posts35
JoinedJul 29, 2009

This does fix the code from crashing, but doesn't take care of the bug.

The real problem may have originated from player.cpp @ 912

When it reaches the buffer amount, it tries STRFREE ---- Which is calling a NULL value.

And I don't think pointers can point to a NULL.



EDIT:

So far I can't reproduce the bug. Maybe after setting the Max_line back to 60, it took care of that problem.

So congrats! Samson, your the shit :).
       
Pages:<< prev 1 next >>