From fe2b0ddfcec89c3a3f4b0b75713c13cc70b74d1c Mon Sep 17 00:00:00 2001 From: Tom Hicks Date: Mon, 24 Apr 2023 23:37:15 -0700 Subject: [PATCH] Implements CGGetBackgrounds. --- sbf-cpp/sbf.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/sbf-cpp/sbf.cpp b/sbf-cpp/sbf.cpp index 4cc9e15..0eec5ad 100644 --- a/sbf-cpp/sbf.cpp +++ b/sbf-cpp/sbf.cpp @@ -296,8 +296,21 @@ void CGGetAttributes(CharacterType& ch) { } void CGGetBackgrounds(CharacterType& ch) { - // TODO: Fill this in. - cout << "// TODO: CGGetBackgrounds(CharacterType&)" << endl; + // Spend background points + MenuStyle ms; + int background_points = GetBackgroundPoints(); + vector background_labels = GetBackgroundLabels(); + while (background_points > 0) { + MaybeClearScreen(); + vector background_values = ch.GetBackgroundValues(); + int background_id = ChooseStringIdWithValues( + background_labels, + background_values, + ms, + "Which background do you want to spend 1 of your " + to_string(background_points) + " points on?"); + ch.SetBackgroundValue(background_id, ch.GetBackgroundValue(background_id) + 1); + background_points--; + } } void CGGetRoad(CharacterType& ch) {