Array with negative indexes

前端 未结 5 1514
时光说笑
时光说笑 2020-12-11 08:49

I have an array which I\'m using to store map data for a game I\'m working on.

MyMapType[,,] map; 

The reason I\'m using a fixed array inst

5条回答
  •  庸人自扰
    2020-12-11 09:20

    Could you try to store a list of MyMapTime[,] in two lists:

    • one for z values of greater than or equal to 0
    • and second of negative z-values.

    The index of the tables would be the value of z. Having this would let you access quickly the xy-values for specific z-level. Of course the question is: what are your z-values? Are there sparse or dense. Even for sparse values you would end up with an array holding null values for [,].

提交回复
热议问题