ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/random_maps/monster.C
(Generate patch)

Comparing deliantra/server/random_maps/monster.C (file contents):
Revision 1.3 by root, Sun Sep 10 16:06:37 2006 UTC vs.
Revision 1.10 by root, Sun Dec 31 20:46:17 2006 UTC

1
2/*
3 * static char *rcsid_monster_c =
4 * "$Id: monster.C,v 1.3 2006/09/10 16:06:37 root Exp $";
5 */
6 1
7/* 2/*
8 CrossFire, A Multiplayer game for X-windows 3 CrossFire, A Multiplayer game for X-windows
9 4
10 Copyright (C) 2002 Mark Wedel & Crossfire Development Team 5 Copyright (C) 2002 Mark Wedel & Crossfire Development Team
22 17
23 You should have received a copy of the GNU General Public License 18 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software 19 along with this program; if not, write to the Free Software
25 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 21
27 The authors can be reached via e-mail at crossfire-devel@real-time.com 22 The authors can be reached via e-mail at <crossfire@schmorp.de>
28*/ 23*/
29 24
30#include <global.h> 25#include <global.h>
31#include <random_map.h> 26#include <random_map.h>
32#include <rproto.h> 27#include <rproto.h>
33 28
34/* some monsters are multisquare, and these guys require special 29/* some monsters are multisquare, and these guys require special
35 handling. */ 30 handling. */
36 31
37void 32void
38insert_multisquare_ob_in_map (object *new_obj, mapstruct *map) 33insert_multisquare_ob_in_map (object *new_obj, maptile *map)
39{ 34{
40 int x, y; 35 int x, y;
41 archetype *at; 36 archetype *at;
42 object *old_seg; 37 object *old_seg;
43 object *head; 38 object *head;
47 42
48 x = new_obj->x; 43 x = new_obj->x;
49 y = new_obj->y; 44 y = new_obj->y;
50 old_seg = new_obj; 45 old_seg = new_obj;
51 head = new_obj; 46 head = new_obj;
47
52 for (at = new_obj->arch->more; at != NULL; at = at->more) 48 for (at = new_obj->arch->more; at != NULL; at = at->more)
53 { 49 {
54 object *new_seg; 50 object *new_seg;
55 51
56 new_seg = arch_to_object (at); 52 new_seg = arch_to_object (at);
60 insert_ob_in_map (new_seg, new_seg->map, new_seg, INS_NO_MERGE | INS_NO_WALK_ON); 56 insert_ob_in_map (new_seg, new_seg->map, new_seg, INS_NO_MERGE | INS_NO_WALK_ON);
61 new_seg->head = head; 57 new_seg->head = head;
62 old_seg->more = new_seg; 58 old_seg->more = new_seg;
63 old_seg = new_seg; 59 old_seg = new_seg;
64 } 60 }
61
65 old_seg->more = NULL; 62 old_seg->more = NULL;
66
67
68} 63}
69
70 64
71/* place some monsters into the map. */ 65/* place some monsters into the map. */
72void 66void
73place_monsters (mapstruct *map, char *monsterstyle, int difficulty, RMParms * RP) 67place_monsters (maptile *map, char *monsterstyle, int difficulty, random_map_params *RP)
74{ 68{
75 char styledirname[256]; 69 char styledirname[1024];
76 mapstruct *style_map = 0; 70 maptile *style_map = 0;
77 int failed_placements; 71 int failed_placements;
78 sint64 exp_per_sq, total_experience; 72 sint64 exp_per_sq, total_experience;
79 int number_monsters = 0; 73 int number_monsters = 0;
80 archetype *at; 74 archetype *at;
81 75
113 for (at = new_monster->arch; at != NULL; at = at->more) 107 for (at = new_monster->arch; at != NULL; at = at->more)
114 number_monsters++; 108 number_monsters++;
115 RP->total_map_hp += new_monster->stats.hp; /* a global count */ 109 RP->total_map_hp += new_monster->stats.hp; /* a global count */
116 } 110 }
117 else 111 else
118 {
119 failed_placements++; 112 failed_placements++;
120 } 113
121 exp_per_sq = (sint64) (((double) 1000 * total_experience) / (MAP_WIDTH (map) * MAP_HEIGHT (map) + 1)); 114 exp_per_sq = (sint64) (((double) 1000 * total_experience) / (map->width * map->height + 1));
122 } 115 }
123} 116}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines