Skip to content

Commit 136bbd1

Browse files
committed
fix unintended cheese behavior
1 parent 2203a19 commit 136bbd1

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

client/src/playback/Actions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,8 @@ export const ACTION_DEFINITIONS: Record<schema.Action, typeof Action<ActionUnion
336336
const target = round.bodies.getById(this.actionData.id())
337337
const amount = this.actionData.amount()
338338

339-
body.cheese -= amount
340-
target.cheese += amount
339+
body.cheese -= Math.min(body.cheese, amount)
340+
target.cheese += Math.min(body.cheese, amount)
341341
}
342342
draw(match: Match, ctx: CanvasRenderingContext2D): void {
343343
const srcBody = match.currentRound.bodies.getById(this.robotId)

schema/battlecode.fbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ table GameMap {
289289
randomSeed: int;
290290
walls: [bool];
291291
dirt: [bool];
292-
cheese: [byte];
292+
cheese: [int];
293293
cheeseMines: VecTable;
294294
catWaypointIds: [ushort];
295295
catWaypointVecs: [VecTable];

0 commit comments

Comments
 (0)