summaryrefslogtreecommitdiff
path: root/src/interfacegats.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfacegats.cpp')
-rw-r--r--src/interfacegats.cpp32
1 files changed, 23 insertions, 9 deletions
diff --git a/src/interfacegats.cpp b/src/interfacegats.cpp
index b6ad859..9f6cf8d 100644
--- a/src/interfacegats.cpp
+++ b/src/interfacegats.cpp
@@ -2,6 +2,7 @@
2 2
3#include "smlnode.h" 3#include "smlnode.h"
4#include "gamestate.h" 4#include "gamestate.h"
5#include "options.h"
5 6
6#include "smlrendererhtml.h" 7#include "smlrendererhtml.h"
7 8
@@ -16,7 +17,8 @@ using namespace Bu;
16PluginInterface3( plugin_interface_gats, gats, InterfaceGats, 17PluginInterface3( plugin_interface_gats, gats, InterfaceGats,
17 Interface, "Mike Buland", 1, 0 ); 18 Interface, "Mike Buland", 1, 0 );
18 19
19InterfaceGats::InterfaceGats() 20InterfaceGats::InterfaceGats() :
21 fResult( mbResult )
20{ 22{
21} 23}
22 24
@@ -28,8 +30,8 @@ void InterfaceGats::run( class Game *pGame )
28{ 30{
29 GameState gs( pGame, this ); 31 GameState gs( pGame, this );
30 32
33 Gats::GatsStream gsIn( sioRaw );
31 { 34 {
32 Gats::GatsStream gsIn( sioRaw );
33 Gats::Object *pObj = gsIn.readObject(); 35 Gats::Object *pObj = gsIn.readObject();
34 36
35 if( pObj ) 37 if( pObj )
@@ -37,6 +39,8 @@ void InterfaceGats::run( class Game *pGame )
37 gs.fromGats( dynamic_cast<Gats::Dictionary *>(pObj) ); 39 gs.fromGats( dynamic_cast<Gats::Dictionary *>(pObj) );
38 40
39 delete pObj; 41 delete pObj;
42
43 gs.execCommand( Options::getInstance().sCommand );
40 } 44 }
41 else 45 else
42 { 46 {
@@ -44,17 +48,27 @@ void InterfaceGats::run( class Game *pGame )
44 } 48 }
45 } 49 }
46 50
47 gs.execCommand("status"); 51 {
48 52 Gats::Dictionary *pDict;
49 //{ 53 if( gs.isRunning() )
50 // Gats::GatsStream gs 54 {
51 //pObj = gs.toGats(); 55 pDict = gs.toGats();
52 56 pDict->insertBool("running", true );
57 }
58 else
59 {
60 pDict = new Gats::Dictionary();
61 pDict->insertBool("running", false );
62 }
63 pDict->insert("result", mbResult.getString() );
64 gsIn.writeObject( pDict );
65 delete pDict;
66 }
53} 67}
54 68
55void InterfaceGats::display( const SmlNode *pSml ) 69void InterfaceGats::display( const SmlNode *pSml )
56{ 70{
57 SmlRendererHtml rend; 71 SmlRendererHtml rend;
58 rend.render( sio, pSml ); 72 rend.render( fResult, pSml );
59} 73}
60 74