From c28f8c07374493de31e5581dcd53ad99a2ff917a Mon Sep 17 00:00:00 2001 From: nsensfel Date: Mon, 29 Apr 2019 17:43:18 +0200 Subject: Dialyzer error, compiles, some issues w/ client. Dialyzer says: bnt_join_battle.erl:103: The created fun has no local return bnt_join_battle.erl:122: The call shr_inventory:ataxia_add_equipment(shr_equipment:unresolved(),shr_inventory:type()) does not have an opaque term of type shr_equipment:type() as 1st argument bnt_join_battle.erl:310: Function repair_join_battle/6 will never be called shr_inventory:ataxia_add_equipment(shr_equipment:unresolved(),shr_inventory:type()) is defined, though... Still some hiccups with what is sent to the client. --- .../mechanic/turn_action/btl_turn_actions_move.erl | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/battle/mechanic') diff --git a/src/battle/mechanic/turn_action/btl_turn_actions_move.erl b/src/battle/mechanic/turn_action/btl_turn_actions_move.erl index da62e8c..a0cd138 100644 --- a/src/battle/mechanic/turn_action/btl_turn_actions_move.erl +++ b/src/battle/mechanic/turn_action/btl_turn_actions_move.erl @@ -107,7 +107,7 @@ get_path_cost_and_destination (Update, Path) -> btl_character:type(), non_neg_integer() ) - -> 'ok'. + -> ('ok' | 'error'). assert_character_can_move (Char, Cost) -> CharacterMovementPoints = shr_statistics:get_movement_points @@ -118,9 +118,16 @@ assert_character_can_move (Char, Cost) -> ) ), - true = (Cost =< CharacterMovementPoints), - - ok. + case (Cost =< CharacterMovementPoints) of + true -> ok; + false -> + io:format + ( + "~n[E] Character trying to move ~p dist with ~p points.~n", + [Cost, CharacterMovementPoints] + ), + error + end. -spec commit_move ( @@ -184,6 +191,6 @@ handle (BattleAction, Update) -> {PathCost, NewLocation, S1Update} = get_path_cost_and_destination(S0Update, Path), - assert_character_can_move(Character, PathCost), + ok = assert_character_can_move(Character, PathCost), commit_move(Character, S1Update, Path, NewLocation). -- cgit v1.2.3-70-g09d2