20 Jun, 2009, Banner wrote in the 1st comment:
Votes: 0
I keep dropping this error trying to compile with pretty much any addition in the latest SMAUG. I'll admit it's stumped me because I'm not a proficient C++ programmer and I've never seen this before:

make -s smaug
Compiling o/changes.o….
changes.c: In function 'void fread_change(CHANGE_DATA*, FILE*)':
changes.c:66: error: invalid conversion from 'const char*' to 'char*'
changes.c: In function 'void do_addchange(CHAR_DATA*, char*)':
changes.c:220: error: invalid conversion from 'const char*' to 'char*'
changes.c:221: error: invalid conversion from 'const char*' to 'char*'
changes.c:222: error: invalid conversion from 'const char*' to 'char*'
changes.c:223: error: invalid conversion from 'const char*' to 'char*'
make[1]: *** [o/changes.o] Error 1
make: *** [all] Error 2


if( !str_cmp( word, "End" ) )
{
if( !chg->change )
chg->change = STRALLOC( "Error - Tell Zarius" ); //66
return;
}
break;



if( strlen( argument ) < 10 )
{
send_to_char( "The change description must be longer than 10 chars.\n\r", ch );
return;
}

totChanges++;

CREATE( chg, CHANGE_DATA, 1 );
LINK( chg, first_change, last_change, next, prev );
chg->change = STRALLOC( argument ); //220
chg->coder = STRALLOC( ch->name ); //221
chg->date = STRALLOC( current_date( ) ); //222
chg->type = STRALLOC( capitalize( arg1 ) ); //223
chg->mudtime = current_time;

send_to_char( "Change Added.\n\r", ch );
sprintf( buf, "&z<&CCHANGE&z> &w%s change &R#%d &wadded, type '&Rchanges&w' to see the details.&D\n\r",
capitalize( arg1 ), totChanges );
do_echo( ch, buf );
save_changes( );
return;
}




EDIT: I solved the above by changing

char *change;
char *coder;
char *date;
char *type; //Added to show type of change - Zarius

to:
const char *change;
const char *coder;
const char *date;
const char *type; //Added to show type of change - Zarius

although I do not understand why char no longer works under c++?

However, I now have this issue:

Compiling o/changes.o….
changes.c: In function 'void do_changes(CHAR_DATA*, const char*)':
changes.c:552: error: invalid conversion from 'const char*' to 'char*'
changes.c:552: error: initializing argument 1 of 'char* change_justify(char*, int)'
changes.c:576: error: invalid conversion from 'const char*' to 'char*'
changes.c:576: error: initializing argument 1 of 'char* change_justify(char*, int)'
make[1]: *** [o/changes.o] Error 1
make: *** [all] Error 2

for( chg = first_change; chg; chg = chg->next )
{
if( ( i > (number - 11) ) && ( i < number ) && ( i < totChanges ) )
{
pager_printf( ch, "&z[&R%3d&z] %-11s &c*%-6s &P%-5s &w%-45s&d\n\r", ( i + 1 ), chg->coder,
chg->date, chg->type, change_justify( chg->change, 45 ) ); // 552
}
i++;
}
}



continue;
if( !str_cmp( arg, "typo" ) && str_cmp( chg->type, "typo" ) )
continue;

pager_printf( ch, "&z[&R%3d&z]&z %-11s &c*%-6s &P%-5s &w%-55s&D\n\r", ( i + 1 ), chg->coder,
chg->date, chg->type, change_justify( chg->change, 45 ) ); // 576
i++;
}
}
20 Jun, 2009, Banner wrote in the 2nd comment:
Votes: 0
Okay, fixed that one too! However, how come with the dynamic command linking library or whatever its called that's in the new smaug/swrfuss you still have to declare the DECLARE_DO_FUN in mud.h for the command to be able to be cedit'd ingame? The dynamic command library in SW:GI isn't like that.
20 Jun, 2009, Runter wrote in the 3rd comment:
Votes: 0
For others reading this who want to know what the errors are: C++ has more strict rules on type casting. His specific errors could have came from something like this:

Invalid conversation errors:
const char *c = "Meh"
char *p = c; // invalid conversion.


To fix that:
const char *c = "Meh"
char *p = (char*)c;
20 Jun, 2009, kiasyn wrote in the 4th comment:
Votes: 0
Runter: That's not a fix thats a dirty hack. :P
21 Jun, 2009, Banner wrote in the 5th comment:
Votes: 0
kiasyn said:
Runter: That's not a fix thats a dirty hack. :P

Lol. :P

Can anyone answer my second question?
21 Jun, 2009, Runter wrote in the 6th comment:
Votes: 0
kiasyn said:
Runter: That's not a fix thats a dirty hack. :P


There wasn't ever anything to "fix" in the first place. The bulk of C code in the repository is completely a dirty hack. To do the same thing in C++ as what was being done in C that "dirty hack" is precisely the code it would take. It just makes your implicit (more elegant?) hacks into explicit ones.
21 Jun, 2009, Runter wrote in the 7th comment:
Votes: 0
Banner said:
kiasyn said:
Runter: That's not a fix thats a dirty hack. :P

