Skip to content

Commit

Permalink
Vehicles actually cost money in the new desktop client
Browse files Browse the repository at this point in the history
  • Loading branch information
daveajlee committed Nov 4, 2023
1 parent 123b7f3 commit 85bc1c2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion desktop/src/app/game/game.model.ts
Expand Up @@ -32,7 +32,7 @@ export class Game {
constructor( companyName: string, playerName: string, startingTime: string, scenario: Scenario,
difficultyLevel: string ) {
this.companyName = companyName;
this.balance = 80000.0;
this.balance = 200000.0;
this.playerName = playerName;
this.startingTime = startingTime;
this.scenario = scenario;
Expand Down
9 changes: 7 additions & 2 deletions desktop/src/app/vehicleshowroom/vehicleshowroom.component.ts
Expand Up @@ -83,8 +83,13 @@ export class VehicleshowroomComponent {
additionalProps.set('Standing Capacity', '' + this.getVehicleStandingCapacity());
additionalProps.set('Seating Capacity', '' + this.getVehicleSeatingCapacity());
additionalProps.set('Value', '' + this.getVehiclePurchasePrice());
this.gameService.getGame().addVehicle(new Vehicle('' + (highestFleetNumberSoFar+1), this.models[this.currentDisplay].modelType, '',
'', '', 0, additionalProps));
if ( this.getVehiclePurchasePrice() > this.gameService.getGame().balance ) {
alert('You need to earn more money before you can buy new vehicles!');
} else {
this.gameService.getGame().addVehicle(new Vehicle('' + (highestFleetNumberSoFar + 1), this.models[this.currentDisplay].modelType, '',
'', '', 0, additionalProps));
this.gameService.getGame().balance -= this.getVehiclePurchasePrice();
}
this.router.navigate(['management']);
}

Expand Down

0 comments on commit 85bc1c2

Please sign in to comment.