- Joined
- Sep 9, 2007
- Messages
- 6,759
Some great functions I found into the native library.
JASS:
//--------------------------------------------------------------------------------------------------
// Conversions
//--------------------------------------------------------------------------------------------------
native int BoolToInt (bool f);
native int Color255FromFixed (fixed f);
native fixed IntToFixed (int x);
native string IntToString (int x);
native text IntToText (int x);
const int c_fixedPrecisionAny = -1;
native int FixedToInt (fixed x);
native string FixedToString (fixed x, int precision);
native text FixedToText (fixed x, int precision);
native int StringToInt (string x);
native fixed StringToFixed (string x);
//--------------------------------------------------------------------------------------------------
// Looping
//
// Convenience functions to allow for loops without creating any local variables.
// Notes:
// - The loop data is stored locally to the executing thread
// - Nested loops (of the same type) are not supported, and will produce a run-time error
//
//--------------------------------------------------------------------------------------------------
// Integer
// - Start and end are inclusive
//
native void IntLoopBegin (int start, int end);
native void IntLoopStep ();
native bool IntLoopDone ();
native int IntLoopCurrent ();
native void IntLoopEnd ();
// Player group
native void PlayerGroupLoopBegin (playergroup g);
native void PlayerGroupLoopStep ();
native bool PlayerGroupLoopDone ();
native int PlayerGroupLoopCurrent ();
native void PlayerGroupLoopEnd ();
// Unit group
native void UnitGroupLoopBegin (unitgroup g);
native void UnitGroupLoopStep ();
native bool UnitGroupLoopDone ();
native unit UnitGroupLoopCurrent ();
native void UnitGroupLoopEnd ();
// Unit inventory
const int c_unitInventoryCountCarried = 0;
const int c_unitInventoryCountEmpty = 1;
const int c_unitInventoryCountTotal = 2;
native int UnitInventoryCount (unit inUnit, int inCountType);
native unit UnitInventoryItem (unit inUnit, int inIndex);
native unitgroup UnitInventoryGroup (unit inUnit);
native unit UnitInventoryCreate (unit inUnit, string itemType);
native unit UnitInventoryLastCreated ();
// Unit weapons
native void UnitWeaponAdd (unit inUnit, string inWeapon, string inTurret);
native int UnitWeaponCount (unit inUnit);
native bool UnitWeaponCheck (unit inUnit, int inIndex, int inTarget);
native string UnitWeaponGet (unit inUnit, int inIndex);
native bool UnitWeaponIsEnabled (unit inUnit, int inIndex);
native fixed UnitWeaponPeriod (unit inUnit, int inIndex);
native void UnitWeaponRemove (unit inUnit, string inWeapon);
native bool UnitWeaponsPlaneTest (unit inUnit, int inPlane);