2010-08-08 10:06:34 +02:00
|
|
|
/*
|
2015-01-30 22:10:29 +01:00
|
|
|
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
|
2014-08-27 21:09:39 +02:00
|
|
|
Katja Zedel <katze@felidae.kn-bremen.de
|
|
|
|
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
2010-08-08 10:06:34 +02:00
|
|
|
|
|
|
|
Permission to use, copy, modify, and/or 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.
|
|
|
|
**/
|
|
|
|
|
2017-01-10 16:31:05 +01:00
|
|
|
#include "direction.h"
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
2010-08-08 10:06:34 +02:00
|
|
|
#ifndef H_KRNL_MOVEMENT
|
|
|
|
#define H_KRNL_MOVEMENT
|
2014-08-27 21:09:39 +02:00
|
|
|
|
2010-08-08 10:06:34 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2018-04-22 12:00:58 +02:00
|
|
|
struct attrib_type;
|
|
|
|
struct building_type;
|
|
|
|
struct locale;
|
|
|
|
struct order;
|
2014-11-01 13:10:22 +01:00
|
|
|
struct region;
|
|
|
|
struct region_list;
|
2014-08-27 21:09:39 +02:00
|
|
|
struct ship;
|
2018-04-22 12:00:58 +02:00
|
|
|
struct unit;
|
2010-08-08 10:06:34 +02:00
|
|
|
|
2014-12-09 23:27:05 +01:00
|
|
|
extern struct attrib_type at_shiptrail;
|
2017-05-07 17:46:51 +02:00
|
|
|
extern int *storms;
|
2014-08-27 21:09:39 +02:00
|
|
|
|
2017-10-06 22:15:48 +02:00
|
|
|
/* Bewegungsweiten: */
|
|
|
|
#define BP_WALKING 4
|
|
|
|
#define BP_RIDING 6
|
|
|
|
#define BP_UNICORN 9
|
|
|
|
#define BP_DRAGON 4
|
|
|
|
#define BP_NORMAL 3
|
|
|
|
#define BP_ROAD 2
|
|
|
|
|
2018-12-17 12:07:38 +01:00
|
|
|
/* die Zahlen sind genau aequivalent zu den race Flags */
|
2010-08-08 10:06:34 +02:00
|
|
|
#define MV_CANNOTMOVE (1<<5)
|
2011-03-07 08:02:35 +01:00
|
|
|
#define MV_FLY (1<<7) /* kann fliegen */
|
|
|
|
#define MV_SWIM (1<<8) /* kann schwimmen */
|
2018-12-17 12:07:38 +01:00
|
|
|
#define MV_WALK (1<<9) /* kann ueber Land gehen */
|
2010-08-08 10:06:34 +02:00
|
|
|
|
2017-12-29 06:13:28 +01:00
|
|
|
#define HORSES_PER_CART 2 /* number of horses for a cart */
|
2015-04-14 02:32:01 +02:00
|
|
|
#define STRENGTHMULTIPLIER 50 /* multiplier for trollbelt */
|
2010-08-08 10:06:34 +02:00
|
|
|
|
2014-08-27 21:09:39 +02:00
|
|
|
/* ein mensch wiegt 10, traegt also 5, ein pferd wiegt 50, traegt also 20. ein
|
|
|
|
** wagen wird von zwei pferden gezogen und traegt total 140, davon 40 die
|
|
|
|
** pferde, macht nur noch 100, aber samt eigenem gewicht (40) macht also 140. */
|
|
|
|
|
|
|
|
/* movewhere error codes */
|
|
|
|
enum {
|
|
|
|
E_MOVE_OK = 0, /* possible to move */
|
|
|
|
E_MOVE_NOREGION, /* no region exists in this direction */
|
|
|
|
E_MOVE_BLOCKED /* cannot see this region, there is a blocking connection. */
|
|
|
|
};
|
|
|
|
int movewhere(const struct unit *u, const char *token,
|
2015-01-30 20:37:14 +01:00
|
|
|
struct region *r, struct region **resultp);
|
2014-08-27 21:09:39 +02:00
|
|
|
direction_t reldirection(const struct region *from, const struct region *to);
|
2010-08-08 10:06:34 +02:00
|
|
|
|
2014-08-27 21:09:39 +02:00
|
|
|
int personcapacity(const struct unit *u);
|
|
|
|
void movement(void);
|
|
|
|
void run_to(struct unit *u, struct region *to);
|
2015-08-07 09:03:19 +02:00
|
|
|
int enoughsailors(const struct ship *sh, int sumskill);
|
2014-08-27 21:09:39 +02:00
|
|
|
bool canswim(struct unit *u);
|
|
|
|
bool canfly(struct unit *u);
|
2016-12-16 07:29:43 +01:00
|
|
|
void leave_trail(struct ship *sh, struct region *from,
|
|
|
|
struct region_list *route);
|
2018-09-16 10:02:09 +02:00
|
|
|
void move_ship(struct ship *sh, struct region *from,
|
2015-01-30 20:37:14 +01:00
|
|
|
struct region *to, struct region_list *route);
|
2014-08-27 21:09:39 +02:00
|
|
|
int walkingcapacity(const struct unit *u);
|
2017-10-06 22:15:48 +02:00
|
|
|
int movement_speed(const struct unit * u);
|
2014-08-27 21:09:39 +02:00
|
|
|
void follow_unit(struct unit *u);
|
|
|
|
struct unit *owner_buildingtyp(const struct region *r,
|
|
|
|
const struct building_type *bt);
|
2014-08-31 08:58:55 +02:00
|
|
|
bool move_blocked(const struct unit *u, const struct region *src,
|
|
|
|
const struct region *dest);
|
2015-10-11 21:19:38 +02:00
|
|
|
bool can_takeoff(const struct ship * sh, const struct region * from, const struct region * to);
|
2016-08-20 19:25:44 +02:00
|
|
|
void move_cmd(struct unit * u, struct order * ord);
|
2015-11-14 16:47:14 +01:00
|
|
|
int follow_ship(struct unit * u, struct order * ord);
|
2010-08-08 10:06:34 +02:00
|
|
|
|
2016-06-10 18:00:22 +02:00
|
|
|
#define SA_HARBOUR 1
|
|
|
|
#define SA_COAST 0
|
2017-12-17 14:50:11 +01:00
|
|
|
#define SA_NO_INSECT -1
|
|
|
|
#define SA_NO_COAST -2
|
2010-08-08 10:06:34 +02:00
|
|
|
|
2014-08-27 21:09:39 +02:00
|
|
|
int check_ship_allowed(struct ship *sh, const struct region * r);
|
2017-10-21 10:44:07 +02:00
|
|
|
direction_t drift_target(struct ship *sh);
|
2018-04-22 12:00:58 +02:00
|
|
|
struct order * cycle_route(struct order * ord, const struct locale *lang, int gereist);
|
2018-04-22 19:04:09 +02:00
|
|
|
struct order * make_movement_order(const struct locale *lang, direction_t steps[], int length);
|
2010-08-08 10:06:34 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|