www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/28/15:44:12

Date: Fri, 28 Feb 1997 13:01:48 -0600
From: stefansk AT evansville DOT edu
Subject: Help with global array - more details this time
Newsgroups: comp.os.msdos.djgpp
Message-ID: <857156093.16248@dejanews.com>
Reply-To: stefansk AT evansville DOT edu
Organization: Deja News Usenet Posting Service
Lines: 35
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

     First, thanks to those people who have already replied with some
ideas...  Perhaps if I give more details I can track this thing down and
fix it...

     I'm having trouble with getting a global array to work.  I'm doing a
game as my senior project...

     The array is a 200 by 200 array of structures being used as a map.
I'm declaring it in my maingame.cpp file, as "map_square
game_map[200][200]", and then I've also got it declared in common.h as
"extern map_square game_map[200][200]"   The common.h file is being
included in all of my .cpp files, including the maingame.cpp, where it is
included before the declaration.

     If it matters, the array ends up being about 800k in size.

     I'm loading the array with a file in gameplay.cpp, and trying to use
it in gamegrfx.cpp.  I know it's loading it properly - I'm using the load
code I used in the game editor, and have also tried saving it in the game
itself right after loading it.  And since I saved it right after loading
it, I do know that the load code is being reached before I try and display
it.

     When I try and display it, the values loaded in are lost - replaced
with junk.

     I tried declaring the array as static instead, and it just contains
0's (or equivalent) for every element.  I also tried declaring it static
and extern, and that comes back with an error.

     I've checked with two professors here at UE, and neither of them can
find anything wrong.

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019