/* $Id: steps.h,v 1.5 2016/06/17 17:27:20 kili Exp $ */ /* * Copyright (c) 2016 Matthias Kilian * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef TRISOLD_STEPS_H #define TRISOLD_STEPS_H /* Calculates all fields touched while walking from (x0, y0) * to (x0 + dx, y0 + dy), excluding the starting field (x0, y0). * For each field, the function *f() is invoked with the data pointer p * and with the current coordinates. * If *f() return a non-zero value v, the process is aborted and v is * returned. Otherwise, 0 will be returned. */ int walk_steps(int (*f) (void *d, int x, int y), void *d, int x0, int y0, int dx, int dy); #endif