#!/usr/bin/env ruby require 'pathname' require 'fileutils' include FileUtils # path to your application root. APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) def system!(*args) system(*args) || abort("\n== Command #{args} failed ==") end chdir APP_ROOT do # This script is a way to update your development environment automatically. # Add necessary update steps to this file. puts '== Installing dependencies ==' system! 'gem install bundler --conservative' system('bundle check') || system!('bundle install') puts "\n== Updating database ==" system! 'bin/rails db:migrate' puts "\n== Removing old logs and tempfiles ==" system! 'bin/rails log:clear tmp:clear' puts "\n== Restarting application server ==" system! 'bin/rails restart' end e='hidden' name='id' value='f97b4ff4821f2945f22198dcbd5c627a64b4be50'/> 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