Replace ke::Vector with std::vector.
This commit is contained in:
@@ -137,26 +137,26 @@ void ChatTriggers::OnSourceModGameInitialized()
|
||||
};
|
||||
|
||||
if (ConCommand *say = FindCommand("say")) {
|
||||
hooks_.append(sCoreProviderImpl.AddCommandHook(say, pre_hook));
|
||||
hooks_.append(sCoreProviderImpl.AddPostCommandHook(say, post_hook));
|
||||
hooks_.push_back(sCoreProviderImpl.AddCommandHook(say, pre_hook));
|
||||
hooks_.push_back(sCoreProviderImpl.AddPostCommandHook(say, post_hook));
|
||||
}
|
||||
if (ConCommand *say_team = FindCommand("say_team")) {
|
||||
hooks_.append(sCoreProviderImpl.AddCommandHook(say_team, pre_hook));
|
||||
hooks_.append(sCoreProviderImpl.AddPostCommandHook(say_team, post_hook));
|
||||
hooks_.push_back(sCoreProviderImpl.AddCommandHook(say_team, pre_hook));
|
||||
hooks_.push_back(sCoreProviderImpl.AddPostCommandHook(say_team, post_hook));
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_EPISODEONE
|
||||
m_bIsINS = (strcmp(g_SourceMod.GetGameFolderName(), "insurgency") == 0);
|
||||
if (m_bIsINS) {
|
||||
if (ConCommand *say2 = FindCommand("say2")) {
|
||||
hooks_.append(sCoreProviderImpl.AddCommandHook(say2, pre_hook));
|
||||
hooks_.append(sCoreProviderImpl.AddPostCommandHook(say2, post_hook));
|
||||
hooks_.push_back(sCoreProviderImpl.AddCommandHook(say2, pre_hook));
|
||||
hooks_.push_back(sCoreProviderImpl.AddPostCommandHook(say2, post_hook));
|
||||
}
|
||||
}
|
||||
#elif SOURCE_ENGINE == SE_NUCLEARDAWN
|
||||
if (ConCommand *say_squad = FindCommand("say_squad")) {
|
||||
hooks_.append(sCoreProviderImpl.AddCommandHook(say_squad, pre_hook));
|
||||
hooks_.append(sCoreProviderImpl.AddPostCommandHook(say_squad, post_hook));
|
||||
hooks_.push_back(sCoreProviderImpl.AddCommandHook(say_squad, pre_hook));
|
||||
hooks_.push_back(sCoreProviderImpl.AddPostCommandHook(say_squad, post_hook));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
+1
-1
@@ -73,7 +73,7 @@ private:
|
||||
bool ClientIsFlooding(int client);
|
||||
cell_t CallOnClientSayCommand(int client);
|
||||
private:
|
||||
ke::Vector<ke::RefPtr<CommandHook>> hooks_;
|
||||
std::vector<ke::RefPtr<CommandHook>> hooks_;
|
||||
std::string m_PubTrigger;
|
||||
std::string m_PrivTrigger;
|
||||
bool m_bWillProcessInPost;
|
||||
|
||||
+1
-1
@@ -91,7 +91,7 @@ void GameHooks::OnVSPReceived()
|
||||
|
||||
void GameHooks::Shutdown()
|
||||
{
|
||||
for (size_t i = 0; i < hooks_.length(); i++)
|
||||
for (size_t i = 0; i < hooks_.size(); i++)
|
||||
SH_REMOVE_HOOK_ID(hooks_[i]);
|
||||
hooks_.clear();
|
||||
|
||||
|
||||
+2
-2
@@ -114,11 +114,11 @@ private:
|
||||
void SetCommandClient(int client);
|
||||
|
||||
private:
|
||||
class HookList : public ke::Vector<int>
|
||||
class HookList : public std::vector<int>
|
||||
{
|
||||
public:
|
||||
HookList &operator += (int hook_id) {
|
||||
this->append(hook_id);
|
||||
this->push_back(hook_id);
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
+10
-10
@@ -628,7 +628,7 @@ Handle_t CBaseMenu::GetHandle()
|
||||
bool CBaseMenu::AppendItem(const char *info, const ItemDrawInfo &draw)
|
||||
{
|
||||
if (m_Pagination == (unsigned)MENU_NO_PAGINATION
|
||||
&& m_items.length() >= m_pStyle->GetMaxPageItems())
|
||||
&& m_items.size() >= m_pStyle->GetMaxPageItems())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -640,19 +640,19 @@ bool CBaseMenu::AppendItem(const char *info, const ItemDrawInfo &draw)
|
||||
item.display = std::make_unique<std::string>(draw.display);
|
||||
item.style = draw.style;
|
||||
|
||||
m_items.append(std::move(item));
|
||||
m_items.push_back(std::move(item));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CBaseMenu::InsertItem(unsigned int position, const char *info, const ItemDrawInfo &draw)
|
||||
{
|
||||
if (m_Pagination == (unsigned)MENU_NO_PAGINATION &&
|
||||
m_items.length() >= m_pStyle->GetMaxPageItems())
|
||||
m_items.size() >= m_pStyle->GetMaxPageItems())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (position >= m_items.length())
|
||||
if (position >= m_items.size())
|
||||
return false;
|
||||
|
||||
CItem item;
|
||||
@@ -661,16 +661,16 @@ bool CBaseMenu::InsertItem(unsigned int position, const char *info, const ItemDr
|
||||
item.display = std::make_unique<std::string>(draw.display);
|
||||
item.style = draw.style;
|
||||
|
||||
m_items.insert(position, std::move(item));
|
||||
ke::InsertAt(&m_items, position, std::move(item));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CBaseMenu::RemoveItem(unsigned int position)
|
||||
{
|
||||
if (position >= m_items.length())
|
||||
if (position >= m_items.size())
|
||||
return false;
|
||||
|
||||
m_items.remove(position);
|
||||
ke::RemoveAt(&m_items, position);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -681,7 +681,7 @@ void CBaseMenu::RemoveAllItems()
|
||||
|
||||
const char *CBaseMenu::GetItemInfo(unsigned int position, ItemDrawInfo *draw/* =NULL */)
|
||||
{
|
||||
if (position >= m_items.length())
|
||||
if (position >= m_items.size())
|
||||
return NULL;
|
||||
|
||||
if (draw)
|
||||
@@ -695,7 +695,7 @@ const char *CBaseMenu::GetItemInfo(unsigned int position, ItemDrawInfo *draw/* =
|
||||
|
||||
unsigned int CBaseMenu::GetItemCount()
|
||||
{
|
||||
return m_items.length();
|
||||
return m_items.size();
|
||||
}
|
||||
|
||||
bool CBaseMenu::SetPagination(unsigned int itemsPerPage)
|
||||
@@ -825,5 +825,5 @@ IMenuHandler *CBaseMenu::GetHandler()
|
||||
|
||||
unsigned int CBaseMenu::GetBaseMemUsage()
|
||||
{
|
||||
return m_Title.length() + (m_items.length() * sizeof(CItem));
|
||||
return m_Title.size() + (m_items.size() * sizeof(CItem));
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ protected:
|
||||
std::string m_Title;
|
||||
IMenuStyle *m_pStyle;
|
||||
unsigned int m_Pagination;
|
||||
ke::Vector<CItem> m_items;
|
||||
std::vector<CItem> m_items;
|
||||
bool m_bShouldDelete;
|
||||
bool m_bCancelling;
|
||||
IdentityToken_t *m_pOwner;
|
||||
|
||||
+16
-16
@@ -46,7 +46,7 @@ CDataPack::~CDataPack()
|
||||
Initialize();
|
||||
}
|
||||
|
||||
static ke::Vector<std::unique_ptr<CDataPack>> sDataPackCache;
|
||||
static std::vector<std::unique_ptr<CDataPack>> sDataPackCache;
|
||||
|
||||
CDataPack *CDataPack::New()
|
||||
{
|
||||
@@ -54,7 +54,7 @@ CDataPack *CDataPack::New()
|
||||
return new CDataPack();
|
||||
|
||||
CDataPack *pack = sDataPackCache.back().release();
|
||||
sDataPackCache.pop();
|
||||
sDataPackCache.pop_back();
|
||||
pack->Initialize();
|
||||
return pack;
|
||||
}
|
||||
@@ -62,7 +62,7 @@ CDataPack *CDataPack::New()
|
||||
void
|
||||
CDataPack::Free(CDataPack *pack)
|
||||
{
|
||||
sDataPackCache.append(static_cast<CDataPack *>(pack));
|
||||
sDataPackCache.emplace_back(pack);
|
||||
}
|
||||
|
||||
void CDataPack::Initialize()
|
||||
@@ -87,7 +87,7 @@ size_t CDataPack::CreateMemory(size_t size, void **addr)
|
||||
val.type = CDataPackType::Raw;
|
||||
val.pData.vval = new uint8_t[size + sizeof(size)];
|
||||
reinterpret_cast<size_t *>(val.pData.vval)[0] = size;
|
||||
elements.insert(position, val);
|
||||
ke::InsertAt(&elements, position, val);
|
||||
|
||||
return position++;
|
||||
}
|
||||
@@ -97,7 +97,7 @@ void CDataPack::PackCell(cell_t cell)
|
||||
InternalPack val;
|
||||
val.type = CDataPackType::Cell;
|
||||
val.pData.cval = cell;
|
||||
elements.insert(position++, val);
|
||||
ke::InsertAt(&elements, position++, val);
|
||||
}
|
||||
|
||||
void CDataPack::PackFunction(cell_t function)
|
||||
@@ -105,7 +105,7 @@ void CDataPack::PackFunction(cell_t function)
|
||||
InternalPack val;
|
||||
val.type = CDataPackType::Function;
|
||||
val.pData.cval = function;
|
||||
elements.insert(position++, val);
|
||||
ke::InsertAt(&elements, position++, val);
|
||||
}
|
||||
|
||||
void CDataPack::PackFloat(float floatval)
|
||||
@@ -113,7 +113,7 @@ void CDataPack::PackFloat(float floatval)
|
||||
InternalPack val;
|
||||
val.type = CDataPackType::Float;
|
||||
val.pData.fval = floatval;
|
||||
elements.insert(position++, val);
|
||||
ke::InsertAt(&elements, position++, val);
|
||||
}
|
||||
|
||||
void CDataPack::PackString(const char *string)
|
||||
@@ -122,7 +122,7 @@ void CDataPack::PackString(const char *string)
|
||||
val.type = CDataPackType::String;
|
||||
std::string *sval = new std::string(string);
|
||||
val.pData.sval = sval;
|
||||
elements.insert(position++, val);
|
||||
ke::InsertAt(&elements, position++, val);
|
||||
}
|
||||
|
||||
void CDataPack::PackCellArray(cell_t const *vals, cell_t count)
|
||||
@@ -133,7 +133,7 @@ void CDataPack::PackCellArray(cell_t const *vals, cell_t count)
|
||||
val.pData.aval = new cell_t [count + 1];
|
||||
memcpy(&val.pData.aval[1], vals, sizeof(cell_t) * (count + 1));
|
||||
val.pData.aval[0] = count;
|
||||
elements.insert(position++, val);
|
||||
ke::InsertAt(&elements, position++, val);
|
||||
}
|
||||
|
||||
void CDataPack::PackFloatArray(cell_t const *vals, cell_t count)
|
||||
@@ -144,7 +144,7 @@ void CDataPack::PackFloatArray(cell_t const *vals, cell_t count)
|
||||
val.pData.aval = new cell_t [count + 1];
|
||||
memcpy(&val.pData.aval[1], vals, sizeof(cell_t) * (count + 1));
|
||||
val.pData.aval[0] = count;
|
||||
elements.insert(position++, val);
|
||||
ke::InsertAt(&elements, position++, val);
|
||||
}
|
||||
|
||||
void CDataPack::Reset() const
|
||||
@@ -159,7 +159,7 @@ size_t CDataPack::GetPosition() const
|
||||
|
||||
bool CDataPack::SetPosition(size_t pos) const
|
||||
{
|
||||
if (pos > elements.length())
|
||||
if (pos > elements.size())
|
||||
return false;
|
||||
|
||||
position = pos;
|
||||
@@ -192,7 +192,7 @@ float CDataPack::ReadFloat() const
|
||||
|
||||
bool CDataPack::IsReadable(size_t bytes) const
|
||||
{
|
||||
return (position < elements.length());
|
||||
return (position < elements.size());
|
||||
}
|
||||
|
||||
const char *CDataPack::ReadString(size_t *len) const
|
||||
@@ -207,7 +207,7 @@ const char *CDataPack::ReadString(size_t *len) const
|
||||
|
||||
const std::string &val = *elements[position++].pData.sval;
|
||||
if (len)
|
||||
*len = val.length();
|
||||
*len = val.size();
|
||||
|
||||
return val.c_str();
|
||||
}
|
||||
@@ -270,7 +270,7 @@ void *CDataPack::ReadMemory(size_t *size) const
|
||||
|
||||
bool CDataPack::RemoveItem(size_t pos)
|
||||
{
|
||||
if (!elements.length())
|
||||
if (!elements.size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -280,7 +280,7 @@ bool CDataPack::RemoveItem(size_t pos)
|
||||
pos = position;
|
||||
}
|
||||
|
||||
if (pos >= elements.length())
|
||||
if (pos >= elements.size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -312,6 +312,6 @@ bool CDataPack::RemoveItem(size_t pos)
|
||||
}
|
||||
}
|
||||
|
||||
elements.remove(pos);
|
||||
ke::RemoveAt(&elements, pos);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ public: // Originally IDataPack
|
||||
|
||||
public:
|
||||
void Initialize();
|
||||
inline size_t GetCapacity() const { return this->elements.length(); };
|
||||
inline size_t GetCapacity() const { return this->elements.size(); };
|
||||
inline CDataPackType GetCurrentType(void) const { return this->elements[this->position].type; };
|
||||
bool RemoveItem(size_t pos = -1);
|
||||
|
||||
@@ -222,7 +222,7 @@ private:
|
||||
CDataPackType type;
|
||||
} InternalPack;
|
||||
|
||||
ke::Vector<InternalPack> elements;
|
||||
std::vector<InternalPack> elements;
|
||||
mutable size_t position;
|
||||
};
|
||||
|
||||
|
||||
@@ -210,7 +210,7 @@ void DBManager::RemoveDriver(IDBDriver *pDriver)
|
||||
}
|
||||
|
||||
ConfDbInfoList *list = m_Builder.GetConfigList();
|
||||
for (size_t i = 0; i < list->length(); i++)
|
||||
for (size_t i = 0; i < list->size(); i++)
|
||||
{
|
||||
ke::RefPtr<ConfDbInfo> current = list->at(i);
|
||||
if (current->realDriver == pDriver)
|
||||
|
||||
@@ -161,7 +161,7 @@ SMCResult DatabaseConfBuilder::ReadSMC_LeavingSection(const SMCStates *states)
|
||||
|
||||
/* Save it.. */
|
||||
m_ParseCurrent->AddRef();
|
||||
m_ParseList->append(m_ParseCurrent);
|
||||
m_ParseList->push_back(m_ParseCurrent);
|
||||
m_ParseCurrent = nullptr;
|
||||
|
||||
/* Go up one level */
|
||||
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
DatabaseInfo info;
|
||||
};
|
||||
|
||||
class ConfDbInfoList : public ke::Vector<ConfDbInfo *>
|
||||
class ConfDbInfoList : public std::vector<ConfDbInfo *>
|
||||
{
|
||||
/* Allow internal usage of ConfDbInfoList */
|
||||
friend class DBManager;
|
||||
@@ -67,7 +67,7 @@ private:
|
||||
}
|
||||
|
||||
ConfDbInfo *GetDatabaseConf(const char *name) {
|
||||
for (size_t i = 0; i < this->length(); i++)
|
||||
for (size_t i = 0; i < this->size(); i++)
|
||||
{
|
||||
ConfDbInfo *current = this->at(i);
|
||||
/* If we run into the default configuration, then we'll save it
|
||||
@@ -90,7 +90,7 @@ private:
|
||||
m_DefDriver = std::string(input);
|
||||
}
|
||||
void ReleaseMembers() {
|
||||
for (size_t i = 0; i < this->length(); i++) {
|
||||
for (size_t i = 0; i < this->size(); i++) {
|
||||
ConfDbInfo *current = this->at(i);
|
||||
current->Release();
|
||||
}
|
||||
|
||||
@@ -194,22 +194,22 @@ void DebugReport::ReportError(const IErrorReport &report, IFrameIterator &iter)
|
||||
g_Logger.LogError("[SM] Blaming: %s", blame);
|
||||
}
|
||||
|
||||
ke::Vector<std::string> arr = GetStackTrace(&iter);
|
||||
for (size_t i = 0; i < arr.length(); i++)
|
||||
std::vector<std::string> arr = GetStackTrace(&iter);
|
||||
for (size_t i = 0; i < arr.size(); i++)
|
||||
{
|
||||
g_Logger.LogError("%s", arr[i].c_str());
|
||||
}
|
||||
}
|
||||
|
||||
ke::Vector<std::string> DebugReport::GetStackTrace(IFrameIterator *iter)
|
||||
std::vector<std::string> DebugReport::GetStackTrace(IFrameIterator *iter)
|
||||
{
|
||||
char temp[3072];
|
||||
ke::Vector<std::string> trace;
|
||||
std::vector<std::string> trace;
|
||||
iter->Reset();
|
||||
|
||||
if (!iter->Done())
|
||||
{
|
||||
trace.append("[SM] Call stack trace:");
|
||||
trace.push_back("[SM] Call stack trace:");
|
||||
|
||||
for (int index = 0; !iter->Done(); iter->Next(), index++)
|
||||
{
|
||||
@@ -221,7 +221,7 @@ ke::Vector<std::string> DebugReport::GetStackTrace(IFrameIterator *iter)
|
||||
if (iter->IsNativeFrame())
|
||||
{
|
||||
g_pSM->Format(temp, sizeof(temp), "[SM] [%d] %s", index, fn);
|
||||
trace.append(temp);
|
||||
trace.push_back(temp);
|
||||
continue;
|
||||
}
|
||||
if (iter->IsScriptedFrame())
|
||||
@@ -237,7 +237,7 @@ ke::Vector<std::string> DebugReport::GetStackTrace(IFrameIterator *iter)
|
||||
file,
|
||||
fn);
|
||||
|
||||
trace.append(temp);
|
||||
trace.push_back(temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
void GenerateError(IPluginContext *ctx, cell_t func_idx, int err, const char *message, ...);
|
||||
void GenerateErrorVA(IPluginContext *ctx, cell_t func_idx, int err, const char *message, va_list ap);
|
||||
void GenerateCodeError(IPluginContext *ctx, uint32_t code_addr, int err, const char *message, ...);
|
||||
ke::Vector<std::string> GetStackTrace(IFrameIterator *iter);
|
||||
std::vector<std::string> GetStackTrace(IFrameIterator *iter);
|
||||
private:
|
||||
int _GetPluginIndex(IPluginContext *ctx);
|
||||
};
|
||||
|
||||
@@ -36,7 +36,7 @@ SafeFrameIterator::SafeFrameIterator(IFrameIterator *it)
|
||||
while (!it->Done())
|
||||
{
|
||||
FrameInfo info = FrameInfo(it);
|
||||
frames.append(info);
|
||||
frames.push_back(info);
|
||||
it->Next();
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ SafeFrameIterator::SafeFrameIterator(IFrameIterator *it)
|
||||
|
||||
bool SafeFrameIterator::Done() const
|
||||
{
|
||||
return current >= frames.length();
|
||||
return current >= frames.size();
|
||||
}
|
||||
|
||||
bool SafeFrameIterator::Next()
|
||||
|
||||
@@ -73,5 +73,5 @@ public:
|
||||
|
||||
private:
|
||||
size_t current;
|
||||
ke::Vector<FrameInfo> frames;
|
||||
std::vector<FrameInfo> frames;
|
||||
};
|
||||
|
||||
@@ -62,7 +62,7 @@ void CNativeOwner::AddNatives(const sp_nativeinfo_t *natives)
|
||||
for (const sp_nativeinfo_t *native = natives; native->func && native->name; native++)
|
||||
g_ShareSys.AddNativeToCache(this, native);
|
||||
|
||||
m_natives.append(natives);
|
||||
m_natives.push_back(natives);
|
||||
}
|
||||
|
||||
void CNativeOwner::UnbindWeakRef(const WeakNative &ref)
|
||||
@@ -90,14 +90,14 @@ void CNativeOwner::DropEverything()
|
||||
}
|
||||
|
||||
/* Strip all of our natives from the cache */
|
||||
for (size_t i = 0; i < m_natives.length(); i++) {
|
||||
for (size_t i = 0; i < m_natives.size(); i++) {
|
||||
const sp_nativeinfo_t *natives = m_natives[i];
|
||||
for (const sp_nativeinfo_t *native = natives; native->func && native->name; native++)
|
||||
g_ShareSys.ClearNativeFromCache(this, native->name);
|
||||
}
|
||||
m_natives.clear();
|
||||
|
||||
for (size_t i = 0; i < m_fakes.length(); i++)
|
||||
for (size_t i = 0; i < m_fakes.size(); i++)
|
||||
g_ShareSys.ClearNativeFromCache(this, m_fakes[i]->name());
|
||||
m_fakes.clear();
|
||||
}
|
||||
|
||||
@@ -80,8 +80,8 @@ protected:
|
||||
List<CPlugin *> m_Dependents;
|
||||
unsigned int m_nMarkSerial;
|
||||
List<WeakNative> m_WeakRefs;
|
||||
ke::Vector<const sp_nativeinfo_t *> m_natives;
|
||||
ke::Vector<ke::RefPtr<Native> > m_fakes;
|
||||
std::vector<const sp_nativeinfo_t *> m_natives;
|
||||
std::vector<ke::RefPtr<Native> > m_fakes;
|
||||
};
|
||||
|
||||
extern CNativeOwner g_CoreNatives;
|
||||
|
||||
@@ -674,7 +674,7 @@ void CPlugin::DependencyDropped(CPlugin *pOwner)
|
||||
}
|
||||
|
||||
unsigned int unbound = 0;
|
||||
for (size_t i = 0; i < pOwner->m_fakes.length(); i++)
|
||||
for (size_t i = 0; i < pOwner->m_fakes.size(); i++)
|
||||
{
|
||||
ke::RefPtr<Native> entry(pOwner->m_fakes[i]);
|
||||
|
||||
@@ -773,13 +773,13 @@ bool CPlugin::AddFakeNative(IPluginFunction *pFunc, const char *name, SPVM_FAKEN
|
||||
if (!entry)
|
||||
return false;
|
||||
|
||||
m_fakes.append(entry);
|
||||
m_fakes.push_back(entry);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CPlugin::BindFakeNativesTo(CPlugin *other)
|
||||
{
|
||||
for (size_t i = 0; i < m_fakes.length(); i++)
|
||||
for (size_t i = 0; i < m_fakes.size(); i++)
|
||||
g_ShareSys.BindNativeToPlugin(other, m_fakes[i]);
|
||||
}
|
||||
|
||||
|
||||
@@ -227,7 +227,7 @@ public:
|
||||
return m_LibraryMissing;
|
||||
}
|
||||
bool HasFakeNatives() const {
|
||||
return m_fakes.length() > 0;
|
||||
return m_fakes.size() > 0;
|
||||
}
|
||||
|
||||
// True if we got far enough into the second pass to call OnPluginLoaded
|
||||
|
||||
@@ -52,7 +52,7 @@ ProfileToolManager::OnSourceModShutdown()
|
||||
IProfilingTool *
|
||||
ProfileToolManager::FindToolByName(const char *name)
|
||||
{
|
||||
for (size_t i = 0; i < tools_.length(); i++) {
|
||||
for (size_t i = 0; i < tools_.size(); i++) {
|
||||
if (strcmp(tools_[i]->Name(), name) == 0)
|
||||
return tools_[i];
|
||||
}
|
||||
@@ -97,7 +97,7 @@ ProfileToolManager::StartFromConsole(IProfilingTool *tool)
|
||||
void
|
||||
ProfileToolManager::OnRootConsoleCommand(const char *cmdname, const ICommandArgs *args)
|
||||
{
|
||||
if (tools_.length() == 0) {
|
||||
if (tools_.size() == 0) {
|
||||
rootmenu->ConsolePrint("No profiling tools are enabled.");
|
||||
return;
|
||||
}
|
||||
@@ -107,7 +107,7 @@ ProfileToolManager::OnRootConsoleCommand(const char *cmdname, const ICommandArgs
|
||||
|
||||
if (strcmp(cmdname, "list") == 0) {
|
||||
rootmenu->ConsolePrint("Profiling tools:");
|
||||
for (size_t i = 0; i < tools_.length(); i++) {
|
||||
for (size_t i = 0; i < tools_.size(); i++) {
|
||||
rootmenu->DrawGenericOption(tools_[i]->Name(), tools_[i]->Description());
|
||||
}
|
||||
return;
|
||||
@@ -135,7 +135,7 @@ ProfileToolManager::OnRootConsoleCommand(const char *cmdname, const ICommandArgs
|
||||
if (strcmp(cmdname, "start") == 0) {
|
||||
if (!default_) {
|
||||
default_ = FindToolByName("vprof");
|
||||
if (!default_ && tools_.length() > 0)
|
||||
if (!default_ && tools_.size() > 0)
|
||||
default_ = tools_[0];
|
||||
if (!default_) {
|
||||
rootmenu->ConsolePrint("Could not find any profiler to use.");
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
void OnRootConsoleCommand(const char *cmdname, const ICommandArgs *args) override;
|
||||
|
||||
void RegisterTool(IProfilingTool *tool) {
|
||||
tools_.append(tool);
|
||||
tools_.push_back(tool);
|
||||
}
|
||||
|
||||
bool IsActive() const {
|
||||
@@ -76,7 +76,7 @@ private:
|
||||
void StartFromConsole(IProfilingTool *tool);
|
||||
|
||||
private:
|
||||
ke::Vector<IProfilingTool *> tools_;
|
||||
std::vector<IProfilingTool *> tools_;
|
||||
IProfilingTool *active_;
|
||||
IProfilingTool *default_;
|
||||
bool enabled_;
|
||||
|
||||
@@ -30,13 +30,13 @@
|
||||
|
||||
using namespace SourceMod;
|
||||
|
||||
ke::Vector<ke::Function<void()>> sNextTasks;
|
||||
ke::Vector<ke::Function<void()>> sWorkTasks;
|
||||
std::vector<ke::Function<void()>> sNextTasks;
|
||||
std::vector<ke::Function<void()>> sWorkTasks;
|
||||
|
||||
void
|
||||
SourceMod::ScheduleTaskForNextFrame(ke::Function<void()>&& task)
|
||||
{
|
||||
sNextTasks.append(std::forward<decltype(task)>(task));
|
||||
sNextTasks.push_back(std::forward<decltype(task)>(task));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -46,11 +46,11 @@ SourceMod::RunScheduledFrameTasks(bool simulating)
|
||||
return;
|
||||
|
||||
// Swap.
|
||||
ke::Vector<ke::Function<void()>> temp(std::move(sNextTasks));
|
||||
std::vector<ke::Function<void()>> temp(std::move(sNextTasks));
|
||||
sNextTasks = std::move(sWorkTasks);
|
||||
sWorkTasks = std::move(temp);
|
||||
|
||||
for (size_t i = 0; i < sWorkTasks.length(); i++)
|
||||
for (size_t i = 0; i < sWorkTasks.size(); i++)
|
||||
sWorkTasks[i]();
|
||||
sWorkTasks.clear();
|
||||
}
|
||||
|
||||
+937
-937
File diff suppressed because it is too large
Load Diff
+21
-21
@@ -68,7 +68,7 @@ struct Transaction
|
||||
cell_t data;
|
||||
};
|
||||
|
||||
ke::Vector<Entry> entries;
|
||||
std::vector<Entry> entries;
|
||||
};
|
||||
|
||||
class DatabaseHelpers :
|
||||
@@ -1540,9 +1540,9 @@ static cell_t SQL_AddQuery(IPluginContext *pContext, const cell_t *params)
|
||||
Transaction::Entry entry;
|
||||
entry.query = query;
|
||||
entry.data = params[3];
|
||||
txn->entries.append(std::move(entry));
|
||||
txn->entries.push_back(std::move(entry));
|
||||
|
||||
return cell_t(txn->entries.length() - 1);
|
||||
return cell_t(txn->entries.size() - 1);
|
||||
}
|
||||
|
||||
class TTransactOp : public IDBThreadOperation
|
||||
@@ -1564,7 +1564,7 @@ public:
|
||||
|
||||
~TTransactOp()
|
||||
{
|
||||
for (size_t i = 0; i < results_.length(); i++)
|
||||
for (size_t i = 0; i < results_.size(); i++)
|
||||
results_[i]->Destroy();
|
||||
results_.clear();
|
||||
}
|
||||
@@ -1585,7 +1585,7 @@ public:
|
||||
private:
|
||||
bool Succeeded() const
|
||||
{
|
||||
return error_.length() == 0;
|
||||
return error_.size() == 0;
|
||||
}
|
||||
|
||||
void SetDbError()
|
||||
@@ -1617,7 +1617,7 @@ private:
|
||||
return;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < txn_->entries.length(); i++)
|
||||
for (size_t i = 0; i < txn_->entries.size(); i++)
|
||||
{
|
||||
Transaction::Entry &entry = txn_->entries[i];
|
||||
IQuery *result = Exec(entry.query.c_str());
|
||||
@@ -1626,7 +1626,7 @@ private:
|
||||
failIndex_ = (cell_t)i;
|
||||
return;
|
||||
}
|
||||
results_.append(result);
|
||||
results_.push_back(result);
|
||||
}
|
||||
|
||||
if (!db_->DoSimpleQuery("COMMIT"))
|
||||
@@ -1667,11 +1667,11 @@ private:
|
||||
// Add an extra refcount for the handle.
|
||||
db_->AddRef();
|
||||
|
||||
assert(results_.length() == txn_->entries.length());
|
||||
assert(results_.size() == txn_->entries.size());
|
||||
|
||||
std::unique_ptr<cell_t[]> data = std::make_unique<cell_t[]>(results_.length());
|
||||
std::unique_ptr<cell_t[]> handles = std::make_unique<cell_t[]>(results_.length());
|
||||
for (size_t i = 0; i < results_.length(); i++)
|
||||
std::unique_ptr<cell_t[]> data = std::make_unique<cell_t[]>(results_.size());
|
||||
std::unique_ptr<cell_t[]> handles = std::make_unique<cell_t[]>(results_.size());
|
||||
for (size_t i = 0; i < results_.size(); i++)
|
||||
{
|
||||
CombinedQuery *obj = new CombinedQuery(results_[i], db_);
|
||||
Handle_t rh = CreateLocalHandle(hCombinedQueryType, obj, &sec);
|
||||
@@ -1682,7 +1682,7 @@ private:
|
||||
delete obj;
|
||||
for (size_t iter = 0; iter < i; iter++)
|
||||
handlesys->FreeHandle(handles[iter], &sec);
|
||||
for (size_t iter = i; iter < results_.length(); iter++)
|
||||
for (size_t iter = i; iter < results_.size(); iter++)
|
||||
results_[iter]->Destroy();
|
||||
handlesys->FreeHandle(dbh, &sec);
|
||||
results_.clear();
|
||||
@@ -1698,15 +1698,15 @@ private:
|
||||
{
|
||||
success_->PushCell(dbh);
|
||||
success_->PushCell(data_);
|
||||
success_->PushCell(txn_->entries.length());
|
||||
success_->PushArray(handles.get(), results_.length());
|
||||
success_->PushArray(data.get(), results_.length());
|
||||
success_->PushCell(txn_->entries.size());
|
||||
success_->PushArray(handles.get(), results_.size());
|
||||
success_->PushArray(data.get(), results_.size());
|
||||
success_->Execute(NULL);
|
||||
}
|
||||
|
||||
// Cleanup. Note we clear results_, since freeing their handles will
|
||||
// call Destroy(), and we don't want to double-free in ~TTransactOp.
|
||||
for (size_t i = 0; i < results_.length(); i++)
|
||||
for (size_t i = 0; i < results_.size(); i++)
|
||||
handlesys->FreeHandle(handles[i], &sec);
|
||||
handlesys->FreeHandle(dbh, &sec);
|
||||
results_.clear();
|
||||
@@ -1730,8 +1730,8 @@ public:
|
||||
{
|
||||
HandleSecurity sec(ident_, g_pCoreIdent);
|
||||
|
||||
std::unique_ptr<cell_t[]> data = std::make_unique<cell_t[]>(txn_->entries.length());
|
||||
for (size_t i = 0; i < txn_->entries.length(); i++)
|
||||
std::unique_ptr<cell_t[]> data = std::make_unique<cell_t[]>(txn_->entries.size());
|
||||
for (size_t i = 0; i < txn_->entries.size(); i++)
|
||||
data[i] = txn_->entries[i].data;
|
||||
|
||||
Handle_t dbh = CreateLocalHandle(g_DBMan.GetDatabaseType(), db_, &sec);
|
||||
@@ -1745,10 +1745,10 @@ public:
|
||||
{
|
||||
failure_->PushCell(dbh);
|
||||
failure_->PushCell(data_);
|
||||
failure_->PushCell(txn_->entries.length());
|
||||
failure_->PushCell(txn_->entries.size());
|
||||
failure_->PushString(error_.c_str());
|
||||
failure_->PushCell(failIndex_);
|
||||
failure_->PushArray(data.get(), txn_->entries.length());
|
||||
failure_->PushArray(data.get(), txn_->entries.size());
|
||||
failure_->Execute(NULL);
|
||||
}
|
||||
|
||||
@@ -1765,7 +1765,7 @@ private:
|
||||
cell_t data_;
|
||||
AutoHandleRooter autoHandle_;
|
||||
std::string error_;
|
||||
ke::Vector<IQuery *> results_;
|
||||
std::vector<IQuery *> results_;
|
||||
cell_t failIndex_;
|
||||
};
|
||||
|
||||
|
||||
@@ -768,7 +768,7 @@ CoreProviderImpl::DefineCommand(const char *name, const char *help, const Comman
|
||||
ke::RefPtr<CommandHook> hook = AddCommandHook(cmd, callback);
|
||||
|
||||
ke::RefPtr<CommandImpl> impl = new CommandImpl(cmd, hook);
|
||||
commands_.append(impl);
|
||||
commands_.push_back(impl);
|
||||
}
|
||||
|
||||
void CoreProviderImpl::InitializeHooks()
|
||||
|
||||
+1
-1
@@ -91,7 +91,7 @@ private:
|
||||
ConCommand *cmd_;
|
||||
ke::RefPtr<CommandHook> hook_;
|
||||
};
|
||||
ke::Vector<ke::RefPtr<CommandImpl>> commands_;
|
||||
std::vector<ke::RefPtr<CommandImpl>> commands_;
|
||||
};
|
||||
|
||||
extern CoreProviderImpl sCoreProviderImpl;
|
||||
|
||||
Reference in New Issue
Block a user