Odd bug with ints

Posted by Dace K on Fri 07 Apr 2006 04:35 AM — 5 posts, 18,724 views.

Canada #0
In the pc_data struct, I have the following defined:

	int		missiondata[18];
	int		gquest[18];
	int			score;	/* current player score */



For some reason, it's reading missiondata[18] as gquest[0], and gquest[18] as score.

Any thoughts?

Missiondata is saved in the pfile, gquest and score are not.
Amended on Fri 07 Apr 2006 04:36 AM by Dace K
USA #1
What is reading what as what where? Your question makes no sense to me. :-P

Maybe you're reading into position 18, which is in fact the next data member; for instance gquest[18] is in fact score because it's one past the legal array size.
Canada #2
Oh, WHOOPS. :/.

These should be defined with [19], shouldn't they? :P

What I meant was, the value assigned for gquest[18] was the value supposed to be used as score.
Amended on Fri 07 Apr 2006 04:54 AM by Dace K
USA #3
They should be defined as [19] if you want there to be 19 elements: #0, #1, #2, ..., #18. I don't know what you're doing with them so I'm not sure what the right answer is here...
Canada #4
Yeah, it is.
Thanks - I can't believe I didn't see that :P