Lol. :P

Can anyone answer my second question?


I'm not sure what your second question is.

# changes.c:552: error: invalid conversion from 'const char*' to 'char*'
# changes.c:552: error: initializing argument 1 of 'char* change_justify(char*, int)'

That line means you are trying to pass a const char * to something that wants a char *. You can force a cast like I said earlier if you are sure you want to do that.

You're looking at some type of fix like:
change_justify( (char *) arg, 10)

or something similar.
21 Jun, 2009, Banner wrote in the 8th comment:
Votes: 0
I fixed that. I'm referring to adding commands. I thought the purpose of the dynamic code or whatever was so that you add in a do_blah and then you can cedit it ingame without having to add the do_fun to mud.h and (previously) to tables.c? On my SWR, I can make a command, make and copyover and then I can add it ingame with cedit. With this smaug, I make the command, have to add the do_fun to mud.h, make and copyover and then I can use it. What gives?
21 Jun, 2009, Runter wrote in the 9th comment:
Votes: 0
Banner said:
I fixed that. I'm referring to adding commands. I thought the purpose of the dynamic code or whatever was so that you add in a do_blah and then you can cedit it ingame without having to add the do_fun to mud.h and (previously) to tables.c? On my SWR, I can make a command, make and copyover and then I can add it ingame with cedit. With this smaug, I make the command, have to add the do_fun to mud.h, make and copyover and then I can use it. What gives?


I don't know the specifics of that codebase. Sorry, maybe someone else can help you. :P
21 Jun, 2009, Metsuro wrote in the 10th comment:
Votes: 0
I believe its because of the fact the mud complies in C++ and the delcare thing is a macro I think to force the old c functions to work under C++?
21 Jun, 2009, Guest wrote in the 11th comment:
Votes: 0
And which version of Smaug are you using? "The latest" is a bit vague.
21 Jun, 2009, Banner wrote in the 12th comment:
Votes: 0
Samson said:
And which version of Smaug are you using? "The latest" is a bit vague.

Smaug 1.9.
21 Jun, 2009, Sharmair wrote in the 13th comment:
Votes: 0
Banner said:
Samson said:
And which version of Smaug are you using? "The latest" is a bit vague.

Smaug 1.9.

Ok, I checked ftpgame.org just to be sure they did not release a new version I was not aware of
and the newest SMAUG is still smaug 1.8b. And I am pretty sure it is neither C++ ready or uses
the command hack you are talking about. You are probably using some derivative like FUSS or
something.
21 Jun, 2009, Guest wrote in the 14th comment:
Votes: 0
Most likely he's referring to SmaugFUSS 1.9. Smaug 1.8b is the latest official release and does not contain the dynamic command code.

The reason the DECLARE_DO_FUN stuff was left in was because it's easier to add code and rely on that than just add it, and have to stick declarations in other places that may reference it.
21 Jun, 2009, Kayle wrote in the 15th comment:
Votes: 0
Banner said:
I fixed that. I'm referring to adding commands. I thought the purpose of the dynamic code or whatever was so that you add in a do_blah and then you can cedit it ingame without having to add the do_fun to mud.h and (previously) to tables.c? On my SWR, I can make a command, make and copyover and then I can add it ingame with cedit. With this smaug, I make the command, have to add the do_fun to mud.h, make and copyover and then I can use it. What gives?


If you're using SmaugFUSS 1.9 You need to make sure all args passed into functions are const char *argument. Especially the do_ functions. It won't add them automatically if they don't match the definition of a do_fun which is void do_something( CHAR_DATA *ch, const char *argument )
21 Jun, 2009, Banner wrote in the 16th comment:
Votes: 0
Kayle said:
Banner said:
I fixed that. I'm referring to adding commands. I thought the purpose of the dynamic code or whatever was so that you add in a do_blah and then you can cedit it ingame without having to add the do_fun to mud.h and (previously) to tables.c? On my SWR, I can make a command, make and copyover and then I can add it ingame with cedit. With this smaug, I make the command, have to add the do_fun to mud.h, make and copyover and then I can use it. What gives?


If you're using SmaugFUSS 1.9 You need to make sure all args passed into functions are const char *argument. Especially the do_ functions. It won't add them automatically if they don't match the definition of a do_fun which is void do_something( CHAR_DATA *ch, const char *argument )
They are.
21 Jun, 2009, Kayle wrote in the 17th comment:
Votes: 0
I don't know what to tell you then. Works fine on mine, and I'm pretty sure it works fine on the stock base as well.
21 Jun, 2009, Banner wrote in the 18th comment:
Votes: 0
Kayle said:
I don't know what to tell you then. Works fine on mine, and I'm pretty sure it works fine on the stock base as well.
Apparently not, because both Igabod and I have the stock one and it didn't work. He had to add the do_fun in mud.h as well.
22 Jun, 2009, Igabod wrote in the 19th comment:
Votes: 0
and samson just said that it was left that way for a reason, see post 14 on page 1 of this thread

[edit to correct something]
0.0/19