Skip to content
This repository has been archived by the owner on Oct 18, 2023. It is now read-only.

Commit

Permalink
Some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
K4ryuu committed May 31, 2022
1 parent dc62641 commit a6a3728
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/karyuu/client.inc
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#define MAX_AUTH_LENGTH 21
#define MAX_IP_LENGTH 23

#define KARYUU_LOOP_CLIENTS(%1) for (int %1 = 0; %1 <= MAXPLAYERS + 1; %1++) if (Karyuu_IsValidClient(%1))
#define KARYUU_LOOP_PLAYERS(%1) for (int %1 = 0; %1 <= MAXPLAYERS + 1; %1++) if (Karyuu_IsValidPlayer(%1))
#define KARYUU_LOOP_CLIENTS(%1) for (int %1 = 1; %1 <= MAXPLAYERS + 1; %1++) if (IsClientInGame(%1))
#define KARYUU_LOOP_PLAYERS(%1) for (int %1 = 1; %1 <= MAXPLAYERS + 1; %1++) if (IsClientInGame(%1) && !IsFakeClient(%1))

enum WaterLevel
{
Expand Down
2 changes: 1 addition & 1 deletion src/karyuu/game/game.inc
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ stock bool Karyuu_IsWarmUpPeriod()

stock float Karyuu_WarmupTimeLeft()
{
return GameRules_GetProp("m_fWarmupPeriodEnd");
return GameRules_GetPropFloat("m_fWarmupPeriodEnd");
}

stock bool Karyuu_IsOvertime()
Expand Down
11 changes: 3 additions & 8 deletions src/karyuu/variable/random.inc
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,10 @@ stock bool Karyuu_RandomBool()

stock int Karyuu_RandomInt(int iMin, int iMax)
{
int iRandom = GetURandomInt();

if (iRandom == 0)
iRandom++;

return RoundToCeil(float(iRandom) / (float(MAX_INTEGER_VALUE) / float(iMax - iMin + 1))) + iMin - 1;
return RoundToZero(Karyuu_RandomFloat(float(iMin), float(iMax)));
}

stock float Karyuu_RandomFloat(float min, float max)
stock float Karyuu_RandomFloat(float iMin, float iMax)
{
return (GetURandomFloat() * (max - min)) + min;
return GetURandomFloat() * (iMax - iMin + 1) + iMin;
}

0 comments on commit a6a3728

Please sign in to comment.