Skip to content

Commit

Permalink
Fixed regression caused by rebase:
Browse files Browse the repository at this point in the history
- Map.Tileset is no more a pointer.
  • Loading branch information
ipochto committed Dec 9, 2024
1 parent 77a3072 commit 712c99b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
18 changes: 9 additions & 9 deletions src/editor/editloop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ static void DrawTileIcons()

if (i >= Editor.ShownTileTypes.size()) return false;

const graphic_index tile = Map.Tileset->getGraphicTileFor(Editor.ShownTileTypes[i]);
const graphic_index tile = Map.Tileset.getGraphicTileFor(Editor.ShownTileTypes[i]);

Map.TileGraphic->DrawFrameClip(tile, x, y);
Video.DrawRectangleClip(ColorGray, x, y, Map.Tileset.getPixelTileSize().x, Map.Tileset.getPixelTileSize().y);
Expand Down Expand Up @@ -822,8 +822,8 @@ static void DrawMapCursor(TilePos tilePos, PixelPos screenPos, const CBrush &bru

PushClipping();
UI.MouseViewport->SetClipping();
const PixelSize tileSize(Map.Tileset->getPixelTileSize().x,
Map.Tileset->getPixelTileSize().y);
const PixelSize tileSize(Map.Tileset.getPixelTileSize().x,
Map.Tileset.getPixelTileSize().y);

auto drawBrushTile = [&screenPos, &tileSize](const TilePos &tileOffset,
tile_index tileIdx) -> void
Expand All @@ -838,7 +838,7 @@ static void DrawMapCursor(TilePos tilePos, PixelPos screenPos, const CBrush &bru

return;
}
Map.TileGraphic->DrawFrameClip(Map.Tileset->getGraphicTileFor(tileIdx),
Map.TileGraphic->DrawFrameClip(Map.Tileset.getGraphicTileFor(tileIdx),
screenPosIt.x,
screenPosIt.y);
};
Expand Down Expand Up @@ -899,7 +899,7 @@ static void UpdateMapCursor()
TileCursorSize, // ramp width
TileCursorSize, // ramp height
[](uint8_t col, uint8_t row) -> graphic_index {
return Map.Tileset->getGraphicTileFor(ramp.get(col, row));
return Map.Tileset.getGraphicTileFor(ramp.get(col, row));
});
*/

Expand Down Expand Up @@ -998,7 +998,7 @@ static void DrawEditorInfo()
CLabel(GetGameFont()).Draw(UI.StatusLine.TextX, UI.StatusLine.TextY - GetGameFont().getHeight() * 2, buf);

// Tile info
const CTileset &tileset = *Map.Tileset;
const CTileset &tileset = Map.Tileset;
const tile_index index = mf.getTileIndex();

const terrain_typeIdx baseTerrainIdx = tileset.tiles[index].tileinfo.BaseTerrain;
Expand Down Expand Up @@ -1674,10 +1674,10 @@ static bool EditorCallbackMouse_EditTileArea(const PixelPos &screenPos)
if (i >= Editor.ShownTileTypes.size()) return true;

const tile_index tileindex = Editor.ShownTileTypes[i];
const graphic_index tile = Map.Tileset->getGraphicTileFor(tileindex);
const graphic_index tile = Map.Tileset.getGraphicTileFor(tileindex);

const terrain_typeIdx base = Map.Tileset->tiles[tileindex].tileinfo.BaseTerrain;
UI.StatusLine.Set(Map.Tileset->getTerrainName(base));
const terrain_typeIdx base = Map.Tileset.tiles[tileindex].tileinfo.BaseTerrain;
UI.StatusLine.Set(Map.Tileset.getTerrainName(base));
Editor.CursorTileIndex = i;
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions src/editor/editor_brush.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ void CBrush::applyBrushAt(const TilePos &pos, brushApplyFn applyFn, bool forbidR

tile_index CBrush::randomizeTile(tile_index tileIdx) const
{
return Map.Tileset->getRandomTileOfTheSameKindAs(tileIdx);
return Map.Tileset.getRandomTileOfTheSameKindAs(tileIdx);
}

graphic_index CBrush::getGraphicTile(uint8_t col, uint8_t row) const
{
return getTile(col, row) ? Map.Tileset->getGraphicTileFor(getTile(col, row)) : 0;
return getTile(col, row) ? Map.Tileset.getGraphicTileFor(getTile(col, row)) : 0;
}

tile_index CBrush::getTile(uint8_t col, uint8_t row) const
Expand Down
10 changes: 5 additions & 5 deletions src/editor/edmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void ChangeTile(const Vec2i &pos, int tile)
static uint32_t QuadFromTile(const Vec2i &pos)
{
const tile_index idx = Map.Field(pos)->getTileIndex();
return Map.Tileset->getQuadFromTile(idx);
return Map.Tileset.getQuadFromTile(idx);
}

/**
Expand All @@ -107,7 +107,7 @@ static void EditorChangeTile(const Vec2i &pos, tile_index tileIndex, const Vec2i
if (TileToolRandom) {
int n = 0;
for (int i = 0; i < 16; ++i) {
if (!Map.Tileset->tiles[tileIdx + i].tile) {
if (!Map.Tileset.tiles[tileIdx + i].tile) {
break;
} else {
++n;
Expand All @@ -116,14 +116,14 @@ static void EditorChangeTile(const Vec2i &pos, tile_index tileIndex, const Vec2i
n = MyRand() % n;
int i = -1;
do {
while (++i < 16 && !Map.Tileset->tiles[tileIdx + i].tile) {
while (++i < 16 && !Map.Tileset.tiles[tileIdx + i].tile) {
}
} while (i < 16 && n--);
if (i < 16) {
tileIdx += i;
}
}
mf.setTileIndex(*Map.Tileset, tileIdx, 0, mf.getElevation());
mf.setTileIndex(Map.Tileset, tileIdx, 0, mf.getElevation());
mf.playerInfo.SeenTile = mf.getGraphicTile();

UI.Minimap.UpdateSeenXY(pos);
Expand Down Expand Up @@ -408,7 +408,7 @@ static void EditorDestroyAllUnits()
static void RandomizeTransition(int x, int y)
{
CMapField &mf = *Map.Field(x, y);
const CTileset &tileset = *Map.Tileset;
const CTileset &tileset = Map.Tileset;
terrain_typeIdx baseTileIndex = tileset.tiles[mf.getTileIndex()].tileinfo.BaseTerrain;
terrain_typeIdx mixTerrainIdx = tileset.tiles[mf.getTileIndex()].tileinfo.MixTerrain;
if (mixTerrainIdx != 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/map/script_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,7 @@ static int CclGetTileTerrainName(lua_State *l)
const Vec2i pos(LuaToNumber(l, 1), LuaToNumber(l, 2));

const CMapField &mf = *Map.Field(pos);
const CTileset &tileset = *Map.Tileset;
const CTileset &tileset = Map.Tileset;
const tile_index index = mf.getTileIndex();

const terrain_typeIdx baseTerrainIdx = tileset.tiles[index].tileinfo.BaseTerrain;
Expand Down

0 comments on commit 712c99b

Please sign in to comment.