#include "interfacegats.h" #include "smlnode.h" #include "gamestate.h" #include "options.h" #include "smlrendererhtml.h" #include #include #include #include #include using namespace Bu; PluginInterface3( plugin_interface_gats, gats, InterfaceGats, Interface, "Mike Buland", 1, 0 ); InterfaceGats::InterfaceGats() : fResult( mbResult ) { } InterfaceGats::~InterfaceGats() { } void InterfaceGats::run( class Game *pGame ) { GameState gs( pGame, this ); Gats::GatsStream gsIn( sioRaw ); { Gats::Object *pObj = gsIn.readObject(); if( pObj ) { gs.fromGats( dynamic_cast(pObj) ); delete pObj; gs.execCommand( Options::getInstance().sCommand ); } else { gs.init(); } } { Gats::Dictionary *pDict; if( gs.isRunning() ) { pDict = gs.toGats(); pDict->insertBool("running", true ); } else { pDict = new Gats::Dictionary(); pDict->insertBool("running", false ); } pDict->insert("result", mbResult.getString() ); gsIn.writeObject( pDict ); delete pDict; } } void InterfaceGats::display( const SmlNode *pSml ) { SmlRendererHtml rend; rend.render( fResult, pSml ); }