[Megameknet-cvs] MegaMekNET/src/server/campaign SPlanet.java,1.33,1.34
Status: Inactive
Brought to you by:
mcwizard
From: Helge R. <mcw...@us...> - 2005-03-28 18:26:36
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20708/src/server/campaign Modified Files: SPlanet.java Log Message: -> S Fix a problem with houses not getting the planets they conquered! Index: SPlanet.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/SPlanet.java,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** SPlanet.java 26 Mar 2005 12:22:13 -0000 1.33 --- SPlanet.java 28 Mar 2005 18:26:25 -0000 1.34 *************** *** 243,246 **** --- 243,247 ---- public int doGainInfluence(SHouse winner, SHouse looser, int amount) { + SHouse owner = getOwner(); if (!winner.canConquerPlanets()) return 0; int infgain = getInfluence().moveInfluence(winner, looser, amount); *************** *** 249,252 **** --- 250,270 ---- updated(); checkOwner(); + //Check the owner and assign the planet + if (getOwner() != null){ + //has a new owner + if (owner != null){ + if (!owner.equals(getOwner())){ + //The new owner is not the old owner + owner.removePlanet(this); + getOwner().addPlanet(this); + } + } else { + //The new owner now owns the planet + getOwner().addPlanet(this); + } + } else if (owner != null){ + //This planet has lost its owner! + owner.removePlanet(this); + } return infgain; } |