vache / BuildingEditor

New version of cataclysm building editor
2 stars 1 forks source link

Representing Nondrawable Items #11

Closed vache closed 9 years ago

vache commented 9 years ago

MonsterGroups & ItemGroups: The widget list just needs IDs, which can just be typedef-ed QStrings. Tiles need the ID and a chance. OMTs need the ID, chance, and a rectangle representing the area. View: Red background for monster group, yellow background for item group?

User selects a group, then clicks a tile to place it. Something should appear contextually for the user to input the chance for the group. It should start with a sane default value and keep whatever value was input until changed. Should this be a part of the toolbar so that it is out of the way, but still available to the user? Think the font settings in word. What is easiest way to do this, have it support all of the types that need user intervention, and have it be unobtrusive and easily editable?

For the "nice-to-haves" we should parse the groups for their contents and weights, to allow the user to calculate chances of items spawning.

Monster: Widget List: ID Tile: ID, bool friendly (optional), QString name (optional) OMT: pulls straight from Tiles View: same background as monster group?

Item: Widget List: ID Tile: Array of Item IDs, int chance (one in chance of spawning) OMT: pulls straight from Tiles View: same background as item group?

vache commented 9 years ago

Implement with different structures depending on context:

// used in selector widget
typedef QString MonsterGroupID;
// used for Tiles
struct MonsterGroupData
{
    MonsterGroupID id;
    int chance;
}
// used for OMTs
struct MonsterGroup
{
    MonsterGroupData data;
    QRect area;
}

Alternately, use a QPair for the data and possibly even the full group def, assuming we don't need any special methods:

typedef QString MonsterGroupID;
typedef QPair<MonsterGroupID, int> MonsterGroupData;
typedef QPair<MonsterGroupData, QRect> MonsterGroup;

Or

// used for everything, but some members not used depending on context
class MonsterGroup
{
    QString id;
    int chance;
    QRect area;
}