# Tiles mode - Multitile background defaults to 0

**URL:** <https://discourse.cataclysmdda.org/t/tiles-mode-multitile-background-defaults-to-0/5450>\
**Category:** The Garage\
**Created:** [March 15, 2014, 5:38pm UTC](https://discourse.cataclysmdda.org/t/tiles-mode-multitile-background-defaults-to-0/5450 "2014-03-15T17:38:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sean\_Mirrsen](https://avatars.discourse-cdn.com/v4/letter/s/e47774/32.png) [@Sean\_Mirrsen](https://discourse.cataclysmdda.org/u/Sean_Mirrsen)\
**Post date:** [March 15, 2014, 5:38pm UTC](https://discourse.cataclysmdda.org/t/tiles-mode-multitile-background-defaults-to-0/5450/1 "2014-03-15T17:38:28Z")

</div>

This is a fairly small problem with a fairly easy solution, unless there is something else there that I am not aware of.

Basically, the problem is that whenever multitile tiles are defined for a tileset, if their background is not set (the line is omitted), then the background tile defaults to the zeroth tile, instead of a nonexistent one. Which makes multitile blood spatters and smoke spontaneously spawn grass under them, or whichever tile is in the tileset’s tilepage first.

[quote=“Sean Mirrsen, post:89, topic:5029”]Okay, found it. It’s a bug in Cataclysm itself.

[code] JsonArray tiles = config.get\_array(“tiles”);  
while (tiles.has\_more()) {  
JsonObject entry = tiles.next\_object();

```
    tile_type *curr_tile = new tile_type();
    std::string t_id = entry.get_string("id");
    int t_fg = entry.get_int("fg", -1);//<<<<<<<<<<<<<<<<<<<<<<<
    int t_bg = entry.get_int("bg", -1);
    bool t_multi = entry.get_bool("multitile", false);
    bool t_rota = entry.get_bool("rotates", t_multi);
    if (t_multi) {
        // fetch additional tiles
        JsonArray subentries = entry.get_array("additional_tiles");
        while (subentries.has_more()) {
            JsonObject subentry = subentries.next_object();

            tile_type *curr_subtile = new tile_type();
            std::string s_id = subentry.get_string("id");
            int s_fg = subentry.get_int("fg", 0);//<<<<<<<<<<<<<<<<<<<<<<<
            int s_bg = subentry.get_int("bg", 0);[/code]

```

Or, well, more like an oversight. When loading tile data, the foreground and background both default to -1, as needed. But when loading subsequent subtiles in a multitile, it defaults to 0, which means multitiles with no background defined will use the zeroth tile. I guess one way to bypass this, at the moment, is make sure the zeroth tile is transparent. For instance, by adding a “00” tile definition, and force-selecting a transparent image as its foreground, then clicking Sort so it’s in the top. In the meantime, we should probably file a bugreport.[/quote]Unless there is a reason the multitile backgrounds default to 0, the fix to this one should be pretty easy.

---

<div class="post-metadata">

**Author:** ![Robik](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/robik/32/1349_2.png) [@Robik](https://discourse.cataclysmdda.org/u/Robik)\
**Post date:** [March 16, 2014, 9:25am UTC](https://discourse.cataclysmdda.org/t/tiles-mode-multitile-background-defaults-to-0/5450/2 "2014-03-16T09:25:34Z")

</div>

Thanks for finding out what the problem is. I agree this should be eventually fixed in game.

---

<div class="post-metadata">

**Author:** ![Soyweiser](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/soyweiser/32/37_2.png) [@Soyweiser](https://discourse.cataclysmdda.org/u/Soyweiser)\
**Post date:** [March 16, 2014, 8:34pm UTC](https://discourse.cataclysmdda.org/t/tiles-mode-multitile-background-defaults-to-0/5450/3 "2014-03-16T20:34:58Z")

</div>

Not clear myself what the issue is. (As I don’t use tiles) but could you make an issue on the issue tracker describing the problem and the solution (or better, make a pull req with the fixed code).

> **[CleverRaven/Cataclysm-DDA](https://github.com/CleverRaven/Cataclysm-DDA)**
>
> Cataclysm-DDA - Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.

Here.

Thanks for reporting nad working on the fix.
