plugins/include/datapack.inc
author David Anderson <dvander@alliedmods.net>
Wed Jul 25 20:23:34 2007 +0000 (2007-07-25)
changeset 1169 47a8892d2c81
parent 1015 6b27b8e57f47
child 1330 ab94316bb52b
permissions -rw-r--r--
added amb416 - SlapPlayer()
dvander@428
     1
/**
ds@475
     2
 * vim: set ts=4 :
dvander@428
     3
 * ===============================================================
dvander@428
     4
 * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
dvander@428
     5
 * ===============================================================
dvander@428
     6
 *
dvander@428
     7
 *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be used 
dvander@428
     8
 * or modified under the Terms and Conditions of its License Agreement, which is found 
dvander@428
     9
 * in LICENSE.txt.  The Terms and Conditions for making SourceMod extensions/plugins 
dvander@428
    10
 * may change at any time.  To view the latest information, see:
dvander@428
    11
 *   http://www.sourcemod.net/license.php
dvander@428
    12
 *
dvander@428
    13
 * Version: $Id$
dvander@428
    14
 */
dvander@428
    15
dvander@428
    16
#if defined _datapack_included
dvander@428
    17
 #endinput
dvander@428
    18
#endif
dvander@428
    19
#define _datapack_included
dvander@428
    20
dvander@428
    21
/**
dvander@428
    22
 * Creates a new data pack.
dvander@428
    23
 *
ds@475
    24
 * @return			A Handle to the data pack.  Must be closed with CloseHandle().
dvander@428
    25
 */
dvander@428
    26
native Handle:CreateDataPack();
dvander@428
    27
dvander@428
    28
/**
dvander@428
    29
 * Packs a normal cell into a data pack.
dvander@428
    30
 *
dvander@428
    31
 * @param pack		Handle to the data pack.
dvander@428
    32
 * @param cell		Cell to add.
dvander@428
    33
 * @noreturn
dvander@428
    34
 * @error			Invalid handle.
dvander@428
    35
 */
dvander@428
    36
native WritePackCell(Handle:pack, cell);
dvander@428
    37
dvander@428
    38
/**
faluco@461
    39
 * Packs a float into a data pack.
faluco@461
    40
 *
faluco@461
    41
 * @param pack		Handle to the data pack.
faluco@461
    42
 * @param val		Float to add.
faluco@461
    43
 * @noreturn
faluco@461
    44
 * @error			Invalid handle.
faluco@461
    45
 */
faluco@461
    46
native WritePackFloat(Handle:pack, Float:val);
faluco@461
    47
faluco@461
    48
/**
faluco@461
    49
 * Packs a string into a data pack.
faluco@461
    50
 *
faluco@461
    51
 * @param pack		Handle to the data pack.
faluco@461
    52
 * @param str		String to add.
faluco@461
    53
 * @noreturn
faluco@461
    54
 * @error			Invalid handle.
faluco@461
    55
 */
dvander@1015
    56
native WritePackString(Handle:pack, const String:str[]);
faluco@461
    57
faluco@461
    58
/**
dvander@428
    59
 * Reads a cell from a data pack.
dvander@428
    60
 *
dvander@428
    61
 * @param pack		Handle to the data pack.
dvander@428
    62
 * @return			Cell value.
dvander@428
    63
 * @error			Invalid handle, or bounds error.
dvander@428
    64
 */
dvander@428
    65
native ReadPackCell(Handle:pack);
dvander@428
    66
dvander@428
    67
/**
faluco@461
    68
 * Reads a float from a data pack.
faluco@461
    69
 *
faluco@461
    70
 * @param pack		Handle to the data pack.
faluco@461
    71
 * @return			Float value.
faluco@461
    72
 * @error			Invalid handle, or bounds error.
faluco@461
    73
 */
faluco@461
    74
native Float:ReadPackFloat(Handle:pack);
faluco@461
    75
faluco@461
    76
/**
faluco@461
    77
 * Reads a string from a data pack.
faluco@461
    78
 *
faluco@461
    79
 * @param pack		Handle to the data pack.
faluco@461
    80
 * @param buffer	Destination string buffer.
faluco@461
    81
 * @param maxlen	Maximum length of output string buffer.
faluco@461
    82
 * @noreturn
faluco@461
    83
 * @error			Invalid handle, or bounds error.
faluco@461
    84
 */
faluco@461
    85
native ReadPackString(Handle:pack, String:buffer[], maxlen);
faluco@461
    86
faluco@461
    87
/**
dvander@428
    88
 * Resets the position in a data pack.
dvander@428
    89
 *
dvander@428
    90
 * @param pack		Handle to the data pack.
dvander@428
    91
 * @param clear		If true, clears the contained data.
dvander@428
    92
 * @noreturn
ds@475
    93
 * @error			Invalid handle.
dvander@428
    94
 */
dvander@428
    95
native ResetPack(Handle:pack, bool:clear=false);
dvander@428
    96
dvander@428
    97
/**
dvander@428
    98
 * Returns the read or write position in a data pack.
dvander@428
    99
 *
dvander@428
   100
 * @param pack		Handle to the data pack.
dvander@428
   101
 * @return			Numerical position in the data pack.
ds@475
   102
 * @error			Invalid handle.
dvander@428
   103
 */
dvander@428
   104
native GetPackPosition(Handle:pack);
dvander@428
   105
dvander@428
   106
/**
dvander@428
   107
 * Sets the read/write position in a data pack.
dvander@428
   108
 *
dvander@428
   109
 * @param pack		Handle to the data pack.
dvander@428
   110
 * @param position	New position to set.
dvander@428
   111
 * @noreturn
faluco@461
   112
 * @error			Invalid handle, or position is beyond the pack bounds.
dvander@428
   113
 */
faluco@461
   114
native SetPackPosition(Handle:pack, position);
faluco@461
   115
faluco@461
   116
/**
faluco@461
   117
 * Returns whether or not a specified number of bytes from the data pack
faluco@461
   118
 *  position to the end can be read.
faluco@461
   119
 *
faluco@461
   120
 * @param pack		Handle to the data pack.
faluco@461
   121
 * @param bytes		Number of bytes to simulate reading.
ds@475
   122
 * @return			True if can be read, false otherwise.
ds@475
   123
 * @error			Invalid handle.
faluco@461
   124
 */
faluco@461
   125
native bool:IsPackReadable(Handle:pack, bytes);