Download Media Create Donate Forums

2011/04/04

CampaignManager.cpp

I started the very basic framework for the Campaign (story) Manager class for Flare. Right now all it does is read/write a bool status[1024] from the save file (as plaintext hex, cause that sounded good at the time).

On the plus side, this will be very easy to implement. Various classes will get/set these booleans. NPCs, map events, and the quest log will react to these simple statuses.

On the down side, this is as complex as I would get before strongly considering a full scripting engine. So extravagant cutscenes, branching dialog, etc. probably won't be part of the first game.

Item Storage

Bonbadil completed some fine refactoring of the Inventory and Vendor menus. Here's a quick explanation of the new classes.

ItemStorage is all about data; an array of ItemStacks along with generic functions to add/remove/return items.

MenuItemStorage is a derived class of ItemStorage that adds GUI functions (rendering icons, determining on-screen slot locations).

And here's how they're currently used:

  • MenuVendor has a MenuItemStorage for the 80 vendor slots
  • MenuInventory has two copies of MenuItemStorage (equipment and carried blocks)
  • NPC has an ItemStorage for vendor stocks; multiple vendors share the one MenuVendor. NPC ItemStorage data is passed to the MenuVendor MenuItemStorage on MenuVendor::setInventory()

Having common code pulled into these new classes should help these menus work consistently. It also makes some features easy to add later e.g. workspaces for crafting or player stashes.