### 语法：

id Index of the mp_grid that is to be used
h Horizontal position of the cell in the grid
v Vertical position of the cell in the grid

### 描述

With this function we can mark individual cells within the mp_grid as being "forbidden" meaning that the path finding functions will not ever cross them. Now, normally you work in x/y room coordinates, and not in mp_grid cell coordinates. So let's consider the following image which shows how the two can correlate: As you can see the mp_grid is numbered as a series of cells (starting at 0,0 in the upper left corner), and when you place this grid over the room there is a direct correlation between the room coordinates (which also start at 0,0 in the top left) and the cells within the grid. In the image you can see that an instance at the position 260,130 falls on the grid cell 8,4. You can calculate mathematically the exact cell that a position lands on easily by either dividing the number by the grid resolution and then rounding down or (if you are using power of 2 grid resolutions like 8, 16, 32 etc...) you can use the bitwise operators. It should be noted that the bitwise operation is faster. The example below shows both methods.

### 例如：

with (obj_Wall)
{
mp_grid_add_cell(grid, floor(x / 32), floor(y / 32));
}
with (obj_Door)
{