-
Notifications
You must be signed in to change notification settings - Fork 97
Expand file tree
/
Copy pathSelectionMapInputData.h
More file actions
69 lines (61 loc) · 2.4 KB
/
Copy pathSelectionMapInputData.h
File metadata and controls
69 lines (61 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// Copyright (C) 2024 Settlers Freaks (sf-team at siedler25.org)
//
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <kaguya/lua_ref.hpp>
#include <boost/filesystem.hpp>
#include <Point.h>
#include <string>
#include <vector>
namespace kaguya {
class LuaRef;
} // namespace kaguya
struct ImageResource
{
std::string filePath;
unsigned index;
ImageResource(std::string path = "", unsigned index = 0) : filePath(std::move(path)), index(index){};
};
struct MissionSelectionInfo
{
/// The maskAreaColor is the color for the mission used in the missionMapMask
unsigned maskAreaColor = 0;
/// The position on which the conquered image and the marker image, if mission is selected,
/// are displayed. The offset is always counted from the origin of the map image.
Position ankerPos;
};
struct SelectionMapInputData
{
SelectionMapInputData() = default;
explicit SelectionMapInputData(const kaguya::LuaRef& table);
/// Background image for the selection map
ImageResource background;
/// The map image itself.
ImageResource map;
/// This image is a mask that describes the mission areas of the map (image). It must be the same size
/// as the map image where the color of each pixel determines the mission it belongs to.
/// Each mission must have a unique color (specified in the missionSelectionInfos).
/// Any other color is treated as neutral area and ignored.
ImageResource missionMapMask;
/// The marker image shown when a mission is selected.
ImageResource marker;
/// The image shown when a mission is already finished.
ImageResource conquered;
/// Offset of the map image and missionMapMask image relative to the background image.
Position mapOffsetInBackground = {0, 0};
/// Color for drawing missions not playable yet. Usually this should be a partly transparent color
unsigned disabledColor = 0x70000000;
/// Contains an entry for each mission
std::vector<MissionSelectionInfo> missionSelectionInfos;
};
namespace kaguya {
template<>
struct lua_type_traits<SelectionMapInputData> : private lua_type_traits<kaguya::LuaTable>
{
using Base = lua_type_traits<kaguya::LuaTable>;
using get_type = SelectionMapInputData;
using Base::checkType;
using Base::strictCheckType;
static get_type get(lua_State* l, int index) { return SelectionMapInputData(Base::get(l, index)); }
};
} // namespace kaguya