name: "Tutorial" panels { name: "SAY" path: "Panels/Entry/say" clue: "say" answer: "say" } panels { name: "HIGH" path: "Panels/Entry/high" clue: "high" answer: "hi" symbols: ZERO } panels { name: "<- (1)" path: "Panels/Entry/say_hi" clue: "" answer: "hi" symbols: EVAL symbols: LINGO } panels { name: "<- (2)" path: "Panels/Entry/type_this" clue: "" answer: "this" symbols: EVAL symbols: LINGO } panels { name: "<- (3)" path: "Panels/Entry/write_same" clue: "" answer: "same" symbols: EVAL symbols: LINGO } panels { name: "THIS" path: "Panels/Entry/type_this2" clue: "this" answer: "this" } panels { name: "WRITE" path: "Panels/Entry/write_same2" clue: "write" answer: "write" } panels { name: "TYPE" path: "Panels/Entry/type_this3" clue: "type" answer: "type" } panels { name: "SAME" path: "Panels/Entry/write_same3" clue: "same" answer: "same" } p label='branches'> Randomizer for LINGO 2 using Archipelago Multiworld
about summary refs log tree commit diff stats
path: root/tools/util/identifiers.cpp
blob: 5b51c57a91d72d3f3b2fabb17a8e9c3f3ccf08f0 (plain) (blame)
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#include "identifiers.h"

#include <string>

#include "proto/human.pb.h"

namespace com::fourisland::lingo2_archipelago {

std::optional<RoomIdentifier> GetCompleteRoomIdentifier(
    RoomIdentifier identifier, std::optional<std::string> map_name) {
  if (!identifier.has_map()) {
    if (!map_name) {
      return std::nullopt;
    }
    identifier.set_map(*map_name);
  }
  return identifier;
}

std::optional<DoorIdentifier> GetCompleteDoorIdentifier(
    DoorIdentifier identifier, std::optional<std::string> map_name) {
  if (!identifier.has_map()) {
    if (!map_name) {
      return std::nullopt;
    }
    identifier.set_map(*map_name);
  }
  return identifier;
}

std::optional<PortIdentifier> GetCompletePortIdentifier(
    PortIdentifier identifier, std::optional<std::string> map_name,
    std::optional<std::string> room_name) {
  if (!identifier.has_map()) {
    if (!map_name) {
      return std::nullopt;
    }
    identifier.set_map(*map_name);
  }
  if (!identifier.has_room()) {
    if (!room_name) {
      return std::nullopt;
    }
    identifier.set_room(*room_name);
  }
  return identifier;
}

std::optional<PaintingIdentifier> GetCompletePaintingIdentifier(
    PaintingIdentifier identifier, std::optional<std::string> map_name,
    std::optional<std::string> room_name) {
  if (!identifier.has_map()) {
    if (!map_name) {
      return std::nullopt;
    }
    identifier.set_map(*map_name);
  }
  if (!identifier.has_room()) {
    if (!room_name) {
      return std::nullopt;
    }
    identifier.set_room(*room_name);
  }
  return identifier;
}

std::optional<PanelIdentifier> GetCompletePanelIdentifierWithoutAnswer(
    PanelIdentifier identifier, std::optional<std::string> map_name,
    std::optional<std::string> room_name) {
  if (!identifier.has_map()) {
    if (!map_name) {
      return std::nullopt;
    }
    identifier.set_map(*map_name);
  }
  if (!identifier.has_room()) {
    if (!room_name) {
      return std::nullopt;
    }
    identifier.set_room(*room_name);
  }
  identifier.clear_answer();
  return identifier;
}

std::optional<KeyholderIdentifier> GetCompleteKeyholderIdentifierWithoutKey(
    KeyholderIdentifier identifier, const std::string& map_name,
    std::optional<std::string> room_name) {
  if (!identifier.has_map()) {
    identifier.set_map(map_name);
  }
  if (!identifier.has_room()) {
    if (!room_name) {
      return std::nullopt;
    }
    identifier.set_room(*room_name);
  }
  identifier.clear_key();
  return identifier;
}

}  // namespace com::fourisland::lingo2_archipelago