Kalwang / beginning-android-games

Automatically exported from code.google.com/p/beginning-android-games
0 stars 0 forks source link

[Chapter 8] unused parameter in clearDynamicCells() method #32

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
In the printed version of the book, chapter 8, page 392, listing 8-10, there is 
an unused parameter in clearDynamicCells() method.

I think that correct code is:
public void clearDynamicCells() {
...
}

instead of:
public void clearDynamicCells(GameObject obj) {
...
}

I take this opportunity to ask a question about getPotentialColliders() method, 
implemented in the same class: why is there a need to check for potential 
duplication in the staticCells list? Static objects set has no intersection 
with the dynamic objects one and a static thing cannot move from one cell to 
another. So, if we add a static object to the spatial hash grid only once, then 
maybe this check is unnecessary. Do I miss something? 

--- Alessandro Dal Bello ---

Original issue reported on code.google.com by alessand...@gmail.com on 11 Sep 2011 at 3:19