Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: loading set from file

  1. #11
    I don't think it's as much a type problem, but more of a file-format problem. If you have old version file where is
    Code:
    [someobject1]
    type=10
    (where type 10 meant grass)
    And new file
    Code:
    [someobject1]
    type=11
    (where type 11 means grass)
    Loading old file with new loader, would consider that type 10 object something else than it was meant to be.

    You need a way to distinct the 2 files. I'm not one to give you right answer to that. Clumsiest of all ways is to have version number on top, and different loading routine for each version. You can forget to change the file version from the source code, and override your work file with garbage data.

    One other way is to explain all the types at beginning of file. For example:
    Code:
    [type10]
    texture=grass.png
    burnable=true
    That might also mean new list structure for program to store this information.
    (In essence, new types will be added to the end of the list.)
    Last edited by User137; 17-07-2013 at 05:32 PM.

  2. #12
    enum range is 0-255 thanks to {$PACKENUM 1} and if I made it a class then I couldn't create hundreds of milions of them like i do now. I can't add new elements to middle of enum definition but I don't have a problem with adding them to the end

    and In file I can save enum name instead of int
    Code:
    [requires]
    3 btStone

  3. #13
    Junior Member Delphius's Avatar
    Join Date
    Jul 2013
    Location
    Salta, Argentina
    Posts
    9
    Quote Originally Posted by laggyluk View Post
    enum range is 0-255 thanks to {$PACKENUM 1} and if I made it a class then I couldn't create hundreds of milions of them like i do now. I can't add new elements to middle of enum definition but I don't have a problem with adding them to the end

    and In file I can save enum name instead of int
    Code:
    [requires]
    3 btStone
    Sorry, but I'm curious as how you're doing it. Could you be a little more expressive with the solution (at least partially) to which you arrived?
    What does the {$PACKENUM 1} and who implications you have in your design?

    Regards,
    P.S: Sorry for mi poor English.

  4. #14
    {$PACKENUM 1} tells the compiler to store enum in 1 byte instead of whatever default data size would be

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •