Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions robocode.api/src/main/java/robocode/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,13 @@ private void setTimeHidden(long time) {
*/
// This method must be invisible on Robot API
private void setPriorityHidden(int newPriority) {
// System events have a fixed priority (e.g. 100) that is outside the 0-99 range allowed for
// robot-defined events. The priority of a system event must not be changed, and the 0-99 rule
// must not be enforced for them, as that would clamp their priority and emit misleading
// warnings on the robot console.
if (isCriticalEvent()) {
return;
}
if (newPriority < 0) {
Logger.printlnToRobotsConsole("SYSTEM: Priority must be between 0 and 99");
Logger.printlnToRobotsConsole("SYSTEM: Priority for " + this.getClass().getName() + " will be 0");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@ public void setEventPriority(String eventClass, int priority) {
}
if (HiddenAccess.isCriticalEvent(event)) {
robotProxy.println("SYSTEM: You may not change the priority of a system event.");
return;
}
HiddenAccess.setEventPriority(event, priority);
}
Expand Down