Difference between revisions of "Talk:Data structures for the map"

From RogueBasin
Jump to navigation Jump to search
(questioning methods)
 
m (typo)
Line 1: Line 1:
"So, there are lists of Objects, Items and Monsters on the given level. Every element of these lists must also store the position. Every time you want to know what items lie on given square, you have to iterate trough the list of all items and take the ones with proper position set. It might seem slow, but you won't have to do it often."
"So, there are lists of Objects, Items and Monsters on the given level. Every element of these lists must also store the position. Every time you want to know what items lie on given square, you have to iterate trough the list of all items and take the ones with proper position set. It might seem slow, but you won't have to do it often."


Why can't use pointers (or some sort of reference if in a non C language) to reference objects in our 2d array. Some of the coding is done a certain way to make it all fast, and then we have to scan through arrays to find all nearby objects and mobs.
Why shouldn't we use pointers (or some sort of reference if in a non C language) to reference objects in our 2d array. Some of the coding is done a certain way to make it all fast, and then we have to scan through arrays to find all nearby objects and mobs.

Revision as of 01:40, 30 March 2009

"So, there are lists of Objects, Items and Monsters on the given level. Every element of these lists must also store the position. Every time you want to know what items lie on given square, you have to iterate trough the list of all items and take the ones with proper position set. It might seem slow, but you won't have to do it often."

Why shouldn't we use pointers (or some sort of reference if in a non C language) to reference objects in our 2d array. Some of the coding is done a certain way to make it all fast, and then we have to scan through arrays to find all nearby objects and mobs.