[Script] Fix unsigned/signed mismatch

This commit is contained in:
FutureRave 2021-11-13 13:22:06 +00:00
parent 8cd3f2cad4
commit 446c55b0b0
No known key found for this signature in database
GPG Key ID: E883E2BC9657D955
5 changed files with 19 additions and 19 deletions

View File

@ -160,7 +160,7 @@ namespace Components
{
Script::AddFunction("SetPing", [](Game::scr_entref_t id) // gsc: self SetPing(<int>)
{
if (Game::Scr_GetNumParam() != 1 || Game::Scr_GetType(0) != Game::VAR_INTEGER)
if (Game::Scr_GetNumParam() != 1u || Game::Scr_GetType(0) != Game::VAR_INTEGER)
{
Game::Scr_Error("^1SetPing: Needs one integer parameter!\n");
return;
@ -250,7 +250,7 @@ namespace Components
Script::AddFunction("botWeapon", [](Game::scr_entref_t id) // Usage: <bot> botWeapon(<str>);
{
if (Game::Scr_GetNumParam() != 1 || Game::Scr_GetType(0) != Game::VAR_STRING)
if (Game::Scr_GetNumParam() != 1u || Game::Scr_GetType(0) != Game::VAR_STRING)
{
Game::Scr_Error("^1botWeapon: Needs one string parameter!\n");
return;
@ -293,7 +293,7 @@ namespace Components
Script::AddFunction("botAction", [](Game::scr_entref_t id) // Usage: <bot> botAction(<str action>);
{
if (Game::Scr_GetNumParam() != 1 || Game::Scr_GetType(0) != Game::VAR_STRING)
if (Game::Scr_GetNumParam() != 1u || Game::Scr_GetType(0) != Game::VAR_STRING)
{
Game::Scr_Error("^1botAction: Needs one string parameter!\n");
return;
@ -346,7 +346,7 @@ namespace Components
Script::AddFunction("botMovement", [](Game::scr_entref_t id) // Usage: <bot> botMovement(<int>, <int>);
{
if (Game::Scr_GetNumParam() != 2 || Game::Scr_GetType(0) != Game::VAR_INTEGER || Game::Scr_GetType(1) != Game::VAR_INTEGER)
if (Game::Scr_GetNumParam() != 2u || Game::Scr_GetType(0) != Game::VAR_INTEGER || Game::Scr_GetType(1) != Game::VAR_INTEGER)
{
Game::Scr_Error("^1botMovement: Needs two integer parameters!\n");
return;

View File

@ -967,7 +967,7 @@ namespace Components
Script::AddFunction("httpGet", [](Game::scr_entref_t)
{
if (!Dedicated::IsEnabled() && !Flags::HasFlag("scriptablehttp")) return;
if (Game::Scr_GetNumParam() < 1) return;
if (Game::Scr_GetNumParam() < 1u) return;
std::string url = Game::Scr_GetString(0);
unsigned int object = Game::AllocObject();
@ -981,7 +981,7 @@ namespace Components
Script::AddFunction("httpCancel", [](Game::scr_entref_t)
{
if (!Dedicated::IsEnabled() && !Flags::HasFlag("scriptablehttp")) return;
if (Game::Scr_GetNumParam() < 1) return;
if (Game::Scr_GetNumParam() < 1u) return;
unsigned int object = Game::Scr_GetObject(0);
for (auto& download : Download::ScriptDownloads)

View File

@ -384,9 +384,9 @@ namespace Components
Utils::Hook::Call<void(int)>(0x421EE0)(num);
}
int Script::SetExpFogStub()
unsigned int Script::SetExpFogStub()
{
if (Game::Scr_GetNumParam() == 6)
if (Game::Scr_GetNumParam() == 6u)
{
std::memmove(&Game::scriptContainer->stack[-4], &Game::scriptContainer->stack[-5], sizeof(Game::VariableValue) * 6);
Game::scriptContainer->stack += 1;
@ -408,7 +408,7 @@ namespace Components
{
if (Script::ReplacedFunctions.find(pos) != Script::ReplacedFunctions.end())
{
Script::ReplacedPos = Script::ReplacedFunctions[pos];;
Script::ReplacedPos = Script::ReplacedFunctions[pos];
}
}
@ -487,7 +487,7 @@ namespace Components
{
Script::AddFunction("ReplaceFunc", [](Game::scr_entref_t) // gsc: ReplaceFunc(<function>,<function>)
{
if (Game::Scr_GetNumParam() != 2)
if (Game::Scr_GetNumParam() != 2u)
{
Game::Scr_Error("^1ReplaceFunc: Needs two parameters!\n");
return;
@ -525,7 +525,7 @@ namespace Components
// Print to console, even without being in 'developer 1'.
Script::AddFunction("PrintConsole", [](Game::scr_entref_t) // gsc: PrintConsole(<string>)
{
if (Game::Scr_GetNumParam() != 1 || Game::Scr_GetType(0) != Game::VAR_STRING)
if (Game::Scr_GetNumParam() != 1u || Game::Scr_GetType(0) != Game::VAR_STRING)
{
Game::Scr_Error("^1PrintConsole: Needs one string parameter!\n");
return;
@ -539,7 +539,7 @@ namespace Components
// Executes command to the console
Script::AddFunction("Exec", [](Game::scr_entref_t) // gsc: Exec(<string>)
{
if (Game::Scr_GetNumParam() != 1 || Game::Scr_GetType(0) != Game::VAR_STRING)
if (Game::Scr_GetNumParam() != 1u || Game::Scr_GetType(0) != Game::VAR_STRING)
{
Game::Scr_Error("^1Exec: Needs one string parameter!\n");
return;
@ -554,7 +554,7 @@ namespace Components
// Script Storage Funcs
Script::AddFunction("StorageSet", [](Game::scr_entref_t) // gsc: StorageSet(<str key>, <str data>);
{
if (Game::Scr_GetNumParam() != 2 || Game::Scr_GetType(0) != Game::VAR_STRING || Game::Scr_GetType(1) != Game::VAR_STRING)
if (Game::Scr_GetNumParam() != 2u || Game::Scr_GetType(0) != Game::VAR_STRING || Game::Scr_GetType(1) != Game::VAR_STRING)
{
Game::Scr_Error("^1StorageSet: Needs two string parameters!\n");
return;
@ -568,7 +568,7 @@ namespace Components
Script::AddFunction("StorageRemove", [](Game::scr_entref_t) // gsc: StorageRemove(<str key>);
{
if (Game::Scr_GetNumParam() != 1 || Game::Scr_GetType(0) != Game::VAR_STRING)
if (Game::Scr_GetNumParam() != 1u || Game::Scr_GetType(0) != Game::VAR_STRING)
{
Game::Scr_Error("^1StorageRemove: Needs one string parameter!\n");
return;
@ -587,7 +587,7 @@ namespace Components
Script::AddFunction("StorageGet", [](Game::scr_entref_t) // gsc: StorageGet(<str key>);
{
if (Game::Scr_GetNumParam() != 1 || Game::Scr_GetType(0) != Game::VAR_STRING)
if (Game::Scr_GetNumParam() != 1u || Game::Scr_GetType(0) != Game::VAR_STRING)
{
Game::Scr_Error("^1StorageGet: Needs one string parameter!\n");
return;
@ -607,7 +607,7 @@ namespace Components
Script::AddFunction("StorageHas", [](Game::scr_entref_t) // gsc: StorageHas(<str key>);
{
if (Game::Scr_GetNumParam() != 1 || Game::Scr_GetType(0) != Game::VAR_STRING)
if (Game::Scr_GetNumParam() != 1u || Game::Scr_GetType(0) != Game::VAR_STRING)
{
Game::Scr_Error("^1StorageHas: Needs one string parameter!\n");
return;

View File

@ -70,7 +70,7 @@ namespace Components
static void Scr_PrintPrevCodePosStub();
static void Scr_PrintPrevCodePos(int);
static int SetExpFogStub();
static unsigned int SetExpFogStub();
static const char* GetCodePosForParam(int index);
static void GetReplacedPos(const char* pos);

View File

@ -38,12 +38,12 @@ namespace Components
float start = Game::Scr_GetFloat(0);
float end = 1.0f;
if (Game::Scr_GetNumParam() >= 2)
if (Game::Scr_GetNumParam() >= 2u)
{
end = Game::Scr_GetFloat(1);
}
if (Game::Scr_GetNumParam() >= 3)
if (Game::Scr_GetNumParam() >= 3u)
{
duration = static_cast<int>(Game::Scr_GetFloat(2) * 1000.0);
}