MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / refreshTreeList

Function refreshTreeList

src/OpenLoco/src/Ui/Windows/TerraForm.cpp:210–248  ·  view source on GitHub ↗

0x004BB63F

Source from the content-addressed store, hash-verified

208
209 // 0x004BB63F
210 static void refreshTreeList(Window& self)
211 {
212 auto treeCount = 0;
213 for (uint16_t i = 0; i < ObjectManager::getMaxObjects(ObjectType::tree); i++)
214 {
215 auto treeObj = ObjectManager::get<TreeObject>(i);
216 if (treeObj == nullptr)
217 {
218 continue;
219 }
220 self.rowInfo[treeCount] = i;
221 treeCount++;
222 }
223
224 self.rowCount = treeCount;
225 auto rowHover = -1;
226
227 if (getGameState().lastTreeOption != 0xFF)
228 {
229 for (auto i = 0; i < self.rowCount; i++)
230 {
231 if (getGameState().lastTreeOption == self.rowInfo[i])
232 {
233 rowHover = getGameState().lastTreeOption;
234 break;
235 }
236 }
237 }
238
239 if (rowHover == -1 && self.rowCount != 0)
240 {
241 rowHover = self.rowInfo[0];
242 }
243
244 self.rowHover = rowHover;
245
246 updateActiveThumb(self);
247 updateTreeColours(self);
248 }
249
250 static void removeTreeGhost();
251

Callers 2

tabResetFunction · 0.85
openFunction · 0.85

Calls 3

getMaxObjectsFunction · 0.85
updateTreeColoursFunction · 0.85
updateActiveThumbFunction · 0.70

Tested by

no test coverage detected