@@ -72,7 +72,6 @@ pub fn max_cost() -> MovePoints {
7272pub fn tile_cost < S : GameState > ( db : & Db , state : & S , unit : & Unit , from : & ExactPos , pos : & ExactPos )
7373 -> MovePoints
7474{
75- let unit_type = db. unit_type ( & unit. type_id ) ;
7675 let map_pos = & pos. map_pos ;
7776 let objects = state. objects_at ( map_pos) ;
7877 let units = state. units_at ( map_pos) ;
@@ -82,10 +81,8 @@ pub fn tile_cost<S: GameState>(db: &Db, state: &S, unit: &Unit, from: &ExactPos,
8281 for object in & objects {
8382 match object. pos . slot_id {
8483 SlotId :: Id ( _) => if unit. pos == object. pos {
85- // assert_eq!(unit_type.class, UnitClass::Infantry); // TODO
86- if unit_type. class != UnitClass :: Infantry {
87- println ! ( "WARNING: non-infantry unit in small object: {:#?}" , unit) ;
88- }
84+ let unit_class = db. unit_type ( & unit. type_id ) . class ;
85+ assert_eq ! ( unit_class, UnitClass :: Infantry ) ;
8986 break ' unit_loop;
9087 } ,
9188 SlotId :: TwoTiles ( _) | SlotId :: WholeTile => {
@@ -95,6 +92,7 @@ pub fn tile_cost<S: GameState>(db: &Db, state: &S, unit: &Unit, from: &ExactPos,
9592 }
9693 unit_cost += 1 ;
9794 }
95+ let unit_type = db. unit_type ( & unit. type_id ) ;
9896 let tile = state. map ( ) . tile ( & pos) ;
9997 let mut terrain_cost = match unit_type. class {
10098 UnitClass :: Infantry => match * tile {
0 commit comments