[DiscordArchive] what about the case of (!cell.NoCreate()) being true ?
[DiscordArchive] what about the case of (!cell.NoCreate()) being true ?
Archived author: jackpoz • Posted: 2023-03-22T20:57:56.155000+00:00
Original source
I personally do not prefer duplicating shared logic in 2 { } so close by
Archived author: Gamemechanic • Posted: 2023-03-22T21:02:21.618000+00:00
Original source
Yea, i had the same feeling. But creating a variable when we can avoid it, doesn't feel right either.
Archived author: Gamemechanic • Posted: 2023-03-22T21:02:35.071000+00:00
Original source
```c++
if (!cell.NoCreate())
{
EnsureGridLoaded(cell);
}
else if (!IsGridLoaded(GridCoord(x, y))
{
Return;
}
getNGrid(x, y)->VisitGrid(cell_x, cell_y, visitor);
```
Archived author: jackpoz • Posted: 2023-03-22T21:06:28.682000+00:00
Original source
you mean for the codestyle ?
Archived author: jackpoz • Posted: 2023-03-22T21:06:45.647000+00:00
Original source
because the compiler will most likely remove the variable, if you are worried about performances
Archived author: jackpoz • Posted: 2023-03-22T21:07:36.914000+00:00
Original source
we could use goto!
Archived author: Gamemechanic • Posted: 2023-03-22T21:10:10.813000+00:00
Original source
ye, and to avoid getting bad habits
Archived author: Gamemechanic • Posted: 2023-03-22T21:10:18.698000+00:00
Original source
GOTO is a beast!
Archived author: jackpoz • Posted: 2023-03-22T21:13:04.414000+00:00
Original source
I personally prefer return early when possible, or variables
Archived author: Heisenberg • Posted: 2023-03-22T21:46:34.079000+00:00
Original source
<@228947336800370689> yes