Automatically set parent family in individual, when adding child to the family.
authorRafał Długołęcki <rafal@dlugolecki.net.pl>
Tue, 14 Jan 2014 22:12:26 +0000 (23:12 +0100)
committerRafał Długołęcki <rafal@dlugolecki.net.pl>
Tue, 14 Jan 2014 22:12:26 +0000 (23:12 +0100)
src/storage/family.c
src/storage/family.h

index 99353f1424bb60c8fe84efa5ba97e94c56d350e3..1508cd929446ebc4f0fb9ec87114c6945586d82d 100644 (file)
@@ -1,6 +1,7 @@
 #include <stdlib.h>
 
 #include "family.h"
+#include "individual.h"
 
 #include "../debug.h"
 
@@ -97,6 +98,7 @@ void familia_family_add_child(struct familia_family * family, struct familia_ind
                family->children = tmp;
                family->children[family->children_no] = individual;
                family->children_no++;
+               familia_individual_set_parents(individual, family);
        }
        else {
                debug("There were problems with allocating memory for family children.\n");
index a8dc2fd95b4079443c75aa2ee255e9b3a37042d2..50fb19cfb8757e5debda2424b568b5664a315eb3 100644 (file)
@@ -88,6 +88,8 @@ struct familia_individual * familia_family_remove_individual(struct familia_fami
 
 /**
  * Adds new child in the given family
+ * Automatically sets family as parents in individual variable.
+ *
  * @parameter family to set the individual
  * @parameter individual which will be added
  */