Ticket #1839: tribute-insufficient-resources.patch
File tribute-insufficient-resources.patch, 996 bytes (added by , 11 years ago) |
---|
-
simulation/components/Player.js
533 533 if (this.state != "active" || cmpPlayer.state != "active") 534 534 return; 535 535 536 if ( !this.GetNeededResources(amounts))536 if (this.TrySubtractResources(amounts)) 537 537 { 538 for (var type in amounts)539 this.resourceCount[type] -= amounts[type];540 541 538 cmpPlayer.AddResources(amounts); 542 539 543 540 var total = Object.keys(amounts).reduce(function (sum, type){ return sum + amounts[type]; }, 0); 544 541 var cmpOurStatisticsTracker = QueryPlayerIDInterface(this.playerID, IID_StatisticsTracker); 545 542 if (cmpOurStatisticsTracker) … … 549 546 cmpTheirStatisticsTracker.IncreaseTributesReceivedCounter(total); 550 547 // TODO: notify the receiver 551 548 } 552 // else not enough resources... TODO: send gui notification553 549 }; 554 550 555 551 Engine.RegisterComponentType(IID_Player, "Player", Player);