delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/24/04:18:58

Message-ID: <33D10773.45C94A8D@gapeach.com>
Date: Sat, 19 Jul 1997 14:29:08 -0400
From: Jacob Martin <jake AT gapeach DOT com>
Reply-To: jake AT gapeach DOT com
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp,rec.games.programmer
Subject: declaring/passing ptrs to @D arrays
NNTP-Posting-Host: ip196.iainc.net
Lines: 92
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

how do I do this?  I keep getting bad comilation stuff....

I thought I had it right, then I started the whole..."hmmm, add another
star?hmmm remove a star...hmmm"

and I finally got it to compile( halfway) but it gives me this:

E:\game>gxx test.cc -lj -lm
e:/djgpp/tmp\ccdaaaaa(.text+0xc0):test.cc: undefined reference to
`mapmaker(int
*, int)'
e:/djgpp/tmp\ccdaaaaa(.text+0x170):test.cc: undefined reference to
`frenchtile(i
nt *, buffer_rec *, bufinde *, int)'

Here's the relevant  code...

void frenchtile(int *,buffer_rec *bufferptr,bufinde *btp, int);
void mapmaker (int *,int) ;
int main(void) {


int *mmp;
int mapmake[100][256];

mmp=&mapmake[0][0];

mapmaker(mmp, size);
frenchtile(mmp,bufferptr,btp,page);

void frenchtile(int **mmp,buffer_rec *bufferptr,bufinde *btp,int page)
{

        int loop;
        int index;
        int x,y=0;
        for (loop=0;loop< 256;loop++)  {

                if ((loop%17)==0)
                 {
                 y=(32*(loop/17));
                 }
                if (x==544) x=0;
                if (*(*(mmp+page)+loop)!=NULL)
                   {

                index=*(*(mmp+page)+loop);

screen_blit_buff_to(x,y,bufferptr,btp[index].bx1,btp[index].by(THIS PART
I couldn't paste, but it don't matter);
                    }


                 x+=32;
        }
}

void mapmaker (int **mmp, int size)  {


  char width[100];
  int loop,count,loopa,first,second;

  /*SET LAND AREA*/
  for (loop=0;loop < 100; loop ++)  {
        width[loop]=rand() % 2;
        }
  /*REMOVE SIZE AMOUNT OF LAND*/
  for (loop=0;loop< 98;loop=loop+size)  {
        width[loop]=0;
       }
  /*MAKE EACH SCREEN WITH LAND FLAG*/
  for (loop=0;loop<100;loop++)  {
        if (width[loop]==1)  {
             first=1 + rand() % 8;
            second=10 + rand() % 17;
             while (count < 10)  {
             for (loopa=(10*count)+first;loopa <=  (10 *
count)+second;loopa++) mmp[loop][loopa]=1;

               count ++;
              } /*END WHILE*/
        }/*end IF*/
}/* end for*/

}


Thanks...

Jake ...

- Raw text -


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