From: <bee...@us...> - 2008-09-30 23:28:33
|
Revision: 5993 http://megamek.svn.sourceforge.net/megamek/?rev=5993&view=rev Author: beerockxs Date: 2008-09-30 23:28:25 +0000 (Tue, 30 Sep 2008) Log Message: ----------- + Bug: MASC weight calculation wrong + Bug: Server crash when building crashes because of unit standing on it Modified Paths: -------------- trunk/megamek/docs/history.txt trunk/megamek/src/megamek/common/MiscType.java trunk/megamek/src/megamek/server/Server.java Modified: trunk/megamek/docs/history.txt =================================================================== --- trunk/megamek/docs/history.txt 2008-09-30 20:11:50 UTC (rev 5992) +++ trunk/megamek/docs/history.txt 2008-09-30 23:28:25 UTC (rev 5993) @@ -62,7 +62,9 @@ Mixed (IS Chassis) Experimental: mixed tech with TO experimental equipment Mixed (IS Chassis) Unofficial: mixed tech with unofficial equipment Mixed (Clan Chassis) etc for clan base chassis -+ Bug 2095170: ATM Standard Ammo ++ Bug 2095170: ATM Standard Ammo ++ Bug: MASC weight calculation wrong ++ Bug: Server crash when building crashes because of unit standing on it v0.33.32 (2009-09-15, 21:21 GMT+1) + Remove unused image files Modified: trunk/megamek/src/megamek/common/MiscType.java =================================================================== --- trunk/megamek/src/megamek/common/MiscType.java 2008-09-30 20:11:50 UTC (rev 5992) +++ trunk/megamek/src/megamek/common/MiscType.java 2008-09-30 23:28:25 UTC (rev 5993) @@ -230,9 +230,9 @@ return (float) (Math.ceil(e.getWeightEngine() / 10.0 * 2.0) / 2.0); } if (entity.isClan()) { - return (float)Math.ceil(entity.getWeight() / 25.0f); + return (float)Math.round(entity.getWeight() / 25.0f); } - return (float)Math.ceil(entity.getWeight() / 20.0f); + return (float)Math.round(entity.getWeight() / 20.0f); } else if (hasFlag(F_TARGCOMP)) { // based on tonnage of direct_fire weaponry double fTons = 0.0; @@ -331,9 +331,9 @@ return 1 + (int) Math.ceil(entity.getWeight() / 20.0); } else if (hasFlag(F_MASC)) { if (entity.isClan()) { - return (int)Math.ceil(entity.getWeight() / 25.0); + return (int)Math.round(entity.getWeight() / 25.0); } - return (int)Math.ceil(entity.getWeight() / 20.0); + return (int)Math.round(entity.getWeight() / 20.0); } else if (hasFlag(F_TARGCOMP)) { // based on tonnage of direct_fire weaponry double fTons = 0.0; Modified: trunk/megamek/src/megamek/server/Server.java =================================================================== --- trunk/megamek/src/megamek/server/Server.java 2008-09-30 20:11:50 UTC (rev 5992) +++ trunk/megamek/src/megamek/server/Server.java 2008-09-30 23:28:25 UTC (rev 5993) @@ -12636,7 +12636,7 @@ addReport(r); addReport(oneCriticalEntity(entity, Compute.randomInt(8))); // add an empty report, for linebreaking - r = new Report(1210); + r = new Report(1210, Report.PUBLIC); addReport(r); } } @@ -13645,7 +13645,7 @@ // carriage return if (needReport) { Report finish; - finish = new Report(1210); + finish = new Report(1210, Report.PUBLIC); finish.newlines = 1; vDesc.addElement(finish); } @@ -20733,7 +20733,7 @@ addReport(damageEntity(entity, hit, next)); remaining -= next; } - addReport(new Report(1210)); + addReport(new Report(1210, Report.PUBLIC)); } } // End infantry-inside-building @@ -20744,7 +20744,7 @@ // If we found any infantry, add a line to the phase report. if (foundInfantry) { - addReport(new Report(1210)); + addReport(new Report(1210, Report.PUBLIC)); } } // End private void damageInfantryIn( Building, int ) @@ -20869,7 +20869,7 @@ // Collapse the building if the flag is set. if (collapse) { - Report r = new Report(2375); + Report r = new Report(2375, Report.PUBLIC); r.add(bldg.getName()); addReport(r); collapseBuilding(bldg, positionMap, coords); @@ -20917,6 +20917,9 @@ // Now collapse the building in this hex, so entities fall to // the ground + bldg.setCurrentCF(0, coords); + bldg.setPhaseCF(0, coords); + send(createCollapseBuildingPacket(coords)); game.getBoard().collapseBuilding(coords); // Sort in elevation order @@ -20981,7 +20984,7 @@ addReport(damageEntity(entity, hit, next)); remaining -= next; } - addReport(new Report(1210)); + addReport(new Report(1210, Report.PUBLIC)); // TODO: Why are dead entities showing up on firing phase? // Do we need to handle falling Meks? @@ -21012,13 +21015,14 @@ } // End have-entities-here. + else { + // Update the building. + bldg.setCurrentCF(0, coords); + bldg.setPhaseCF(0, coords); + send(createCollapseBuildingPacket(coords)); + game.getBoard().collapseBuilding(coords); + } - // Update the building. - bldg.setCurrentCF(0, coords); - bldg.setPhaseCF(0, coords); - send(createCollapseBuildingPacket(coords)); - game.getBoard().collapseBuilding(coords); - } // End private void collapseBuilding( Building ) /** @@ -21173,7 +21177,7 @@ public Vector<Report> damageBuilding(Building bldg, int damage, String why, Coords coords) { Vector<Report> vPhaseReport = new Vector<Report>(); - Report r = new Report(1210); + Report r = new Report(1210, Report.PUBLIC); r.newlines = 0; // Do nothing if no building or no damage was passed. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |