[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  SMAUG coding
. . -> [Subject]  Fread from Player file

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: Fread from Player file
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please).
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Posted by Nargsbrood   (54 posts)  [Biography] bio
Date Sat 27 Oct 2007 01:02 AM (UTC)  quote  ]

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
[Go to top] top

Posted by Nargsbrood   (54 posts)  [Biography] bio
Date Fri 26 Oct 2007 11:44 PM (UTC)  quote  ]

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
[Go to top] 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.


1,015 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]