forked from Mirrors/openclonk
Move Game.MessageInput to ::MessageInput
parent
ad779a0dc1
commit
a82a4470bd
|
@ -90,7 +90,6 @@ class C4Game
|
|||
~C4Game();
|
||||
public:
|
||||
C4DefList Defs;
|
||||
C4MessageInput MessageInput;
|
||||
C4GraphicsResource GraphicsResource;
|
||||
C4Network2 Network;
|
||||
C4ClientList &Clients; // Shortcut
|
||||
|
|
|
@ -147,6 +147,8 @@ class C4MessageInput
|
|||
friend class C4ChatInputDialog;
|
||||
};
|
||||
|
||||
extern C4MessageInput MessageInput;
|
||||
|
||||
// script query to ask a player for a string
|
||||
class C4MessageBoardQuery
|
||||
{
|
||||
|
|
|
@ -451,7 +451,7 @@ void C4Application::OnCommand(const char *szCmd)
|
|||
{
|
||||
// reroute to whatever seems to take commands at the moment
|
||||
if(AppState == C4AS_Game)
|
||||
Game.MessageInput.ProcessInput(szCmd);
|
||||
::MessageInput.ProcessInput(szCmd);
|
||||
}
|
||||
|
||||
void C4Application::Activate()
|
||||
|
|
|
@ -177,7 +177,7 @@ C4GUI::Edit::InputResult C4ChatControl::ChatSheet::OnChatInput(C4GUI::Edit *edt,
|
|||
else
|
||||
{
|
||||
// remember in history
|
||||
Game.MessageInput.StoreBackBuffer(szInputText);
|
||||
::MessageInput.StoreBackBuffer(szInputText);
|
||||
// forward to chat control for processing
|
||||
if (!pChatControl->ProcessInput(szInputText, this)) eResult = C4GUI::Edit::IR_Abort;
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ bool C4ChatControl::ChatSheet::KeyHistoryUpDown(bool fUp)
|
|||
// chat input only
|
||||
if (!IsFocused(pInputEdit)) return false;
|
||||
pInputEdit->SelectAll(); pInputEdit->DeleteSelection();
|
||||
const char *szPrevInput = Game.MessageInput.GetBackBuffer(fUp ? (++iBackBufferIndex) : (--iBackBufferIndex));
|
||||
const char *szPrevInput = ::MessageInput.GetBackBuffer(fUp ? (++iBackBufferIndex) : (--iBackBufferIndex));
|
||||
if (!szPrevInput || !*szPrevInput)
|
||||
iBackBufferIndex = -1;
|
||||
else
|
||||
|
|
|
@ -594,14 +594,14 @@ bool C4Console::In(const char *szText)
|
|||
// begins with '/'? then it's a command
|
||||
if (*szText == '/')
|
||||
{
|
||||
Game.MessageInput.ProcessCommand(szText);
|
||||
::MessageInput.ProcessCommand(szText);
|
||||
// done
|
||||
return TRUE;
|
||||
}
|
||||
// begins with '#'? then it's a message. Route cia ProcessInput to allow #/sound
|
||||
if (*szText == '#')
|
||||
{
|
||||
Game.MessageInput.ProcessInput(szText + 1);
|
||||
::MessageInput.ProcessInput(szText + 1);
|
||||
return TRUE;
|
||||
}
|
||||
// editing enabled?
|
||||
|
|
|
@ -444,7 +444,7 @@ C4GUI::Edit::InputResult MainDlg::OnChatInput(C4GUI::Edit *edt, bool fPasting, b
|
|||
{
|
||||
// store input in backbuffer before processing commands
|
||||
// because those might kill the edit field
|
||||
Game.MessageInput.StoreBackBuffer(szInputText);
|
||||
::MessageInput.StoreBackBuffer(szInputText);
|
||||
bool fProcessed = false;
|
||||
// check confidential data
|
||||
if (C4InVal::IsConfidentialData(szInputText, true)) fProcessed = true;
|
||||
|
@ -605,7 +605,7 @@ C4GUI::Edit::InputResult MainDlg::OnChatInput(C4GUI::Edit *edt, bool fPasting, b
|
|||
}
|
||||
}
|
||||
// not processed? Then forward to messageinput, which parses additional commands and sends regular messages
|
||||
if (!fProcessed) Game.MessageInput.ProcessInput(szInputText);
|
||||
if (!fProcessed) ::MessageInput.ProcessInput(szInputText);
|
||||
}
|
||||
// clear edit field after text has been processed
|
||||
pEdt->SelectAll(); pEdt->DeleteSelection();
|
||||
|
@ -828,7 +828,7 @@ bool MainDlg::KeyHistoryUpDown(bool fUp)
|
|||
// chat input only
|
||||
if (!IsFocused(pEdt)) return false;
|
||||
pEdt->SelectAll(); pEdt->DeleteSelection();
|
||||
const char *szPrevInput = Game.MessageInput.GetBackBuffer(fUp ? (++iBackBufferIndex) : (--iBackBufferIndex));
|
||||
const char *szPrevInput = ::MessageInput.GetBackBuffer(fUp ? (++iBackBufferIndex) : (--iBackBufferIndex));
|
||||
if (!szPrevInput || !*szPrevInput)
|
||||
iBackBufferIndex = -1;
|
||||
else
|
||||
|
|
|
@ -146,7 +146,7 @@ void C4MessageBoard::Execute()
|
|||
case 2: // show nothing
|
||||
|
||||
// TypeIn: Act as in mode 0
|
||||
if (!Game.MessageInput.IsTypeIn())
|
||||
if (!::MessageInput.IsTypeIn())
|
||||
{
|
||||
ScreenFader = 100;
|
||||
iBackScroll = -1;
|
||||
|
@ -156,7 +156,7 @@ void C4MessageBoard::Execute()
|
|||
case 0: // one msg
|
||||
|
||||
// typein? fade in
|
||||
if(Game.MessageInput.IsTypeIn())
|
||||
if(::MessageInput.IsTypeIn())
|
||||
ScreenFader = Max(ScreenFader - 20, -100);
|
||||
|
||||
// no curr msg?
|
||||
|
@ -166,7 +166,7 @@ void C4MessageBoard::Execute()
|
|||
Empty = true;
|
||||
// draw anyway
|
||||
Draw(Output);
|
||||
if(!Game.MessageInput.IsTypeIn())
|
||||
if(!::MessageInput.IsTypeIn())
|
||||
ScreenFader += 5;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ C4GUI::Edit::InputResult C4ChatInputDialog::OnChatInput(C4GUI::Edit *edt, bool f
|
|||
C4GUI::Edit *pEdt = reinterpret_cast<C4GUI::Edit *>(edt);
|
||||
char *szInputText = const_cast<char *>(pEdt->GetText());
|
||||
// Store to back buffer
|
||||
Game.MessageInput.StoreBackBuffer(szInputText);
|
||||
::MessageInput.StoreBackBuffer(szInputText);
|
||||
// check confidential data - even for object input (script triggered), webcode should not be pasted here
|
||||
if (C4InVal::IsConfidentialData(szInputText, true))
|
||||
{
|
||||
|
@ -155,7 +155,7 @@ C4GUI::Edit::InputResult C4ChatInputDialog::OnChatInput(C4GUI::Edit *edt, bool f
|
|||
}
|
||||
else
|
||||
// reroute to message input class
|
||||
Game.MessageInput.ProcessInput(szInputText);
|
||||
::MessageInput.ProcessInput(szInputText);
|
||||
// safety: message board commands may do strange things
|
||||
if (!C4GUI::IsGUIValid() || this!=pInstance) return C4GUI::Edit::IR_Abort;
|
||||
// select all text to be removed with next keypress
|
||||
|
@ -171,7 +171,7 @@ bool C4ChatInputDialog::KeyHistoryUpDown(bool fUp)
|
|||
{
|
||||
// browse chat history
|
||||
pEdit->SelectAll(); pEdit->DeleteSelection();
|
||||
const char *szPrevInput = Game.MessageInput.GetBackBuffer(fUp ? (++BackIndex) : (--BackIndex));
|
||||
const char *szPrevInput = ::MessageInput.GetBackBuffer(fUp ? (++BackIndex) : (--BackIndex));
|
||||
if (!szPrevInput || !*szPrevInput)
|
||||
BackIndex = -1;
|
||||
else
|
||||
|
@ -814,3 +814,5 @@ void C4MessageBoardQuery::CompileFunc(StdCompiler *pComp)
|
|||
// list end
|
||||
pComp->Seperator(StdCompiler::SEP_END); // ')'
|
||||
}
|
||||
|
||||
C4MessageInput MessageInput;
|
||||
|
|
|
@ -2189,13 +2189,13 @@ void C4Player::ExecMsgBoardQueries()
|
|||
// query now possible?
|
||||
if (!C4GUI::IsGUIValid()) return;
|
||||
// already active?
|
||||
if (Game.MessageInput.IsTypeIn()) return;
|
||||
if (::MessageInput.IsTypeIn()) return;
|
||||
// find an un-evaluated query
|
||||
C4MessageBoardQuery *pCheck = pMsgBoardQuery;
|
||||
while (pCheck) if (!pCheck->fAnswered) break; else pCheck = pCheck->pNext;
|
||||
if (!pCheck) return;
|
||||
// open it
|
||||
Game.MessageInput.StartTypeIn(true, pCheck->pCallbackObj, pCheck->fIsUppercase, false, Number, pCheck->sInputQuery);
|
||||
::MessageInput.StartTypeIn(true, pCheck->pCallbackObj, pCheck->fIsUppercase, false, Number, pCheck->sInputQuery);
|
||||
}
|
||||
|
||||
void C4Player::CallMessageBoard(C4Object *pForObj, const StdStrBuf &sQueryString, bool fIsUppercase)
|
||||
|
|
|
@ -3700,7 +3700,7 @@ static bool FnAbortMessageBoard(C4AulContext *cthr, C4Object *pObj, long iForPlr
|
|||
C4Player *pPlr = Game.Players.Get(iForPlr);
|
||||
if (!pPlr) return FALSE;
|
||||
// close TypeIn if active
|
||||
Game.MessageInput.AbortMsgBoardQuery(pObj, iForPlr);
|
||||
::MessageInput.AbortMsgBoardQuery(pObj, iForPlr);
|
||||
// abort for it
|
||||
return pPlr->RemoveMessageBoardQuery(pObj);
|
||||
}
|
||||
|
@ -5449,7 +5449,7 @@ static bool FnAddMsgBoardCmd(C4AulContext *ctx, C4String *pstrCommand, C4String
|
|||
default: return FALSE;
|
||||
}
|
||||
// add command
|
||||
Game.MessageInput.AddCommand(FnStringPar(pstrCommand), FnStringPar(pstrScript), eRestriction);
|
||||
::MessageInput.AddCommand(FnStringPar(pstrCommand), FnStringPar(pstrScript), eRestriction);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue