17
17
18
18
#include < MCAssetManager>
19
19
20
- std::unique_ptr<Car> CarFactory::buildCar (size_t index, size_t numCars , Game & game)
20
+ std::unique_ptr<Car> CarFactory::buildCar (size_t index, size_t carCount , Game & game)
21
21
{
22
22
const int defaultPower = 200000 ; // This in Watts
23
23
const float defaultDrag = 2 .5f ;
24
24
25
- static const size_t NUM_CARS = numCars;
26
25
static std::map<size_t , std::string> carImageMap = {
27
- { NUM_CARS - 1 , " carBlack" },
28
- { NUM_CARS - 2 , " carOrange" },
29
- { NUM_CARS - 3 , " carRed" },
30
- { NUM_CARS - 4 , " carBlue" },
31
- { NUM_CARS - 5 , " carDarkGreen" },
32
- { NUM_CARS - 6 , " carBrown" },
33
- { NUM_CARS - 7 , " carCyan" },
34
- { NUM_CARS - 8 , " carViolet" },
35
- { NUM_CARS - 9 , " carGreen" },
36
- { NUM_CARS - 10 , " carDarkRed" },
26
+ { 0 , " carPink" },
37
27
{ 1 , " carGrey" },
38
- { 0 , " carPink" }
28
+ { 2 , " carDarkRed" },
29
+ { 3 , " carGreen" },
30
+ { 4 , " carViolet" },
31
+ { 5 , " carCyan" },
32
+ { 6 , " carBrown" },
33
+ { 7 , " carDarkGreen" },
34
+ { 8 , " carBlue" },
35
+ { 9 , " carRed" },
36
+ { 10 , " carOrange" },
37
+ { 11 , " carBlack" }
39
38
};
40
39
41
40
Car::Description desc;
@@ -60,8 +59,8 @@ std::unique_ptr<Car> CarFactory::buildCar(size_t index, size_t numCars, Game & g
60
59
// Introduce some variance to the power of computer players so that the
61
60
// slowest cars have less power than the human player and the fastest
62
61
// cars have more power than the human player.
63
- desc.power = defaultPower / 2 + (index + 1 ) * defaultPower / NUM_CARS ;
64
- desc.accelerationFriction = (0 .3f + 0 .4f * float (index + 1 ) / NUM_CARS ) * Game::instance ().difficultyProfile ().accelerationFrictionMultiplier (false );
62
+ desc.power = defaultPower / 2 + (index + 1 ) * defaultPower / carCount ;
63
+ desc.accelerationFriction = (0 .3f + 0 .4f * float (index + 1 ) / carCount ) * Game::instance ().difficultyProfile ().accelerationFrictionMultiplier (false );
65
64
desc.dragQuadratic = defaultDrag;
66
65
67
66
return std::make_unique<Car>(desc, MCAssetManager::surfaceManager ().surface (carImage), index, false );
0 commit comments