diff options
author | Stijn Buys <ingar@osirion.org> | 2009-01-25 11:59:24 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2009-01-25 11:59:24 +0000 |
commit | afb56bf384bbc585f242978b6b5366c474c5c7f7 (patch) | |
tree | 9f2d7e006b30ea0be8ebc9f15253b493ef65192f /src/game/base/racetrack.cc | |
parent | 443a8dc2b49be6e1fa668f43a12bf5f886a1bdcd (diff) |
make a player pay for ships,
add prize money to the race
Diffstat (limited to 'src/game/base/racetrack.cc')
-rw-r--r-- | src/game/base/racetrack.cc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/game/base/racetrack.cc b/src/game/base/racetrack.cc index b543c9c..e818414 100644 --- a/src/game/base/racetrack.cc +++ b/src/game/base/racetrack.cc @@ -192,8 +192,18 @@ void RaceTrack::frame(float seconds) } else { std::stringstream msgstr; - msgstr << "^BRace completed in " << core::server()->time() - track_racestart << " seconds!"; + msgstr << "^BRace completed in " << core::server()->time() - track_racestart << " seconds!"; core::server()->broadcast(msgstr.str()); + + // prize money + unsigned long the_prize = (unsigned long) floorf(10000.0f / (core::server()->time() - track_racestart)); + player->add_credits(the_prize); + msgstr.clear(); + msgstr.str(""); + msgstr << "You receive " << the_prize << " credits." << std::endl; + player->send(msgstr.str()); + player->sound("game/buy"); + reset(); } } |