Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Posible bug in two dimension array, or am i doing something wrong?

Author
Message
slu
9
Years of Service
User Offline
Joined: 7th Aug 2015
Location:
Posted: 7th Aug 2015 16:52
Hi, when i resize two dimensional Array to bigger size than it was before, error appears.
It happens even if i resize it to smaller and then resize it back to previous size:

error

So my question is:
1)how to fix it
2)is it a bug, or I am doing something wrong?


Eqqman
9
Years of Service
User Offline
Joined: 15th Jul 2015
Location:
Posted: 8th Aug 2015 09:24
Try using the insert() and remove() array functions to resize the array. This code from my own project does that. It's a little bit tricky when you have a 2D array, since first you have to add empty arrays of integers and then integers into those arrays.

In the code, IsoEng_emptyRow is an array of the data type represented by IsoEng_emptyTile.

Goo Goo G'Joob!
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 8th Aug 2015 15:14
I think you have to resize the dimensions separately..



Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt

Login to post a reply

Server time is: 2024-11-24 11:21:08
Your offset time is: 2024-11-24 11:21:08