From: Nils Forssén Date: Tue, 12 Dec 2023 09:27:57 +0000 (+0100) Subject: added random seed X-Git-Url: https://gitweb.forssennils.se/?a=commitdiff_plain;h=68a31ec57790304ec46449b3b8cf379d698a771c;p=TDDC76_proj.git added random seed --- diff --git a/assets/data.json b/assets/data.json index 79aed33..54adbb9 100644 --- a/assets/data.json +++ b/assets/data.json @@ -52,7 +52,8 @@ "yf_per_second": 0.25, "bikes_per_second": 0.25, "point_scale_div": 3.0, - "highscore_file": "assets/highscore.csv" + "highscore_file": "assets/highscore.csv", + "random_seed": 234234 }, "map": { "points_pos": [ diff --git a/play b/play index 0f1e5c0..e382014 100755 Binary files a/play and b/play differ diff --git a/src/_main.cc b/src/_main.cc index 127f552..9322f3f 100644 --- a/src/_main.cc +++ b/src/_main.cc @@ -29,6 +29,7 @@ int main () std::ifstream f("assets/data.json"); json data = json::parse(f); + srand(data["game_constants"]["random_seed"]); game_context.current_state = std::make_unique(data); f.close(); @@ -59,8 +60,6 @@ int main () { game_context.current_state = std::move(game_context.next_state); game_context.next_state = nullptr; - - srand(game_clock.getElapsedTime().asMicroseconds()); } //Draw