Skip to content

Commit

Permalink
docs: GID code example tweaks (#3807)
Browse files Browse the repository at this point in the history
Updated the example C++ code to use "get_tile" as the hypothetical method to get a tile based on its ID instead of "tileAt", for two reasons:

1. The rest of the code uses snake_case, but this one used camelCase for some reason.
2. "tileAt" sounds like it implies that the ID is a location/index. This is misleading, since in Tiled tilesets, the ids are not necessarily positions or indices - tiles may be stored out of order, and the IDs may not even be sequential. I think "get tile" avoids such implications.
  • Loading branch information
eishiya committed Aug 17, 2023
1 parent 729d001 commit 1316353
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/reference/global-tile-ids.rst
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ clear, it deals with flags and deduces the appropriate tileset:
Tileset *tileset = tilesets[i];
if (tileset->first_gid() <= global_tile_id) {
tiles[y][x] = tileset->tileAt(global_tile_id - tileset->first_gid());
tiles[y][x] = tileset->get_tile(global_tile_id - tileset->first_gid());
break;
}
}
Expand Down

0 comments on commit 1316353

Please sign in to comment.