/
creature.h
91 lines (72 loc) · 3.08 KB
/
creature.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
Copyright (c) 2006 Florian Wesch <fw@dividuum.de>. All Rights Reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifndef CREATURE_H
#define CREATURE_H
#include "path.h"
#include "player.h"
#include "server.h"
#include "common_creature.h"
typedef struct creature_s {
int x;
int y;
int type;
int food;
int health;
player_t *player;
int target;
pathnode_t *path;
int convert_food;
int convert_type;
int spawn_food;
creature_state state;
int age_action_deltas;
int spawn_time;
char message[9];
unsigned char dirtymask;
int network_food_health;
int network_state;
int network_path_x;
int network_path_y;
int network_speed;
int network_target;
int network_last_x;
int network_last_y;
} creature_t;
int creature_num(const creature_t *creature);
creature_t *creature_by_num(int creature_num);
creature_t *creature_spawn(player_t *player, int x, int y, int type, int points);
void creature_kill(creature_t *creature, creature_t *killer);
int creature_set_path(creature_t *creature, int x, int y);
int creature_set_target(creature_t *creature, int target);
int creature_set_state(creature_t *creature, int state);
int creature_set_conversion_type(creature_t *creature, int type);
void creature_set_message(creature_t *creature, const char *message);
creature_t *creature_nearest_enemy(const creature_t *reference, int *distptr);
int creature_max_health(const creature_t *creature);
int creature_speed(const creature_t *creature);
int creature_dist(const creature_t *a, const creature_t *b);
int creature_food_on_tile(const creature_t *creature);
int creature_max_food(const creature_t *creature);
int creature_hitpoints(const creature_t *creature);
int creature_attack_distance(const creature_t *creature);
void creature_kill_all_players_creatures(player_t *player);
int creature_king_player();
void creature_moveall(int delta);
/* Network */
void creature_send_initial_update(client_t *client);
void creature_to_network(creature_t *creature, int dirtymask, client_t *client);
void creature_init();
void creature_shutdown();
#endif