本文整理汇总了C++中StdStrBuf::Copy方法的典型用法代码示例。如果您正苦于以下问题:C++ StdStrBuf::Copy方法的具体用法?C++ StdStrBuf::Copy怎么用?C++ StdStrBuf::Copy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StdStrBuf
的用法示例。
在下文中一共展示了StdStrBuf::Copy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
int C4Shader::ParsePosition(const char *szWhat, const char **ppPos)
{
const char *pPos = *ppPos;
while (isspace(*pPos)) pPos++;
// Expect a name
const char *pStart = pPos;
while (isalnum(*pPos)) pPos++;
StdStrBuf Name; Name.Copy(pStart, pPos - pStart);
// Lookup name
int iPosition = -1;
for (int i = 0; i < sizeof(C4SH_PosNames) / sizeof(*C4SH_PosNames); i++) {
if (SEqual(Name.getData(), C4SH_PosNames[i].Name)) {
iPosition = C4SH_PosNames[i].Position;
break;
}
}
if (iPosition == -1) {
ShaderLogF(" gl: Unknown slice position in %s: %s", szWhat, Name.getData());
return -1;
}
// Add modifier
while (isspace(*pPos)) pPos++;
if (*pPos == '+') {
int iMod, iModLen;
if (!sscanf(pPos+1, "%d%n", &iMod, &iModLen)) {
ShaderLogF(" gl: Invalid slice modifier in %s", szWhat);
return -1;
}
iPosition += iMod;
pPos += 1+iModLen;
}
if (*pPos == '-') {
int iMod, iModLen;
if (!sscanf(pPos+1, "%d%n", &iMod, &iModLen)) {
ShaderLogF(" gl: Invalid slice modifier in %s", szWhat);
return -1;
}
iPosition -= iMod;
pPos += 1+iModLen;
}
// Everything okay!
*ppPos = pPos;
return iPosition;
}
示例2: FormatString
C4GUI::Edit::InputResult C4ChatInputDialog::OnChatInput(C4GUI::Edit *edt,
bool fPasting,
bool fPastingMore) {
// no double processing
if (fProcessed) return C4GUI::Edit::IR_CloseDlg;
// get edit text
C4GUI::Edit *pEdt = reinterpret_cast<C4GUI::Edit *>(edt);
char *szInputText = const_cast<char *>(pEdt->GetText());
// Store to back buffer
Game.MessageInput.StoreBackBuffer(szInputText);
// script queried input?
if (fObjInput) {
fProcessed = true;
// check if the target input is still valid
C4Player *pPlr = Game.Players.Get(iPlr);
if (!pPlr) return C4GUI::Edit::IR_CloseDlg;
if (!pPlr->MarkMessageBoardQueryAnswered(pTarget)) {
// there was no associated query!
return C4GUI::Edit::IR_CloseDlg;
}
// then do a script callback, incorporating the input into the answer
if (fUppercase) SCapitalize(szInputText);
StdStrBuf sInput;
sInput.Copy(szInputText);
sInput.EscapeString();
Game.Control.DoInput(
CID_Script,
new C4ControlScript(
FormatString("OnMessageBoardAnswer(Object(%d), %d, \"%s\")",
pTarget ? pTarget->Number : 0, iPlr,
sInput.getData()).getData()),
CDT_Decide);
return C4GUI::Edit::IR_CloseDlg;
} else
// reroute to message input class
Game.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
// just for pasting mode; usually the dlg will be closed now anyway
pEdt->SelectAll();
// avoid dlg close, if more content is to be pasted
if (fPastingMore) return C4GUI::Edit::IR_None;
fProcessed = true;
return C4GUI::Edit::IR_CloseDlg;
}
示例3: SetCaptionColor
void C4ChatControl::ChatSheet::AddTextLine(const char *szText, uint32_t dwClr) {
// strip stuff that would confuse Clonk
StdStrBuf sText;
sText.Copy(szText);
for (char c = '\x01'; c < ' '; ++c) sText.ReplaceChar(c, ' ');
// convert incoming UTF-8
convUTF8toWindows(sText);
// add text line to chat box
CStdFont *pUseFont = &C4GUI::GetRes()->TextFont;
pChatBox->AddTextLine(sText.getData(), pUseFont, dwClr, true, false);
pChatBox->ScrollToBottom();
// sheet now has unread messages if not selected
if (!fHasUnread && !IsActiveSheet()) {
fHasUnread = true;
SetCaptionColor(C4GUI_Caption2FontClr);
}
}
示例4: fError
C4PortraitSelDlg::ListItem::ListItem(const char *szFilename)
: C4FileSelDlg::ListItem(szFilename), fError(false), fLoaded(false) {
CStdFont *pUseFont = &(C4GUI::GetRes()->MiniFont);
// determine label text
StdStrBuf sDisplayLabel;
if (szFilename) {
sDisplayLabel.Copy(::GetFilename(szFilename));
::RemoveExtension(&sDisplayLabel);
} else {
sDisplayLabel.Ref(LoadResStr("IDS_MSG_NOPORTRAIT"));
}
// insert linebreaks into label text
int32_t iLineHgt = Max<int32_t>(
pUseFont->BreakMessage(sDisplayLabel.getData(), ImagePreviewSize - 6,
&sFilenameLabelText, false),
1);
// set size
SetBounds(C4Rect(0, 0, ImagePreviewSize, ImagePreviewSize + iLineHgt));
}
示例5:
void C4DefGraphicsPtrBackup::Add(C4DefGraphics* pGfx)
{
for(C4DefGraphics* pCur = pGfx; pCur != NULL; pCur = pCur->pNext)
Entries.push_back(new C4DefGraphicsPtrBackupEntry(pCur));
// Remove all mesh materials that were loaded from this definition
C4Def* pDef = pGfx->pDef;
for(StdMeshMatManager::Iterator iter = ::MeshMaterialManager.Begin(); iter != MeshMaterialManager.End(); )
{
StdStrBuf Filename;
Filename.Copy(pDef->Filename);
Filename.Append("/"); Filename.Append(GetFilename(iter->FileName.getData()));
if(Filename == iter->FileName)
iter = ::MeshMaterialManager.Remove(iter, &MeshMaterialUpdate);
else
++iter;
}
}
示例6: caMain
C4FileSelDlg::DefaultListItem::DefaultListItem(const char *szFilename,
bool fTruncateExtension,
bool fCheckbox, bool fGrayed,
C4GUI::Icons eIcon)
: C4FileSelDlg::ListItem(szFilename),
pLbl(NULL),
pCheck(NULL),
pKeyCheck(NULL),
fGrayed(fGrayed) {
StdStrBuf sLabel;
if (szFilename)
sLabel.Ref(::GetFilename(szFilename));
else
sLabel.Ref(LoadResStr("IDS_CTL_NONE"));
if (szFilename && fTruncateExtension) {
sLabel.Copy();
char *szFilename = sLabel.GrabPointer();
RemoveExtension(szFilename);
sLabel.Take(szFilename);
}
rcBounds.Hgt = C4GUI::GetRes()->TextFont.GetLineHeight();
UpdateSize();
C4GUI::ComponentAligner caMain(GetContainedClientRect(), 0, 0);
int32_t iHeight = caMain.GetInnerHeight();
if (fCheckbox) {
pCheck = new C4GUI::CheckBox(caMain.GetFromLeft(iHeight), NULL, false);
if (fGrayed) pCheck->SetEnabled(false);
AddElement(pCheck);
pKeyCheck = new C4KeyBinding(
C4KeyCodeEx(K_SPACE), "FileSelToggleFileActive", KEYSCOPE_Gui,
new C4GUI::ControlKeyCB<ListItem>(*this, &ListItem::UserToggleCheck),
C4CustomKey::PRIO_Ctrl);
}
C4GUI::Icon *pIco = new C4GUI::Icon(caMain.GetFromLeft(iHeight), eIcon);
AddElement(pIco);
pLbl = new C4GUI::Label(
sLabel.getData(), caMain.GetAll(), ALeft,
fGrayed ? C4GUI_CheckboxDisabledFontClr : C4GUI_CheckboxFontClr);
AddElement(pLbl);
}
示例7: GetLogSection
bool GetLogSection(size_t iStart, size_t iLength, StdStrBuf &rsOut)
{
if (!iLength) { rsOut.Clear(); return true; }
// read section from log file
CStdFile LogFileRead;
char *szBuf, *szBufOrig; size_t iSize; // size exclusing terminator
if (!LogFileRead.Load(sLogFileName.getData(), (BYTE **)&szBuf, (int *) &iSize, 1)) return false;
szBufOrig = szBuf;
// reduce to desired buffer section
if (iStart > iSize) iStart = iSize;
if (iStart + iLength > iSize) iLength = iSize - iStart;
szBuf += iStart; szBuf[iLength] = '\0';
// strip timestamps; convert linebreaks to Clonk-linebreaks '|'
char *szPosWrite=szBuf; const char *szPosRead=szBuf;
while (*szPosRead)
{
// skip timestamp
if (*szPosRead == '[')
while (*szPosRead && *szPosRead != ']') { --iSize; ++szPosRead; }
// skip whitespace behind timestamp
if (!*szPosRead) break;
szPosRead++;
// copy data until linebreak
size_t iLen=0;
while (*szPosRead && *szPosRead != 0x0d && *szPosRead != 0x0a)
{ ++szPosRead; ++iLen; }
if (iLen && szPosRead-iLen != szPosWrite) memmove(szPosWrite, szPosRead-iLen, iLen);
szPosWrite += iLen;
// skip additional linebreaks
while (*szPosRead == 0x0d || *szPosRead == 0x0a) ++szPosRead;
// write a Clonk-linebreak
if (*szPosRead) *szPosWrite++ = '|';
}
// done; create string buffer from data
rsOut.Copy(szBuf, szPosWrite - szBuf);
// old buf no longer used
delete [] szBufOrig;
// done, success
return true;
}
示例8: if
void C4PlayerInfoListAttributeConflictResolver::ResolveInPacket()
{
// check all player infos
fAnyChange = false;
int32_t iCheck = 0;
while ((pResolveInfo = pResolvePacket->GetPlayerInfo(iCheck++)))
{
// not already joined? Joined player must not change their attributes!
if (pResolveInfo->HasJoined()) continue;
DWORD dwPrevColor = pResolveInfo->GetColor();
StdStrBuf sPrevForcedName; sPrevForcedName.Copy(pResolveInfo->GetForcedName());
// check attributes: Name and color
for (eAttr = C4PlayerInfo::PLRATT_Color; eAttr != C4PlayerInfo::PLRATT_Last; eAttr = (C4PlayerInfo::Attribute) (eAttr+1))
{
if (eAttr == C4PlayerInfo::PLRATT_Color)
{
// no color change in savegame associations
if (pResolveInfo->GetAssociatedSavegamePlayerID()) continue;
// or forced team colors
if (Game.Teams.IsTeamColors() && Game.Teams.GetTeamByID(pResolveInfo->GetTeam())) continue;
}
else if (eAttr == C4PlayerInfo::PLRATT_Name)
{
// no name change if a league name is used
if (pResolveInfo->getLeagueAccount() && *pResolveInfo->getLeagueAccount()) continue;
}
// not if attributes are otherwise fixed (e.g., for script players)
if (pResolveInfo->IsAttributesFixed()) continue;
// resolve in this info
ResolveInInfo();
}
// mark change for return value if anything was changed
if (pResolveInfo->GetColor() != dwPrevColor || (pResolveInfo->GetForcedName() != sPrevForcedName))
fAnyChange = true;
// next player info check
}
// mark update if anything was changed
if (fAnyChange) pResolvePacket->SetUpdated();
}
示例9:
void C4GameSave::WriteDescDefinitions(StdStrBuf &sBuf)
{
// Definition specs
if (Game.DefinitionFilenames[0])
{
char szDef[_MAX_PATH+1];
// Desc
sBuf.Append(LoadResStr("IDS_DESC_DEFSPECS"));
// Get definition modules
for (int cnt=0; SGetModule(Game.DefinitionFilenames,cnt,szDef); cnt++)
{
// Get exe relative path
StdStrBuf sDefFilename;
sDefFilename.Copy(Config.AtRelativePath(szDef));
// Append comma
if (cnt>0) sBuf.Append(", ");
// Apend to desc
sBuf.Append(sDefFilename);
}
// End of line
WriteDescLineFeed(sBuf);
}
}
示例10:
bool C4ScriptHost::LoadData(const char *szFilename, const char *szData, class C4LangStringTable *pLocalTable)
{
// String Table
if (stringTable != pLocalTable)
{
if (stringTable) stringTable->DelRef();
stringTable = pLocalTable;
if (stringTable) stringTable->AddRef();
}
ScriptName.Copy(szFilename);
StdStrBuf tempScript;
tempScript.Copy(szData);
Script.Clear();
if(stringTable)
stringTable->ReplaceStrings(tempScript, Script);
else
Script.Take(tempScript);
Preparse();
return true;
}
示例11: SCopySegment
bool C4ComponentHost::GetLanguageString(const char *szLanguage,
StdStrBuf &rTarget) {
const char *cptr;
// No good parameters
if (!szLanguage || !Data) return false;
// Search for two-letter language identifier in text body, i.e. "DE:"
char langindex[4] = "";
for (int clseg = 0;
SCopySegment(szLanguage ? szLanguage : "", clseg, langindex, ',', 2);
clseg++) {
SAppend(":", langindex);
if (cptr = SSearch(Data.getData(), langindex)) {
// Return the according string
int iEndPos = SCharPos('\r', cptr);
if (iEndPos < 0) iEndPos = SCharPos('\n', cptr);
if (iEndPos < 0) iEndPos = strlen(cptr);
rTarget.Copy(cptr, iEndPos);
return true;
}
}
// Language string not found
return false;
}
示例12: GetIndexedPlayer
StdStrBuf C4Team::GetNameWithParticipants() const
{
// compose team name like "Team 1 (boni, GhostBear, Clonko)"
// or just "Team 1" for empty team
StdStrBuf sTeamName;
sTeamName.Copy(GetName());
if (GetPlayerCount())
{
sTeamName.Append(" (");
int32_t iTeamPlrCount=0;
for (int32_t j=0; j<GetPlayerCount(); ++j)
{
int32_t iPlr = GetIndexedPlayer(j);
C4PlayerInfo *pPlrInfo;
if (iPlr) if ((pPlrInfo = Game.PlayerInfos.GetPlayerInfoByID(iPlr)))
{
if (iTeamPlrCount++) sTeamName.Append(", ");
sTeamName.Append(pPlrInfo->GetName());
}
}
sTeamName.AppendChar(')');
}
return sTeamName;
}
示例13: ParsePosition
void C4Shader::AddSlices(ShaderSliceList& slices, const char *szWhat, const char *szText, const char *szSource, int iSourceTime)
{
const char *pStart = szText, *pPos = szText;
int iDepth = -1;
int iPosition = -1;
bool fGotContent = false; // Anything in the slice apart from comments and white-space?
// Find slices
while(*pPos) {
// Comment? Might seem silly, but we don't want to get confused by braces in comments...
if (*pPos == '/' && *(pPos + 1) == '/') {
pPos += 2;
while (*pPos && *pPos != '\n') pPos++;
continue;
}
if (*pPos == '/' && *(pPos + 1) == '*') {
pPos += 2;
while (*pPos && (*pPos != '*' || *(pPos+1) != '/')) pPos++;
if (*pPos) pPos += 2;
continue;
}
// Opening brace?
if (*pPos == '{') {
iDepth++; pPos++;
continue;
}
if (*pPos == '}') {
// End of slice?
if (iPosition != -1 && !iDepth) {
// Have a new slice!
if (fGotContent)
{
StdStrBuf Str; Str.Copy(pStart, pPos - pStart);
AddSlice(slices, iPosition, Str.getData(), szSource, iSourceTime);
}
iPosition = -1;
pStart = pPos+1;
fGotContent = false;
}
if (iDepth >= 0)
iDepth--;
pPos++;
continue;
}
// New slice? We need a newline followed by "slice". Don't do
// the depth check, so that we also recognize slices inside
// an ifdefed-out "void main() {" block.
if (*pPos == '\n') {
if (SEqual2(pPos+1, "slice") && !isalnum(*(pPos+6))) {
const char *pSliceEnd = pPos; pPos += 6;
while(isspace(*pPos)) pPos++;
if(*pPos != '(') { pPos++; continue; }
pPos++;
// Now let's parse the position
iPosition = ParsePosition(szWhat, &pPos);
if (iPosition != -1) {
// Make sure a closing parenthesis
while(isspace(*pPos)) pPos++;
if(*pPos != ')') { pPos++; continue; }
pPos++;
// Make sure an opening brace follows
while(isspace(*pPos)) pPos++;
if (*pPos == '{') {
// Add code before "slice" as new slice
if (fGotContent)
{
StdStrBuf Str; Str.Copy(pStart, pSliceEnd - pStart);
AddSlice(slices, -1, Str.getData(), szSource, iSourceTime);
}
iDepth = 0;
pStart = pPos+1;
fGotContent = false;
} else {
ShaderLogF(" gl: Missing opening brace in %s!", szWhat);
}
pPos++;
continue;
}
}
}
// Otherwise: Continue
if (!isspace(*pPos)) fGotContent = true;
pPos++;
}
// Add final slice
if (fGotContent)
{
StdStrBuf Str; Str.Copy(pStart, pPos - pStart);
AddSlice(slices, iPosition, Str.getData(), szSource, iSourceTime);
//.........这里部分代码省略.........
示例14: file
bool C4Application::DoInit(int argc, char * argv[])
{
assert(AppState == C4AS_None);
// Config overwrite by parameter
StdStrBuf sConfigFilename;
for (int32_t iPar=0; iPar < argc; iPar++)
if (SEqual2NoCase(argv[iPar], "--config="))
sConfigFilename.Copy(argv[iPar] + 9);
// Config check
Config.Init();
Config.Load(sConfigFilename.getData());
Config.Save();
// sometimes, the configuration can become corrupted due to loading errors or w/e
// check this and reset defaults if necessary
if (Config.IsCorrupted())
{
if (sConfigFilename)
{
// custom config corrupted: Fail
Log("ERROR: Custom configuration corrupted - program abort!\n");
return false;
}
else
{
// default config corrupted: Restore default
Log("Warning: Configuration corrupted - restoring default!\n");
Config.Default();
Config.Save();
Config.Load();
}
}
// Open log
OpenLog();
Revision.Ref(C4REVISION);
// Engine header message
Log(C4ENGINECAPTION);
LogF("Version: %s %s (%s)", C4VERSION, C4_OS, Revision.getData());
LogF("ExePath: \"%s\"", Config.General.ExePath.getData());
LogF("SystemDataPath: \"%s\"", Config.General.SystemDataPath);
LogF("UserDataPath: \"%s\"", Config.General.UserDataPath);
// Init C4Group
C4Group_SetProcessCallback(&ProcessCallback);
C4Group_SetTempPath(Config.General.TempPath.getData());
C4Group_SetSortList(C4CFN_FLS);
// Cleanup temp folders left behind
Config.CleanupTempUpdateFolder();
// Initialize game data paths
Reloc.Init();
// init system group
if (!Reloc.Open(SystemGroup, C4CFN_System))
{
// Error opening system group - no LogFatal, because it needs language table.
// This will *not* use the FatalErrors stack, but this will cause the game
// to instantly halt, anyway.
const char *szMessage = "Error opening system group file (System.ocg)!";
Log(szMessage);
// Fatal error, game cannot start - have player notice
MessageDialog(szMessage);
return false;
}
// Parse command line
ParseCommandLine(argc, argv);
// Open additional logs that depend on command line
OpenExtraLogs();
// Init external language packs
Languages.Init();
// Load language string table
if (!Languages.LoadLanguage(Config.General.LanguageEx))
// No language table was loaded - bad luck...
if (!Languages.HasStringTable())
Log("WARNING: No language string table loaded!");
#if defined(WIN32) && defined(WITH_AUTOMATIC_UPDATE)
// Windows: handle incoming updates directly, even before starting up the gui
// because updates will be applied in the console anyway.
if (Application.IncomingUpdate)
if (C4UpdateDlg::ApplyUpdate(Application.IncomingUpdate.getData(), false, NULL))
return true;
#endif
// Fixup resolution
if (!Config.Graphics.Windowed)
ApplyResolutionConstraints();
// activate
Active=true;
// Init carrier window
if (!isEditor)
{
if (!(pWindow = FullScreen.Init(this)))
{ Clear(); ShowGfxErrorDialog(); return false; }
//.........这里部分代码省略.........
示例15: if
bool C4MessageInput::ProcessCommand(const char *szCommand) {
C4GameLobby::MainDlg *pLobby = Game.Network.GetLobby();
// command
char szCmdName[C4MaxName + 1];
SCopyUntil(szCommand + 1, szCmdName, ' ', C4MaxName);
// parameter
const char *pCmdPar = SSearch(szCommand, " ");
if (!pCmdPar) pCmdPar = "";
// dev-scripts
if (SEqual(szCmdName, "help")) {
LogF(LoadResStr("IDS_TEXT_COMMANDSAVAILABLEDURINGGA"));
LogF("/private [player] [message] - %s",
LoadResStr("IDS_MSG_SENDAPRIVATEMESSAGETOTHES"));
LogF("/team [message] - %s",
LoadResStr("IDS_MSG_SENDAPRIVATEMESSAGETOYOUR"));
LogF("/me [action] - %s", LoadResStr("IDS_TEXT_PERFORMANACTIONINYOURNAME"));
LogF("/sound [sound] - %s",
LoadResStr("IDS_TEXT_PLAYASOUNDFROMTHEGLOBALSO"));
LogF("/kick [client] - %s", LoadResStr("IDS_TEXT_KICKTHESPECIFIEDCLIENT"));
LogF("/observer [client] - %s",
LoadResStr("IDS_TEXT_SETTHESPECIFIEDCLIENTTOOB"));
LogF("/fast [x] - %s", LoadResStr("IDS_TEXT_SETTOFASTMODESKIPPINGXFRA"));
LogF("/slow - %s", LoadResStr("IDS_TEXT_SETTONORMALSPEEDMODE"));
LogF("/chart - %s", LoadResStr("IDS_TEXT_DISPLAYNETWORKSTATISTICS"));
LogF("/nodebug - %s", LoadResStr("IDS_TEXT_PREVENTDEBUGMODEINTHISROU"));
LogF("/set comment [comment] - %s",
LoadResStr("IDS_TEXT_SETANEWNETWORKCOMMENT"));
LogF("/set password [password] - %s",
LoadResStr("IDS_TEXT_SETANEWNETWORKPASSWORD"));
LogF("/set faircrew [on/off] - %s",
LoadResStr("IDS_TEXT_ENABLEORDISABLEFAIRCREW"));
LogF("/set maxplayer [4] - %s",
LoadResStr("IDS_TEXT_SETANEWMAXIMUMNUMBEROFPLA"));
LogF("/script [script] - %s", LoadResStr("IDS_TEXT_EXECUTEASCRIPTCOMMAND"));
LogF("/clear - %s", LoadResStr("IDS_MSG_CLEARTHEMESSAGEBOARD"));
return TRUE;
}
// dev-scripts
if (SEqual(szCmdName, "script")) {
if (!Game.IsRunning) return FALSE;
if (!Game.DebugMode) return FALSE;
if (!Game.Network.isEnabled() &&
!SEqual(Game.ScenarioFile.GetMaker(), Config.General.Name) &&
Game.ScenarioFile.GetStatus() != GRPF_Folder)
return FALSE;
if (Game.Network.isEnabled() && !Game.Network.isHost()) return FALSE;
Game.Control.DoInput(
CID_Script,
new C4ControlScript(pCmdPar, C4ControlScript::SCOPE_Console, false),
CDT_Decide);
return TRUE;
}
// set runtimte properties
if (SEqual(szCmdName, "set")) {
if (SEqual2(pCmdPar, "maxplayer ")) {
if (Game.Control.isCtrlHost()) {
if (atoi(pCmdPar + 10) == 0 && !SEqual(pCmdPar + 10, "0")) {
Log("Syntax: /set maxplayer count");
return FALSE;
}
Game.Control.DoInput(
CID_Set, new C4ControlSet(C4CVT_MaxPlayer, atoi(pCmdPar + 10)),
CDT_Decide);
return TRUE;
}
}
if (SEqual2(pCmdPar, "comment ") || SEqual(pCmdPar, "comment")) {
if (!Game.Network.isEnabled() || !Game.Network.isHost()) return FALSE;
// Set in configuration, update reference
Config.Network.Comment.CopyValidated(pCmdPar[7] ? (pCmdPar + 8) : "");
Game.Network.InvalidateReference();
Log(LoadResStr("IDS_NET_COMMENTCHANGED"));
return TRUE;
}
if (SEqual2(pCmdPar, "password ") || SEqual(pCmdPar, "password")) {
if (!Game.Network.isEnabled() || !Game.Network.isHost()) return FALSE;
Game.Network.SetPassword(pCmdPar[8] ? (pCmdPar + 9) : NULL);
if (pLobby) pLobby->UpdatePassword();
return TRUE;
}
if (SEqual2(pCmdPar, "faircrew ")) {
if (!Game.Control.isCtrlHost() || Game.Parameters.isLeague())
return FALSE;
C4ControlSet *pSet = NULL;
if (SEqual(pCmdPar + 9, "on"))
pSet =
new C4ControlSet(C4CVT_FairCrew, Config.General.FairCrewStrength);
else if (SEqual(pCmdPar + 9, "off"))
pSet = new C4ControlSet(C4CVT_FairCrew, -1);
else if (isdigit((unsigned char)pCmdPar[9]))
pSet = new C4ControlSet(C4CVT_FairCrew, atoi(pCmdPar + 9));
else
return FALSE;
Game.Control.DoInput(CID_Set, pSet, CDT_Decide);
return TRUE;
}
// unknown property
return FALSE;
//.........这里部分代码省略.........