1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-18 11:19:10 +00:00

Provide some sample conversions to plFormat for testing and copying

This commit is contained in:
2014-05-18 19:59:27 -07:00
parent 2cb19d3308
commit 933ae6ec17
12 changed files with 51 additions and 52 deletions

View File

@ -251,7 +251,7 @@ void plNetClientMgr::SetNullSend(bool on)
const char* plNetClientMgr::GetServerLogTimeAsString(plString& timestamp) const
{
const plUnifiedTime st=GetServerTime();
timestamp = plString::Format("{%02d/%02d %02d:%02d:%02d}",
timestamp = plFormat("{{{_02}/{_02} {_02}:{_02}:{_02}}",
st.GetMonth(), st.GetDay(), st.GetHour(), st.GetMinute(), st.GetSecond());
return timestamp.c_str();
}
@ -264,7 +264,7 @@ const char* ProcessTab(const char* fmt)
static plString s;
if (fmt && *fmt=='\t')
{
s = plString::Format(" %s", fmt);
s = plFormat(" {}", fmt);
return s.c_str();
}
return fmt;
@ -1230,7 +1230,7 @@ void plNetClientMgr::IDisableNet () {
if (!GetFlagsBit(plNetClientApp::kPlayingGame))
{
// KI may not be loaded
plString title = plString::Format("%s Error", plProduct::CoreName().c_str());
plString title = plFormat("{} Error", plProduct::CoreName());
hsMessageBox(fDisableMsg->str, title.c_str(), hsMessageBoxNormal, hsMessageBoxIconError );
plClientMsg *quitMsg = new plClientMsg(plClientMsg::kQuit);
quitMsg->Send(hsgResMgr::ResMgr()->FindKey(kClient_KEY));
@ -1356,8 +1356,8 @@ bool plNetClientMgr::IFindModifier(plSynchedObject* obj, int16_t classIdx)
cnt++;
}
hsAssert(cnt<2, plString::Format("Object %s has multiple SDL modifiers of the same kind (%s)?",
obj->GetKeyName().c_str(), plFactory::GetNameOfClass(classIdx)).c_str());
hsAssert(cnt<2, plFormat("Object {} has multiple SDL modifiers of the same kind ({})?",
obj->GetKeyName(), plFactory::GetNameOfClass(classIdx)).c_str());
return cnt==0 ? false : true;
}

View File

@ -957,9 +957,9 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void)
plString title;
unsigned nameLen = nc->GetPlayerName().GetSize();
if (nc->GetPlayerName().ToLower().CharAt(nameLen - 1) == 's')
title = plString::Format("%s'", nc->GetPlayerName().c_str());
title = plFormat("{}'", nc->GetPlayerName());
else
title = plString::Format("%s's", nc->GetPlayerName().c_str());
title = plFormat("{}'s", nc->GetPlayerName());
info->SetAgeUserDefinedName(title.c_str());
}
if (!info->HasAgeDescription())
@ -968,9 +968,9 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void)
plString desc;
unsigned nameLen = nc->GetPlayerName().GetSize();
if (nc->GetPlayerName().ToLower().CharAt(nameLen - 1) == 's')
desc = plString::Format("%s' %s", nc->GetPlayerName().c_str(), info->GetAgeInstanceName().c_str());
desc = plFormat("{}' {}", nc->GetPlayerName(), info->GetAgeInstanceName());
else
desc = plString::Format("%s's %s", nc->GetPlayerName().c_str(), info->GetAgeInstanceName().c_str());
desc = plFormat("{}'s {}", nc->GetPlayerName(), info->GetAgeInstanceName());
info->SetAgeDescription(desc.c_str());
}
if (!info->HasAgeInstanceGuid()) {
@ -996,9 +996,9 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void)
plString title;
unsigned nameLen = nc->GetPlayerName().GetSize();
if (nc->GetPlayerName().ToLower().CharAt(nameLen - 1) == 's')
title = plString::Format("%s'", nc->GetPlayerName().c_str());
title = plFormat("{}'", nc->GetPlayerName());
else
title = plString::Format("%s's", nc->GetPlayerName().c_str());
title = plFormat("{}'s", nc->GetPlayerName());
info->SetAgeUserDefinedName(title.c_str());
}
@ -1008,9 +1008,9 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void)
plString desc;
unsigned nameLen = nc->GetPlayerName().GetSize();
if (nc->GetPlayerName().ToLower().CharAt(nameLen - 1) == 's')
desc = plString::Format("%s' %s", nc->GetPlayerName().c_str(), info->GetAgeInstanceName().c_str());
desc = plFormat("{}' {}", nc->GetPlayerName(), info->GetAgeInstanceName());
else
desc = plString::Format("%s's %s", nc->GetPlayerName().c_str(), info->GetAgeInstanceName().c_str());
desc = plFormat("{}'s {}", nc->GetPlayerName(), info->GetAgeInstanceName());
info->SetAgeDescription( desc.c_str() );
}

