level files and variables

This is a discussion on level files and variables within the Windows Programming forums, part of the Platform Specific Boards category; I have created a program that plays a little game and the level is stored in a file. the data ...

  1. #1
    Registered User canine's Avatar
    Join Date
    Sep 2001
    Posts
    125

    level files and variables

    I have created a program that plays a little game and the level is stored in a file. the data in that file is extracted and seperated into an array of different varaibles. How should I declare that aray so that there is enough space for big complicated variables(more numbers to extract) and to save space when using a small level(less numbers)?
    The game is here it is not all that reliable and uses a aray declared with like 500 slots or something
    Game
    Game Level Maker
    In a perfect world every dog would have a home and every home would have a dog.
    Visit My Web Site, Canine Programming
    I use Win32 API

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571

    Re: level files and variables

    Originally posted by canine
    I have created a program that plays a little game and the level is stored in a file. the data in that file is extracted and seperated into an array of different varaibles. How should I declare that aray so that there is enough space for big complicated variables(more numbers to extract) and to save space when using a small level(less numbers)?
    The game is here it is not all that reliable and uses a aray declared with like 500 slots or something
    Game
    Game Level Maker
    I didn't have time to look at your game. The obvious suggestion would to be dynmically allocate your arrays. Read in the first byte to tell you how many items follow it , then allocate enough room to store it. Remember to free the memory also!!

  3. #3
    Registered User
    Join Date
    Aug 2002
    Posts
    57
    <*talks in a arrogant fashion*>array, srarry. Use an STL vector. More reliable and customizable. It lets you change the size of the array in real time.
    "A Programmer being told to 'go to' hell sees the 'go to' part of the sentence as the worst part." - Master Foto

  4. #4
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,639
    vector shmector, use a linked list.
    Code:
    if( numeric_limits< byte >::digits != bits_per_byte )
        error( "program requires bits_per_byte-bit bytes" );
    24bbs.cpp

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Static variables and header files
    By drrngrvy in forum C++ Programming
    Replies: 8
    Last Post: 12-02-2006, 12:27 PM
  2. Replies: 3
    Last Post: 11-28-2006, 02:44 PM
  3. Variables in header files
    By Overlord in forum C++ Programming
    Replies: 5
    Last Post: 10-15-2006, 06:43 AM
  4. make variables visible on multiple files
    By jagerhans in forum C++ Programming
    Replies: 4
    Last Post: 08-28-2004, 06:32 PM
  5. variables across files
    By Hunter2 in forum C++ Programming
    Replies: 13
    Last Post: 07-23-2002, 10:58 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21