Permalink
Browse files

core.h: Replaced few #defines with variables.

MAX_HEIGHT_DIFF, MIN_CLEARENCE, ACTION_POINTS.
  • Loading branch information...
1 parent 2a9c620 commit 541033a7a66cb9bc49f51acbcdbc200afe66e3dc @ozkriff committed Apr 21, 2012
Showing with 11 additions and 10 deletions.
  1. +5 −2 core.c
  2. +3 −5 core.h
  3. +3 −3 path.c
View
7 core.c
@@ -13,6 +13,9 @@
#include "misc.h"
#include "path.h"
+int max_height_diff = 1;
+int min_clearence = 1;
+int action_points = 30;
Block3 *map[MAP_Z][MAP_Y][MAP_X];
V3i active_block_pos = {0, 0, 0};
Unit_mode unit_mode = UM_NORMAL;
@@ -106,7 +109,7 @@ bool check_xxx(V3i orig_pos, V3i pos, int height){
ushort calc_block_clearence(V3i p, ushort max_size){
ushort i;
ushort j;
- ushort h = MAX_HEIGHT_DIFF;
+ ushort h = (ushort)max_height_diff;
assert(inboard(p));
if(block(p) && block(p)->t != B_FLOOR)
return 0;
@@ -280,4 +283,4 @@ int get_path_lines_count(void){
inc_v3i(&p);
}
return n;
-}
+}
View
8 core.h
@@ -46,11 +46,9 @@ typedef struct {
#define MAP_Y 100
#define MAP_Z 6
-#define MAX_HEIGHT_DIFF 1
-
-#define MIN_CLEARENCE 1
-#define ACTION_POINTS 30
-
+extern int max_height_diff;
+extern int min_clearence;
+extern int action_points;
extern Block3 *map[MAP_Z][MAP_Y][MAP_X];
extern V3i active_block_pos;
extern Unit_mode unit_mode;
View
6 path.c
@@ -92,12 +92,12 @@ static void process_neibor(V3i p1, V3i p2){
if(d == D_FL && (check_wall(p1, 3) || check_wall(p1, 0)
|| check_wall(p2, 2) || check_wall(p2, 1))) return;
}
- if(!check_height_diff(p1, p2, MAX_HEIGHT_DIFF))
+ if(!check_height_diff(p1, p2, max_height_diff))
return;
- if(b2->clearence < MIN_CLEARENCE)
+ if(b2->clearence < min_clearence)
return;
newcost = b1->cost + get_tile_cost(p1, p2);
- if(b2->cost > newcost && newcost <= ACTION_POINTS)
+ if(b2->cost > newcost && newcost <= action_points)
push(p2, m2dir(p2, p1), newcost);
}

0 comments on commit 541033a

Please sign in to comment.