C Question...

From: Tim Yohn (yohnt@southwind.net)
Date: 04/29/96


	I'm working on adding languages and have made the following
changes thus far (note: I know the changes arn't monumental but thier
going to be followed up by a complete race system):

structs.h:
in the define's --
#define LNG_COMMON	0
#define LNG_ELVEN	1
#define LNG_DWARVEN	2
#define MAX_LANG	3
in the struct player_special_data_saved --
ubyte lang[MAX_LANG+1]; /* for storing an array of languges */
int current_lang; 	/* for storing the curerent spoken language */
int native_lang;	/* for storing the native language */

utils.h:
in the defines --
#define GET_LANG(ch, i) ((ch)->player_specials->saved.lang[i])
  /* hopefully to be used in a loop checking if you actually know that
     lang */
#define SET_LANG(ch, i) {(ch)->player_specials->saved.lang[i] = i;}
  /* hopefully to be used in setting a language when a new one is learned
     */
#define GET_NATIVE_LANG(ch) ((ch)->player_specials->saved.native_lang)
  /* this is where I'm having a problem I belive... It should return and
     int that points to the characters native language */
#define SET_NATIVE_LANG(ch) {(ch)->player_specials->saved.native_lang = i;}
  /* hopefully this sets the native language corectly */

#define CAN_SPEAK_COMMON(ch)... These arn't used yet so I knot thier not a
problem...

act.informative.c:
in the ACMD(do_score) --
Added the following...
After the "this ranks you as ... (level...)"

sprintf(buf, "%sYour native language is: %s\r\n", buf,
        GET_NATIVE_LANG(ch));

act.lang.c (a new one so I don't have to clutter up existing code):
ACMD(do_senative) {
  SET_NATIVE_LANG(ch, LNG_COMMON);
  /* This does nothing but set the native language for testing */
}

ACMD(do_speak) {
  sprintf(buf, "This isn't imp'ed yet.../r/n");
  send_to_char(buf, ch);

Ok, so here's the problem.  I've exausted all my coding experiance so I
figure it's time to ask the experts...  When compiling I get an error:
act.informative.c:669: warning: format argument is not a pointer (arg 4)

That line corisponds to the change I made in ACMD(do_score) and if score
is ran right away the it displays (null) as the language (which is fine,
nothing is set in it yet) but after doing a 'senative' (see
ACMD(do_senative) above) typing score produces a segmentation fault.

I would be happy to give more information but I don't have any experiance
running gdb (I know I've got it and that's what helped find it was a
segmentation fault, I just don't know how to use it...)

I belive it has something to do what that warning but I can't fingure it
out...

Any help or pointers on how languages are imp'ed on other systems please
let me know...

TIA

--
Glutious Numbious Maximus - Numbuttitis:
  The failure to feel you butt after staring at a terminal all day long...
--
Tim Yohn  (yohnt@southwind.net)



This archive was generated by hypermail 2b30 : 12/18/00 PST