2626#include "monster.h"
2727#include "random.h"
2828#include "gui.h"
29- #include "item.h"
30- #include "item_builder.h"
3129#include "map.h"
3230#include "particle_engine.h"
3331#include "defines.h"
3836#include "object.h"
3937#include "mixer.h"
4038#include "pos_heap.h"
41- #include "loot.h"
4239
4340static void
4441monster_set_sprite_clip_for_current_state (Monster * m )
@@ -390,7 +387,7 @@ find_first_in_path(const Position *from, const Position *dest, const Position *s
390387 next = from [current .x + current .y * MAP_ROOM_WIDTH ];
391388 }
392389
393- Vector2d dir = { current .x - next .x , current .y - next .y };
390+ Vector2d dir = { ( float )( current .x - next .x ), ( float )( current .y - next .y ) };
394391 if (dir .x > 0 )
395392 return RIGHT ;
396393 else if (dir .x < 0 )
@@ -402,7 +399,7 @@ find_first_in_path(const Position *from, const Position *dest, const Position *s
402399}
403400
404401/* Manhattan distance */
405- #define MDIST (p1 , p2 ) abs(p1.x - p2.x) + abs(p1.y - p2.y)
402+ #define MDIST (p1 , p2 ) (uint16_t)( abs(p1.x - p2.x) + abs(p1.y - p2.y) )
406403
407404/**
408405 * \brief A* path finding algorithm
@@ -415,7 +412,6 @@ static Direction
415412get_optimal_move_towards (Monster * m , RoomMatrix * rm , const Position dest )
416413{
417414 Direction ret_val = INVALID ;
418- int x_dist , y_dist ;
419415 const Position start = position_to_matrix_coords (& m -> sprite -> pos );
420416 const Vector2d directions [] = {
421417 VECTOR2D_UP ,
@@ -453,8 +449,8 @@ get_optimal_move_towards(Monster *m, RoomMatrix *rm, const Position dest)
453449
454450 for (size_t i = 0 ; i < 4 ; i ++ ) {
455451 Position next = {
456- current .x + directions [i ].x ,
457- current .y + directions [i ].y ,
452+ current .x + ( int ) directions [i ].x ,
453+ current .y + ( int ) directions [i ].y ,
458454 };
459455
460456 if (!position_equals (& next , & dest )) {
@@ -465,7 +461,7 @@ get_optimal_move_towards(Monster *m, RoomMatrix *rm, const Position dest)
465461 }
466462 }
467463
468- uint32_t temp_score = 1 + gScore [current .x + current .y * WIDTH ];
464+ uint16_t temp_score = 1 + gScore [current .x + current .y * WIDTH ];
469465 if (temp_score < gScore [next .x + next .y * WIDTH ]) {
470466 from [next .x + next .y * WIDTH ] = current ;
471467 gScore [next .x + next .y * WIDTH ] = temp_score ;
@@ -661,7 +657,6 @@ monster_move(Monster *m, RoomMatrix *rm, Map *map)
661657 }
662658
663659 Position originalMPos = position_to_matrix_coords (& m -> sprite -> pos );
664-
665660 SPACE_CLEAR_FLAG (& rm -> spaces [originalMPos .x ][originalMPos .y ], TILE_OCCUPIED );
666661 rm -> spaces [originalMPos .x ][originalMPos .y ].monster = NULL ;
667662
0 commit comments