delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/05/04/15:57:03

From: "Ilari Kaartinen" <ililka AT mantta DOT fi>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: What's the best way to make a 2d map
Date: Tue, 4 May 1999 22:03:49 +0300
Organization: TPO Internet
Lines: 44
Message-ID: <7gnfvm$a63$1@news.koti.tpo.fi>
References: <JFtX2.3385$%W6 DOT 25587 AT wagner DOT videotron DOT net>
NNTP-Posting-Host: s.kurvi.phpoint.net
X-Newsreader: Microsoft Outlook Express 4.72.3110.5
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

If there is a limit for the map (like x 100 y 100)
You could do like this:

#define MAXX 100
#define MAXY 100

char map[MAXX][MAXY];

...

if(something<MAXX)
    do_something();
else
    something=MAXX;

...

 - Ilari

OmniMeta kirjoitti viestissä ...
>Hi, I need to set-up a map like :
>
>int sx=100,sy=100;
>char map[sx][sx];
>
>I know I can use :
>
>char (*map)[sx]=new[sx][sy];
>
>But i want to change this array size anytime in the game. So I must
>delete []map;
>then remake the array.
>
>Do it be better to do this using malloc and realloc ?
>how can I set up a 2 and a 3 dimentional array using malloc ? and how I
>resize it with realloc ?
>
>then how can I get access to it ?
>
>please help
>
>


- Raw text -


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