Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ SMAUG
➜ SMAUG coding
➜ Fread from Player file
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Nargsbrood
(54 posts) Bio
|
| Date
| Fri 26 Oct 2007 11:44 PM (UTC) Amended on Fri 26 Oct 2007 11:45 PM (UTC) by Nargsbrood
|
| Message
| I am having an issue with reading in from a player file... the section of the player file that i am trying to read is the text in bold below:
Spell 100 'weaken'
Spell 100 'winter mist'
Spell 100 'word of recall'
Spell 100 'Wrath of Dominus'
Killed 24836 1
Killed 2407 1
Killed 21045 1
Killed 4000 1
Map 'Dwarven Daycare'
Map 'Haon Dor'
Map 'Tullfuhrzky Manor'
Map 'Sewer'
Map 'The Astral Plane'
MaxColors 111
i tried both of the below to read in the map lines:
if( !strcmp( word, "Map" ) )
{
ch->pcdata->atlas[mapcnt++].area = fread_word( fp );
fMatch = TRUE;
break;
}
AND
KEY( "Map", ch->pcdata->atlas[mapcnt++].area, fread_word( fp ) ) ;
but they both produce the same result. When I print the contents that were saved into the ch->pcdata->atlas array I get
Atlas
-----------
END
END
END
END
END
The number of items read from the player file is correct but the contents is wrong.
Why is it saving the contents as 'End' ?
Any help is much appreciated | | Top |
|
| Posted by
| Nargsbrood
(54 posts) Bio
|
| Date
| Reply #1 on Sat 27 Oct 2007 01:02 AM (UTC) Amended on Sat 27 Oct 2007 01:12 AM (UTC) by Nargsbrood
|
| Message
| nevermind - i believe I may have thought of why it's not working. I am assigning the address of fp to ->atlas[x].area and so if the value of fp is changing but atlas that points to it is still pointing to the same location.
the last thing that fp gets assigned is the word END and so every element in my array is pointing to FP. they'll all always have the same value since they all point to the same address.
i need to malloc some space for it and then do a string copy into it? kiddie halloween stuff now, i'll try this later.
sry for the trouble | | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
10,294 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top