adityaravishankar / command-and-conquer

Command & Conquer in HTML5/Javascript
777 stars 170 forks source link

Selling Refinery when Harvester is in removes Harvester. #38

Closed bigscout79 closed 12 years ago

bigscout79 commented 12 years ago

Normally you don't lose the harvester when you sell the refinery.

jovoud commented 12 years ago

I did not look at the code (did not have the time yet) but this might be because: if your harvester goes to the building it disapears from the map and the building animation takes over? so maybe the harvester object might still exist but is not displayed?

jovoud commented 12 years ago

line 1894-1899: if (this.name == 'refinery'&& (this.status == "build"||this.status == 'unload')){ if (this.status== 'build'){ game.units.push(vehicles.add({name:'harvester',team:this.team,x:this.x+0.5, y:this.y + 2,moveDirection:14,orders:{type:'harvest',from:this}})); this.status = ""; }

You should add here || this.status=="destroyed" or something..

jovoud commented 12 years ago

Now i look at it what happens if you have 2 harvesters? and it unloads in the refinery? cause here there is selected on the property name .?

//edit nvm

adityaravishankar commented 12 years ago

Good find... :)

adityaravishankar commented 12 years ago

Patched.... Similar code has been added to release refinery before selling it. Should be out on next release