summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2021-03-26 09:35:29 (EDT)
committer P. J. McDermott <pj@pehjota.net>2021-03-26 09:35:29 (EDT)
commit3590a94dd507bd56016064bab4c6944ae0423d9e (patch)
tree017476c73c321977cecfe4ea6a92dd195bfff53d
parent6b0df99a9d55385e11272f13bdfd51022d92be19 (diff)
downloaddodge-balls-3590a94dd507bd56016064bab4c6944ae0423d9e.zip
dodge-balls-3590a94dd507bd56016064bab4c6944ae0423d9e.tar.gz
dodge-balls-3590a94dd507bd56016064bab4c6944ae0423d9e.tar.bz2
tileset: Simplify rendering function logic a bit
-rw-r--r--src/tileset.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/tileset.c b/src/tileset.c
index c41f4ff..cb21f7a 100644
--- a/src/tileset.c
+++ b/src/tileset.c
@@ -468,10 +468,8 @@ int
db_tile_render(struct db_tileset *tileset, SDL_Renderer *renderer, int gid,
SDL_Rect *dstrect)
{
- SDL_bool tile_found;
SDL_Rect srcrect;
- tile_found = SDL_FALSE;
for (; tileset != NULL; tileset = tileset->next) {
if (gid >= tileset->firstgid &&
gid < tileset->firstgid + tileset->tc) {
@@ -494,13 +492,9 @@ db_tile_render(struct db_tileset *tileset, SDL_Renderer *renderer, int gid,
SDL_GetError());
return -1;
}
- tile_found = SDL_TRUE;
- break;
+ return 1;
}
}
- if (!tile_found) {
- db_warn("Tile with gid 0x%8.8x not found", (unsigned int) gid);
- return 0;
- }
- return 1;
+ db_warn("Tile with gid 0x%8.8x not found", (unsigned int) gid);
+ return 0;
}