View File

@ -330,7 +330,7 @@ public:
// debug
plString AsString() const
{
return plString::Format("object=%s, %s",fObjectHelper.GetUoid().StringIze().c_str(), plNetMessage::AsString().c_str());
return plFormat("object={}, {}",fObjectHelper.GetUoid(), plNetMessage::AsString());
}
};
@ -506,7 +506,7 @@ public:
plString AsString() const
{
const char* noc=plFactory::GetTheFactory()->GetNameOfClass(StreamInfo()->GetStreamType());
return plString::Format("%s %s",plNetMsgStream::AsString().c_str(), noc ? noc : "?");
return plFormat("{} {}", plNetMsgStream::AsString(), noc ? noc : "?");
}
};
@ -556,8 +556,8 @@ public:
// debug
plString AsString() const
{
return plString::Format("object=%s initial=%d, %s",fObjectHelper.GetUoid().StringIze().c_str(), fIsInitialState,
plNetMsgGameMessage::AsString().c_str());
return plFormat("object={} initial={}, {}",fObjectHelper.GetUoid(), fIsInitialState,
plNetMsgGameMessage::AsString());
}
};
@ -647,7 +647,7 @@ public:
// debug
plString AsString() const
{
return plString::Format("pageFlags:%02X, paging %s, requestingState:%s, resetting=%d",
return plFormat("pageFlags:{_02X}, paging {}, requestingState:{}, resetting={}",
fPageFlags, (fPageFlags&kPagingOut)?"out":"in",
(fPageFlags&kRequestState)?"yes":"no", (fPageFlags & kResetList)!=0);
}
@ -754,7 +754,7 @@ public:
// debug
plString AsString() const
{
return plString::Format("len=%d",fVoiceData.size());
return plFormat("len={}",fVoiceData.size());
}
};
@ -792,7 +792,7 @@ public:
// debug
plString AsString() const
{
return plString::Format("lockReq=%d, %s",fLockRequest, plNetMsgStreamedObject::AsString().c_str());
return plFormat("lockReq={}, {}",fLockRequest, plNetMsgStreamedObject::AsString());
}
};
@ -979,11 +979,11 @@ public:
plString b1, b2;
int i;
for(i=0;i<fRegionsImIn.GetNumBitVectors(); i++)
b1 += plString::Format("0x%x ", fRegionsImIn.GetBitVector(i));
b1 += plFormat("0x{x} ", fRegionsImIn.GetBitVector(i));
for(i=0;i<fRegionsICareAbout.GetNumBitVectors(); i++)
b2 += plString::Format("0x%x ", fRegionsICareAbout.GetBitVector(i));
return plString::Format("rgnsImIn:%s, rgnsICareAbout:%s, %s",
b1.c_str(), b2.c_str(), plNetMessage::AsString().c_str() );
b2 += plFormat("0x{x} ", fRegionsICareAbout.GetBitVector(i));
return plFormat("rgnsImIn:{}, rgnsICareAbout:{}, {}",
b1, b2, plNetMessage::AsString());
}
};

View File

@ -315,7 +315,7 @@ const char* plUnifiedTime::Print() const
const char* plUnifiedTime::PrintWMillis() const
{
static plString s;
s = plString::Format("%s,s:%lu,ms:%d",
s = plFormat("{},s:{},ms:{}",
Print(), (unsigned long)GetSecs(), GetMillis() );
return s.c_str();
}