Porytiles
Loading...
Searching...
No Matches
role_pin_round_trip.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <optional>
4
8
9namespace porytiles {
10
33 MetatileAttribute fresh_from_bin,
34 PriorPinColumnState prior_state,
35 const std::optional<MetatileAttribute> &prior_attribute)
36{
37 switch (prior_state) {
40 fresh_from_bin.explicit_layer_type(fresh_from_bin.layer_type());
41 return fresh_from_bin;
43 if (prior_attribute.has_value() && prior_attribute->explicit_layer_type().has_value()) {
44 fresh_from_bin.explicit_layer_type(fresh_from_bin.layer_type());
45 }
46 return fresh_from_bin;
47 }
48 panic("merge_prior_layer_type_pin: unhandled PriorPinColumnState value");
49}
50
51} // namespace porytiles
The attributes of a single metatile, modeled as a map of named field values.
const std::optional< LayerType > & explicit_layer_type() const
Returns the explicit (user-pinned) layer type, if one was set.
void panic(const StringViewSourceLoc &s)
Unconditionally terminates the program with a panic message.
Definition panic.cpp:43
MetatileAttribute merge_prior_layer_type_pin(MetatileAttribute fresh_from_bin, PriorPinColumnState prior_state, const std::optional< MetatileAttribute > &prior_attribute)
Applies the decompile/import round-trip rules to one metatile's layer_type pin.
PriorPinColumnState
What an attributes.csv (if any) said about a role's pin column when this component was loaded.