Reverse argument order for sendTo

It makes more sense to put the address first then have the large
structure to send as the second argument to sendTo.  The opposite order
was originally chosen to be similar to that of sendto in BSD sockets.
This commit is contained in:
Hornwitser committed 2023-07-27 00:24:24 +02:00
1 parent 183d2921a8
commit 295cc7543a
24 files changed
+87 -74

No files matched your search

+3 -3
View File
@@ -33,7 +33,7 @@ class InstancePlugin extends libPlugin.BaseInstancePlugin {
}
async researchContribution(tech) {
this.instance.sendTo(new ContributionEvent(tech.name, tech.level, tech.contribution), "controller");
this.instance.sendTo("controller", new ContributionEvent(tech.name, tech.level, tech.contribution));
}
async handleProgressEvent(event) {
@@ -45,7 +45,7 @@ class InstancePlugin extends libPlugin.BaseInstancePlugin {
}
async researchFinished(tech) {
this.instance.sendTo(new FinishedEvent(tech.name, tech.level), "allInstances");
this.instance.sendTo("allInstances", new FinishedEvent(tech.name, tech.level));
}
async handleFinishedEvent(event) {
@@ -72,7 +72,7 @@ class InstancePlugin extends libPlugin.BaseInstancePlugin {
instanceTechs.set(tech.name, tech);
}
let controllerTechs = await this.instance.sendTo(new SyncTechnologiesRequest(techsToSend), "controller");
let controllerTechs = await this.instance.sendTo("controller", new SyncTechnologiesRequest(techsToSend));
this.syncStarted = true;
let techsToSync = [];
for (let controllerTech of controllerTechs) {