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%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-spec generate
(
fun ((shr_tile_instance:trigger_name()) -> boolean()),
shr_map:type()
)
-> {list(any())}.
generate (TriggerVisibilityFun, Map) ->
{
[
{<<"msg">>, <<"set_map">>},
{<<"w">>, shr_map:get_width(Map)},
{<<"h">>, shr_map:get_height(Map)},
{
<<"t">>,
lists:map
(
fun (E) ->
shr_tile_instance:encode(TriggerVisibilityFun, E)
end,
tuple_to_list(shr_map:get_tile_instances(Map))
)
}
]
}.
|