Overhaul the lthread_prints_ buffer.
This commit is contained in:
@@ -83,23 +83,25 @@ it will get fixed by difference transmission.
|
||||
|
||||
## Implementation of print
|
||||
|
||||
Inside the Luprex DLL, class PrintBuffer is used to store
|
||||
the contents of the GUI console. Every logged in player has
|
||||
a PrintBuffer as part of their character tangible.
|
||||
Difference transmission is capable of amending the contents
|
||||
of the PrintBuffer.
|
||||
The world model contains an ostringstream lthread_prints_
|
||||
which is used to temporarily collect normal print statements.
|
||||
Whenever a thread pauses or ends, the contents of the
|
||||
ostringstream are transferred to where they belong.
|
||||
|
||||
When the luprex thread scheduler starts executing a thread,
|
||||
it sets up an ostringstream to collect any print statements.
|
||||
When the thread pauses or ends, the contents of the ostringstream
|
||||
are copied into the PrintBuffer. The code to create the
|
||||
stringstream and to copy it into the PrintBuffer are both
|
||||
in the thread scheduling code in world-core.cpp.
|
||||
If the thread is executing normally, as part of an 'invoke',
|
||||
then the contents of the stringstream are transferred into
|
||||
a "PrintBuffer." Class PrintBuffer is a class that the
|
||||
Luprex DLL uses to store the contents of a player's GUI
|
||||
console. The PrintBuffer is part of the world model: every
|
||||
logged in player has a PrintBuffer as part of their
|
||||
character tangible. Difference transmission is capable of
|
||||
amending the contents of the PrintBuffer.
|
||||
|
||||
The stringstream isn't *always* copied into the PrintBuffer.
|
||||
There are exceptions: for example, in a 'probe',
|
||||
print statements don't go into the PrintBuffer, they get
|
||||
rerouted to dprint instead.
|
||||
The stringstream doesn't always get transferred to a
|
||||
PrintBuffer. If the thread is a 'probe', then the stringstream
|
||||
is sent to 'dprint'. If the thread is running under the HTTP
|
||||
server, then the stringstream may be sent back as part of
|
||||
the HTTP response.
|
||||
|
||||
The difference transmitter handles PrintBuffers specially.
|
||||
It doesn't just fix the contents of the PrintBuffer. It also
|
||||
@@ -121,7 +123,7 @@ print statements. If so, they will set a flag called "have_prints"
|
||||
in the DrivenEngine. Unreal periodically polls this flag using
|
||||
EngineWrapper::get_have_prints.
|
||||
|
||||
If the flag is set, Unreal then calls
|
||||
If the have_prints is set, Unreal then calls
|
||||
EngineWrapper::play_access(... CHANNEL_PRINTS ...).
|
||||
This asks the PrintChanneler to fetch all new authoritative prints.
|
||||
Then, CHANNEL_PRINTS will send an invoke via the standard
|
||||
@@ -136,7 +138,8 @@ That will probably change at some point.
|
||||
|
||||
The LuprexGameMode maintains an object of class UlxConsoleOutput
|
||||
which keeps a record of what's in the GUI Console. When
|
||||
AddConsoleOutput feeds new prints into the LuprexGameMode,
|
||||
those prints get added to the UlxConsoleOutput. This stores
|
||||
the contents of the console as one big string. From there,
|
||||
the string is copied into a text widget.
|
||||
the LuprexGameMode receives new strings via AddConsoleOutput,
|
||||
it adds those string to the UlxConsoleOutput. The UlxConsoleOutput
|
||||
turns those individual lines into one big string. From there,
|
||||
the LuprexGameMode copies the entire string into the body of
|
||||
a UMG text widget.
|
||||
|
||||
Reference in New Issue
Block a user