Give children born on the same day distinct names

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

author
Marijn Besseling <njirambem@gmail.com> · 2026-10-25 06:21 UTC
commit
954bfe7d77ebb2324475eb00126a538f9c29adf9
parent
ff8642f81d
tree
browse at this commit

1 file changed +5 -2

src/family.rs +5 -2

@@ -415,6 +415,7 @@ fn births(
415 415 .map(|(item, _)| item),
416 416 );
417 417 let mut born = 0;
418 + let mut taken: Vec<&str> = colonists.iter().map(|c| c.0.name.as_str()).collect();
418 419 let mut families: Vec<(&u32, &Home)> = homes.by_family.iter().collect();
419 420 families.sort_by_key(|(family, _)| **family);
420 421 for (&family, home) in families {
@@ -440,10 +441,12 @@ fn births(
440 441 if rng.range_f32(0.0..1.0) >= BIRTH_CHANCE {
441 442 continue;
442 443 }
443 - let taken: Vec<&str> = colonists.iter().map(|c| c.0.name.as_str()).collect();
444 444 let index = (0..NAMES.len())
445 445 .find(|&i| !taken.contains(&NAMES[i]))
446 - .unwrap_or(count);
446 + .unwrap_or(count + born);
447 + if let Some(name) = NAMES.get(index) {
448 + taken.push(name);
449 + }
447 450 let tile = home
448 451 .interior()
449 452 .find(|t| !home.bed_tiles().contains(t))