Skip to content

Commit

Permalink
Fixed output values. Fixed some edge cases that might have resulted i…
Browse files Browse the repository at this point in the history
…n incorrect charges.
  • Loading branch information
Mthec committed Dec 20, 2015
1 parent 0e2ff9a commit 2a8ce77
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/mod/wurmonline/mods/upkeepcosts/UpkeepCosts.java
Original file line number Diff line number Diff line change
Expand Up @@ -289,16 +289,22 @@ public void preInit() {
" ;" +
" }" +
"double upkeepD = this.calculateUpkeep(true);" +
"if (this.output) {" +
"System.out.println(\"Village upkeep - \" + this.getVillage().getName() + \" paid \" + ((upkeepD < 1.0D) ? \"0\" : Double.toString(upkeepD)) + \" this turn. Upkeep buffer is now \" + Double.toString(this.upkeepBuffer));" +
"} else {System.out.println(\"test\");}" +
"if (upkeepD < 0.0D) {" +
" logger.severe(\"Why is upkeep less than 0.0?\");" +
"}" +
"if (upkeepD < 1.0D) {" +
" this.upkeepBuffer += upkeepD;" +
" upkeepD = 0.0D;" +
"}" +
"if (this.upkeepBuffer < 1.0D) {" +
" return false;" +
"} else {" +
"while (this.upkeepBuffer >= 1.0D) {" +
" this.upkeepBuffer -= 1.0D;" +
" upkeepD += 1.0D;" +
"}" +
"if (this.output) {" +
" System.out.println(\"Village upkeep - \" + this.getVillage().getName() + \" paid \" + Double.toString(upkeepD) + \" this turn. Upkeep buffer is now \" + Double.toString(this.upkeepBuffer));" +
"}" +
"if (upkeepD == 0.0D) {" +
" return false;" +
"}" +
" long upkeep = (long)upkeepD;" +
" if(this.moneyLeft - upkeep <= 0L) {" +
Expand Down

0 comments on commit 2a8ce77

Please sign in to comment.