Переглянути джерело

Do not tick destroyed objects.

legacy
Sam Hocevar sam 15 роки тому
джерело
коміт
183b24bf51
2 змінених файлів з 7 додано та 4 видалено
  1. +4
    -2
      src/ticker.cpp
  2. +3
    -2
      src/tileset.h

+ 4
- 2
src/ticker.cpp Переглянути файл

@@ -75,7 +75,8 @@ void Ticker::TickGame(float delta_time)
/* Tick objects for the game loop */ /* Tick objects for the game loop */
for (int i = 0; i < Asset::GROUP_COUNT; i++) for (int i = 0; i < Asset::GROUP_COUNT; i++)
for (Asset *a = data->list[i]; a; a = a->next) for (Asset *a = data->list[i]; a; a = a->next)
a->TickGame(delta_time);
if (!a->destroy)
a->TickGame(delta_time);
} }


void Ticker::TickRender(float delta_time) void Ticker::TickRender(float delta_time)
@@ -83,6 +84,7 @@ void Ticker::TickRender(float delta_time)
/* Tick objects for the render loop */ /* Tick objects for the render loop */
for (int i = 0; i < Asset::GROUP_COUNT; i++) for (int i = 0; i < Asset::GROUP_COUNT; i++)
for (Asset *a = data->list[i]; a; a = a->next) for (Asset *a = data->list[i]; a; a = a->next)
a->TickRender(delta_time);
if (!a->destroy)
a->TickRender(delta_time);
} }



+ 3
- 2
src/tileset.h Переглянути файл

@@ -6,8 +6,9 @@
// //
// The TileSet class // The TileSet class
// ----------------- // -----------------
// A TileSet contains the information necesary to blit tiles to the game
// screen.
// A TileSet is a collection of tiles stored in a texture. Texture uploading
// and freeing is done in the render tick method. When the refcount drops to
// zero, the texture is freed.
// //


#if !defined __DH_TILESET_H__ #if !defined __DH_TILESET_H__


Завантаження…
Відмінити
Зберегти