| 144 | } |
| 145 | |
| 146 | void Selection::insert(GridInfo info) |
| 147 | { |
| 148 | PROFILE_SCOPE( TerrainEditor_Selection_Insert ); |
| 149 | |
| 150 | //validate(); |
| 151 | // get the index into the hash table |
| 152 | U32 index = getHashIndex(info.mGridPoint.gridPos); |
| 153 | |
| 154 | // if there is an existing linked list, make it our next |
| 155 | info.mNext = mHashLists[index]; |
| 156 | info.mPrev = -1; |
| 157 | |
| 158 | // if there is an existing linked list, make us it's prev |
| 159 | U32 indexOfNewEntry = size(); |
| 160 | if(info.mNext != -1) |
| 161 | (*this)[info.mNext].mPrev = indexOfNewEntry; |
| 162 | |
| 163 | // the hash table holds the heads of the linked lists. make us the head of this list. |
| 164 | mHashLists[index] = indexOfNewEntry; |
| 165 | |
| 166 | // copy us into the vector |
| 167 | push_back(info); |
| 168 | //validate(); |
| 169 | } |
| 170 | |
| 171 | bool Selection::remove(const GridInfo &info) |
| 172 | { |
no test coverage detected