diff options
Diffstat (limited to 'src/functiondisplay.cpp')
-rw-r--r-- | src/functiondisplay.cpp | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/functiondisplay.cpp b/src/functiondisplay.cpp index fa5b79c..4790844 100644 --- a/src/functiondisplay.cpp +++ b/src/functiondisplay.cpp | |||
@@ -15,7 +15,37 @@ FunctionDisplay::~FunctionDisplay() | |||
15 | 15 | ||
16 | void FunctionDisplay::call( class GameState &gState ) | 16 | void FunctionDisplay::call( class GameState &gState ) |
17 | { | 17 | { |
18 | Variable v = gState.popDeref(); | 18 | Bu::String s = gState.popDeref().to( Variable::tString ).getString(); |
19 | sio << "Display: " << v << sio.nl; | 19 | |
20 | sio << format( s ) << sio.nl; | ||
21 | // sio << "Display: " << v << sio.nl; | ||
22 | } | ||
23 | |||
24 | Bu::String FunctionDisplay::format( const Bu::String &sSrc ) | ||
25 | { | ||
26 | Bu::String sRet; | ||
27 | bool bWs = true; | ||
28 | Bu::String::const_iterator i = sSrc.begin(); | ||
29 | |||
30 | while( i ) | ||
31 | { | ||
32 | for(; i; i++ ) | ||
33 | { | ||
34 | if( *i != ' ' && *i != '\t' && *i != '\n' && *i != '\r' ) | ||
35 | break; | ||
36 | } | ||
37 | for(; i; i++ ) | ||
38 | { | ||
39 | if( i == ' ' || i == '\t' || *i == '\n' || *i == '\r' ) | ||
40 | { | ||
41 | sRet.append(' '); | ||
42 | break; | ||
43 | } | ||
44 | |||
45 | sRet.append( *i ); | ||
46 | } | ||
47 | } | ||
48 | |||
49 | return sRet; | ||
20 | } | 50 | } |
21 | 51 | ||