Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Abc Dr committed Jan 8, 2024
2 parents 7678115 + e276308 commit 59c506b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
17 changes: 11 additions & 6 deletions src/source/CASSQLItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,31 +33,36 @@ void CASSQLItem::SetData(char* str){
}

void CASSQLItem::Get(CString* str){
str->assign(m_szData.c_str(), m_szData.size());
if (m_bIsNull)
str->assign("", 0);
else
str->assign(m_szData.c_str(), m_szData.size());
}

int64 CASSQLItem::GetInt64(){
return std::atoll(m_szData.c_str());
return m_bIsNull ? 0 : std::atoll(m_szData.c_str());
}

int32 CASSQLItem::GetInt(){
return std::atoi(m_szData.c_str());
return m_bIsNull ? 0 : std::atoi(m_szData.c_str());
}

uint64 CASSQLItem::GetUInt64(){
return strtoull(m_szData.c_str(), nullptr, 10);
return m_bIsNull ? 0 : std::strtoull(m_szData.c_str(), nullptr, 10);
}

uint32 CASSQLItem::GetUInt(){
//ILP32 so... yeah, thats fine
return strtoul(m_szData.c_str(), nullptr, 10);
return m_bIsNull ? 0 : std::strtoul(m_szData.c_str(), nullptr, 10);
}

double CASSQLItem::GetReal(){
return std::atof(m_szData.c_str());
return m_bIsNull ? 0.0 : std::atof(m_szData.c_str());
}

CBinaryStringBuilder* CASSQLItem::GetBlob(){
if (m_bIsNull)
return nullptr;
CASServerManager* manager = ASEXT_GetServerManager();
asIScriptEngine* engine = manager->scriptEngine;
CBinaryStringBuilder* pBlob = static_cast<CBinaryStringBuilder*>(engine->CreateScriptObject(m_pBlobInfo));
Expand Down
12 changes: 7 additions & 5 deletions src/source/dllapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,13 @@ void ClientUserInfoChanged(edict_t* pEntity, char* infobuffer) {

int Spawn_Post(edict_t* pent) {
if (pent != nullptr) {
CALL_ANGELSCRIPT(pEntitySpawn, pent->pvPrivateData);
if ((VARS(pent)->flags & FL_MONSTER) > 0) {
const char* szName = STRING((VARS(pent)->classname));
if (!strncmp(szName, "monster_", 8))
CALL_ANGELSCRIPT(pMonsterSpawn, pent->pvPrivateData);
if (pent->pvPrivateData != nullptr) {
CALL_ANGELSCRIPT(pEntitySpawn, pent->pvPrivateData);
if ((VARS(pent)->flags & FL_MONSTER) > 0) {
const char* szName = STRING((VARS(pent)->classname));
if (!strncmp(szName, "monster_", 8))
CALL_ANGELSCRIPT(pMonsterSpawn, pent->pvPrivateData);
}
}
}
SET_META_RESULT(MRES_HANDLED);
Expand Down

0 comments on commit 59c506b

Please sign in to comment.