Commits

Andrey Lesnikov committed a615a41

path, core: Updated fill_map().

  • Participants
  • Parent commits f517329

Comments (0)

Files changed (2)

   u->stamina -= unit_types[u->t].ter_mv[tile(u->m)->t];
 #endif
   u->dir = e.dir;
-  fill_map(selected_unit);
+  if(selected_unit)
+    fill_map(selected_unit);
   if(u->player == current_player->id)
     update_fog_after_move(u);
 }
   push_node(&dead_units, n);
   if(u == selected_unit)
     selected_unit = NULL;
-  else
+  else if(selected_unit)
     fill_map(selected_unit);
 }
 
   u->ap += unit_types[u->t].ter_mv[tile(u->m)->t];
   u->stamina += unit_types[u->t].ter_mv[tile(u->m)->t];
 #endif
-  fill_map(selected_unit);
+  if(selected_unit)
+    fill_map(selected_unit);
   if(u->player == current_player->id)
     updatefog(current_player->id);
 }
         e.dead_unit_id);
   }
   push_node(&units, n);
-  fill_map(selected_unit);
+  if(selected_unit)
+    fill_map(selected_unit);
 }
 
 void
     node = node->next ? node->next : units.head;
     u = node->data;
   }while(u->player != current_player->id);
-  fill_map(selected_unit = u);
+  if(selected_unit)
+    fill_map(selected_unit = u);
 }
 
 void
 /*TODO: link to algorithm*/
 void
 fill_map (Unit *u) {
-  if(!u)
-    return;
   clean_map();
   push(u->m, u->m, 0, u->dir); /*push start position*/
   while(stack.count > 0)