X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/5ff8211bdcd5f110621c0ff01fa0854b5e6d9762..afcbfd1a09e22ff4839ba5db42047c96f355506c:/projects/stargazer/corps_impl.cpp diff --git a/projects/stargazer/corps_impl.cpp b/projects/stargazer/corps_impl.cpp index f926d23a..098acaca 100644 --- a/projects/stargazer/corps_impl.cpp +++ b/projects/stargazer/corps_impl.cpp @@ -18,13 +18,14 @@ * Author : Maxim Mamontov */ -#include -#include -#include +#include "corps_impl.h" #include "stg/admin.h" #include "stg/common.h" -#include "corps_impl.h" + +#include +#include +#include //----------------------------------------------------------------------------- CORPORATIONS_IMPL::CORPORATIONS_IMPL(STORE * st) @@ -43,12 +44,12 @@ Read(); //----------------------------------------------------------------------------- int CORPORATIONS_IMPL::Add(const CORP_CONF & corp, const ADMIN * admin) { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); const PRIV * priv = admin->GetPriv(); if (!priv->corpChg) { - string s = admin->GetLogStr() + " Add corporation \'" + corp.name + "\'. Access denied."; + std::string s = admin->GetLogStr() + " Add corporation \'" + corp.name + "\'. Access denied."; strError = "Access denied."; WriteServLog(s.c_str()); return -1; @@ -79,14 +80,14 @@ WriteServLog("%s %s", admin->GetLogStr().c_str(), strError.c_str()); return -1; } //----------------------------------------------------------------------------- -int CORPORATIONS_IMPL::Del(const string & name, const ADMIN * admin) +int CORPORATIONS_IMPL::Del(const std::string & name, const ADMIN * admin) { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); const PRIV * priv = admin->GetPriv(); if (!priv->corpChg) { - string s = admin->GetLogStr() + " Delete corporation \'" + name + "\'. Access denied."; + std::string s = admin->GetLogStr() + " Delete corporation \'" + name + "\'. Access denied."; strError = "Access denied."; WriteServLog(s.c_str()); return -1; @@ -101,13 +102,13 @@ if (si == data.end()) return -1; } -map::iterator csi; +std::map::iterator csi; csi = searchDescriptors.begin(); while (csi != searchDescriptors.end()) { if (csi->second == si) (csi->second)++; - csi++; + ++csi; } data.remove(*si); @@ -125,12 +126,12 @@ return 0; //----------------------------------------------------------------------------- int CORPORATIONS_IMPL::Change(const CORP_CONF & corp, const ADMIN * admin) { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); const PRIV * priv = admin->GetPriv(); if (!priv->corpChg) { - string s = admin->GetLogStr() + " Change corporation \'" + corp.name + "\'. Access denied."; + std::string s = admin->GetLogStr() + " Change corporation \'" + corp.name + "\'. Access denied."; strError = "Access denied."; WriteServLog(s.c_str()); return -1; @@ -161,8 +162,8 @@ return 0; //----------------------------------------------------------------------------- bool CORPORATIONS_IMPL::Read() { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); -vector corpsList; +STG_LOCKER lock(&mutex); +std::vector corpsList; if (store->GetCorpsList(&corpsList) < 0) { WriteServLog(store->GetStrError().c_str()); @@ -184,11 +185,11 @@ for (size_t i = 0; i < corpsList.size(); i++) return false; } //----------------------------------------------------------------------------- -bool CORPORATIONS_IMPL::Find(const string & name, CORP_CONF * corp) +bool CORPORATIONS_IMPL::Find(const std::string & name, CORP_CONF * corp) { assert(corp != NULL && "Pointer to corporation is not null"); -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); if (data.empty()) return false; @@ -203,9 +204,9 @@ if (si != data.end()) return true; } //----------------------------------------------------------------------------- -bool CORPORATIONS_IMPL::Exists(const string & name) const +bool CORPORATIONS_IMPL::Exists(const std::string & name) const { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); if (data.empty()) { printfd(__FILE__, "no admin in system!\n"); @@ -222,7 +223,7 @@ return false; //----------------------------------------------------------------------------- int CORPORATIONS_IMPL::OpenSearch() const { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); handle++; searchDescriptors[handle] = data.begin(); return handle; @@ -230,7 +231,7 @@ return handle; //----------------------------------------------------------------------------- int CORPORATIONS_IMPL::SearchNext(int h, CORP_CONF * corp) const { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); if (searchDescriptors.find(h) == searchDescriptors.end()) { WriteServLog("CORPORATIONS. Incorrect search handle."); @@ -247,7 +248,7 @@ return 0; //----------------------------------------------------------------------------- int CORPORATIONS_IMPL::CloseSearch(int h) const { -STG_LOCKER lock(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex); if (searchDescriptors.find(h) != searchDescriptors.end()) { searchDescriptors.erase(searchDescriptors.find(h));