Patrick Dughi wrote: > > On Fri, 19 May 2000, Zednanreh Solo wrote: > > > I'm having a problem with ascii pfiles that hasn't been brought up yet. I > > fixed up diskio.c with no problems. I'm usinv MSVC++6 with Oasis 2.x and bpl > > 17. Heres the only error: > > > > db.c > > c:\circle30bpl17\src\db.c(2202) : error C2106: '=' : left operand must be > > l-value > > > > case 'N': > > if(!strcmp(tag, "Name")) > > // GET_NAME(ch) == line; > > // strcpy(GET_NAME(ch), line); > > GET_NAME(ch) = str_dup(line); // <------------ > > break; > > The line you point to is fine. However, this code demonstrates a > fundamental misunderstanding of c programming, aside from memory usage and > others. As does your fundamental misunderstanding of the //'s at the left being comments. > As a learning experience, lets go though it step by step. > > 1 case 'N': > 2 if(!strcmp(tag, "Name")) [snip commented lines] > 5 GET_NAME(ch) = str_dup(line); > 6 break; > > 1. This line is fine; it's correctly closed @ line 6. > 2. This line is also correct, strcmp returns 0 if the match is > equal - so checking for !strcmp() means it will show up as true if it > matches "Name" - but lets look at the rest of this; you've used indenting > as if it is what delimits an 'if' block. [snip commented out 3 and 4 lines] > Good news. Line 5 is kosher. It should probably be the one (and > only) thing within the if braces. It's also what you want. nope that line is the problem, a quick snip from utils.h: #define GET_PC_NAME(ch) ((ch)->player.name) #define GET_NAME(ch) (IS_NPC(ch) ? \ (ch)->player.short_descr : GET_PC_NAME(ch)) As you can see GET_NAME may not return a constant address, hence it's not an lvalue, some compilers may happily accept it where others don't. The line can safely (as you only load pc chars using ascii pfiles) to: GET_PC_NAME(ch) = strdup(line); Cheers, Chris +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 04/10/01 PDT