fix
parent
f3961d007f
commit
80678b540f
|
|
@ -166,9 +166,12 @@ public class MapManager extends MongoBase {
|
|||
|
||||
|
||||
public void eatFood(int foodId,int remainStep){
|
||||
if(remainStep == 0){
|
||||
remainStep = -1; //表示一次性生效
|
||||
}
|
||||
int finalRemainStep = remainStep;
|
||||
if(this.foodBufferMap.containsKey(foodId)){
|
||||
finalRemainStep = this.foodBufferMap.get(foodId);
|
||||
finalRemainStep += this.foodBufferMap.get(foodId);
|
||||
}
|
||||
this.foodBufferMap.put(foodId,finalRemainStep);
|
||||
updateString( "foodBuffers."+foodId, this.foodBufferMap.get(foodId));
|
||||
|
|
@ -183,6 +186,9 @@ public class MapManager extends MongoBase {
|
|||
for(Map.Entry<Integer, Integer> item : entries){
|
||||
Integer foodId = item.getKey();
|
||||
Integer remainStep = item.getValue();
|
||||
if(remainStep < 0){
|
||||
continue;
|
||||
}
|
||||
int finalRemainStep = remainStep - step;
|
||||
if(finalRemainStep<=0){
|
||||
removeFoodIds.add(foodId);
|
||||
|
|
|
|||
Loading…
Reference in New Issue