View Single Post
  #3  
Old 06-03-2003, 06:54 AM
krich
Hill Giant
 
Join Date: May 2003
Location: The Great Northwest
Posts: 150
Default

I've hacked my CVS parser.cpp (among others) to work with 0.4.3, so a diff would cause confusion. The code is exceedingly simple, so I'll just do it the old fashioned way.

In void Parser::LoadScript(int npcid, const char *zone) add the variable comment in variable declarations in beginning of subroutine around line 980 or so:

Code:
int quote = 0;
int comment = 0;  //ADD THIS LINE
//int ignore = 0;
int line_num = 0;

Then add/modify the following lines around line 1075 or so:

Code:
if (buffer[i] == '\n') line_num++;
if (buffer[i] == '/' && buffer[i+1] == '*') { comment = 1; }  //ADD THIS LINE
if ((strrchr(charIn,buffer[i]) || quote) && !comment) {  //MODIFY THIS LINE
       temp[p] = buffer[i];
       p++;
}
if (buffer[i] == '/' && buffer[i-1] == '*') { comment = 0; }  //ADD THIS LINE
if (buffer[i] == '\"') {

That should do it. Essentially it prevents any comment from being populated into temp, which is where the commands are being assembled one character at a time.

Regards,

Krich
Reply With Quote