show recipes visually instead of describing them in text
This commit is contained in:
35
src/ui/ItemProducers.h
Normal file
35
src/ui/ItemProducers.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
struct GameConfig;
|
||||
struct RecipeDef;
|
||||
class Simulation;
|
||||
|
||||
// Where an item comes from, as far as the player has discovered (REQ-UI-ITEM-TOOLTIP).
|
||||
enum class ItemOrigin
|
||||
{
|
||||
Produced, // at least one recipe the player can run makes it
|
||||
Undiscovered, // recipes make it, but none of them is available yet
|
||||
Salvaged, // no recipe makes it at all -- scrap, which comes from debris
|
||||
};
|
||||
|
||||
struct ItemProduction
|
||||
{
|
||||
ItemOrigin origin = ItemOrigin::Salvaged;
|
||||
// The available producers, in config order. Empty unless origin is Produced.
|
||||
std::vector<const RecipeDef*> recipes;
|
||||
};
|
||||
|
||||
// Every way the player can currently produce the given item, for the tooltip that
|
||||
// explains an item chip (REQ-UI-ITEM-TOOLTIP).
|
||||
//
|
||||
// What counts as available differs by building type, because only Miner and Assembler
|
||||
// recipes are individually unlocked (REQ-LOCK-UI-RECIPE): those are filtered by the
|
||||
// unlock state, while a Smelter's or Reprocessing Plant's implicit recipes
|
||||
// (REQ-BLD-SMELTER, REQ-BLD-REPROCESSING) are filtered by whether their building is
|
||||
// unlocked yet (REQ-LOCK-BUILDING) -- there is no sense in naming a path through a
|
||||
// plant the player cannot place.
|
||||
ItemProduction findItemProduction(const std::string& itemId, const Simulation& sim,
|
||||
const GameConfig& config);
|
||||
Reference in New Issue
Block a user