summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/functiondisplay.cpp6
-rw-r--r--src/game.cpp2
-rw-r--r--src/gamestate.cpp3
-rw-r--r--src/gamestate.h6
-rw-r--r--src/interfaceconsole.cpp7
-rw-r--r--src/variable.cpp10
-rw-r--r--test.stage10
7 files changed, 31 insertions, 13 deletions
diff --git a/src/functiondisplay.cpp b/src/functiondisplay.cpp
index 7328293..2f2209c 100644
--- a/src/functiondisplay.cpp
+++ b/src/functiondisplay.cpp
@@ -1,7 +1,9 @@
1#include "functiondisplay.h" 1#include "functiondisplay.h"
2 2
3#include "smlnode.h"
3#include <bu/sio.h> 4#include <bu/sio.h>
4#include "gamestate.h" 5#include "gamestate.h"
6#include "interface.h"
5 7
6using namespace Bu; 8using namespace Bu;
7 9
@@ -16,7 +18,9 @@ FunctionDisplay::~FunctionDisplay()
16void FunctionDisplay::call( class GameState &gState ) 18void FunctionDisplay::call( class GameState &gState )
17{ 19{
18 Bu::String s = gState.popDeref().to( Variable::tString ).getString(); 20 Bu::String s = gState.popDeref().to( Variable::tString ).getString();
19 sio << format( s ) << sio.nl; 21 SmlNode *pNode = SmlNode::parse( s );
22 gState.getInterface()->display( pNode );
23 delete pNode;
20 24
21/* 25/*
22 Variable v = gState.popDeref(); 26 Variable v = gState.popDeref();
diff --git a/src/game.cpp b/src/game.cpp
index 3a432d9..4971c4b 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -7,6 +7,7 @@
7#include "functionrandom.h" 7#include "functionrandom.h"
8#include "functioninteger.h" 8#include "functioninteger.h"
9#include "functionfloat.h" 9#include "functionfloat.h"
10#include "functiondebugstring.h"
10 11
11Game::Game() 12Game::Game()
12{ 13{
@@ -18,6 +19,7 @@ Game::Game()
18 addFunction( new FunctionRandom() ); 19 addFunction( new FunctionRandom() );
19 addFunction( new FunctionInteger() ); 20 addFunction( new FunctionInteger() );
20 addFunction( new FunctionFloat() ); 21 addFunction( new FunctionFloat() );
22 addFunction( new FunctionDebugString() );
21} 23}
22 24
23Game::~Game() 25Game::~Game()
diff --git a/src/gamestate.cpp b/src/gamestate.cpp
index 7777b1f..0b721d4 100644
--- a/src/gamestate.cpp
+++ b/src/gamestate.cpp
@@ -8,8 +8,9 @@
8#include <bu/sio.h> 8#include <bu/sio.h>
9using namespace Bu; 9using namespace Bu;
10 10
11GameState::GameState( Game *pGame ) : 11GameState::GameState( Game *pGame, Interface *pIface ) :
12 pGame( pGame ), 12 pGame( pGame ),
13 pIface( pIface ),
13 bRunning( true ), 14 bRunning( true ),
14 bReturnOnly( false ) 15 bReturnOnly( false )
15{ 16{
diff --git a/src/gamestate.h b/src/gamestate.h
index 9e7a060..e139dfe 100644
--- a/src/gamestate.h
+++ b/src/gamestate.h
@@ -7,13 +7,16 @@
7#include "enums.h" 7#include "enums.h"
8 8
9class Game; 9class Game;
10class Interface;
10 11
11class GameState 12class GameState
12{ 13{
13public: 14public:
14 GameState( Game *pGame ); 15 GameState( Game *pGame, Interface *pIface );
15 virtual ~GameState(); 16 virtual ~GameState();
16 17
18 Interface *getInterface() { return pIface; }
19
17 void parse( class AstBranch *pAst ); 20 void parse( class AstBranch *pAst );
18 21
19 void init(); 22 void init();
@@ -46,6 +49,7 @@ private:
46 typedef Bu::List<Scope *> ScopeList; 49 typedef Bu::List<Scope *> ScopeList;
47 typedef Bu::Hash<Bu::String, Scope *> ScopeHash; 50 typedef Bu::Hash<Bu::String, Scope *> ScopeHash;
48 Game *pGame; 51 Game *pGame;
52 Interface *pIface;
49 Scope sGlobal; 53 Scope sGlobal;
50 Scope sPlayer; 54 Scope sPlayer;
51 ScopeList lsLocal; 55 ScopeList lsLocal;
diff --git a/src/interfaceconsole.cpp b/src/interfaceconsole.cpp
index b30733a..94b45b9 100644
--- a/src/interfaceconsole.cpp
+++ b/src/interfaceconsole.cpp
@@ -22,7 +22,7 @@ InterfaceConsole::~InterfaceConsole()
22 22
23void InterfaceConsole::run( Game *pGame ) 23void InterfaceConsole::run( Game *pGame )
24{ 24{
25 GameState gs( pGame ); 25 GameState gs( pGame, this );
26 gs.init(); 26 gs.init();
27 27
28 while( gs.isRunning() ) 28 while( gs.isRunning() )
@@ -56,6 +56,11 @@ void InterfaceConsole::appendToken( Bu::String &sCurLine,
56 56
57Bu::String InterfaceConsole::getVt100Style( const StyleStack &sStyle ) 57Bu::String InterfaceConsole::getVt100Style( const StyleStack &sStyle )
58{ 58{
59#ifdef WIN32
60 // Windows...we don't do colors for windows...
61 return "";
62#endif
63
59 if( sStyle.isEmpty() ) 64 if( sStyle.isEmpty() )
60 { 65 {
61 return "\x1B[0m"; 66 return "\x1B[0m";
diff --git a/src/variable.cpp b/src/variable.cpp
index 0c83133..4cbf97d 100644
--- a/src/variable.cpp
+++ b/src/variable.cpp
@@ -1111,7 +1111,15 @@ Bu::Formatter &operator<<( Bu::Formatter &f, const Variable &v )
1111 return f << "(varref:\"" << v.rValue->sName << "\")"; 1111 return f << "(varref:\"" << v.rValue->sName << "\")";
1112 1112
1113 case Variable::tList: 1113 case Variable::tList:
1114 return f << *v.lValue; 1114 f << "\\[";
1115 for( Variable::VariableArray::iterator i = v.lValue->begin();
1116 i; i++ )
1117 {
1118 if( i != v.lValue->begin() )
1119 f << ", ";
1120 f << *i;
1121 }
1122 return f << "\\]";
1115 1123
1116 case Variable::tDictionary: 1124 case Variable::tDictionary:
1117 return f << *v.hValue; 1125 return f << *v.hValue;
diff --git a/test.stage b/test.stage
index 2ae34ab..d1ba1b0 100644
--- a/test.stage
+++ b/test.stage
@@ -18,14 +18,8 @@ situation <<start>>
18 setup 18 setup
19 { 19 {
20 x = [5, 4, 3]; 20 x = [5, 4, 3];
21 x = x + [9, 8, 7]; 21 x = x + [[9, 8, 7]];
22 display( x[4] ); 22 display( debugString( x ) );
23 x[4] = 112;
24 display ('----');
25 for each i in x do
26 {
27 display( i );
28 }
29 23
30 exit(); 24 exit();
31 } 25 }