Skip to content

Commit

Permalink
Change lag spikes config in messages.proto
Browse files Browse the repository at this point in the history
  • Loading branch information
Nico-Sanchez committed May 14, 2024
1 parent 922f61c commit d401aa1
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 81 deletions.
16 changes: 1 addition & 15 deletions apps/arena/lib/arena/serialization/messages.pb.ex
Original file line number Diff line number Diff line change
Expand Up @@ -206,26 +206,12 @@ defmodule Arena.Serialization.ConfigCharacter do
)
end

defmodule Arena.Serialization.ClientConfig.LagSpikesEntry do
@moduledoc false

use Protobuf, map: true, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"

field(:key, 1, type: :string)
field(:value, 2, type: Arena.Serialization.ConfigLagSpikes)
end

defmodule Arena.Serialization.ClientConfig do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"

field(:lag_spikes, 1,
repeated: true,
type: Arena.Serialization.ClientConfig.LagSpikesEntry,
json_name: "lagSpikes",
map: true
)
field(:lag_spikes, 1, type: Arena.Serialization.ConfigLagSpikes, json_name: "lagSpikes")
end

defmodule Arena.Serialization.ConfigLagSpikes do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,26 +210,12 @@ defmodule ArenaLoadTest.Serialization.ConfigCharacter do
)
end

defmodule ArenaLoadTest.Serialization.ClientConfig.LagSpikesEntry do
@moduledoc false

use Protobuf, map: true, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"

field(:key, 1, type: :string)
field(:value, 2, type: ArenaLoadTest.Serialization.ConfigLagSpikes)
end

defmodule ArenaLoadTest.Serialization.ClientConfig do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"

field(:lag_spikes, 1,
repeated: true,
type: ArenaLoadTest.Serialization.ClientConfig.LagSpikesEntry,
json_name: "lagSpikes",
map: true
)
field(:lag_spikes, 1, type: ArenaLoadTest.Serialization.ConfigLagSpikes, json_name: "lagSpikes")
end

defmodule ArenaLoadTest.Serialization.ConfigLagSpikes do
Expand Down
16 changes: 1 addition & 15 deletions apps/bot_manager/lib/protobuf/messages.pb.ex
Original file line number Diff line number Diff line change
Expand Up @@ -206,26 +206,12 @@ defmodule BotManager.Protobuf.ConfigCharacter do
)
end

defmodule BotManager.Protobuf.ClientConfig.LagSpikesEntry do
@moduledoc false

use Protobuf, map: true, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"

field(:key, 1, type: :string)
field(:value, 2, type: BotManager.Protobuf.ConfigLagSpikes)
end

defmodule BotManager.Protobuf.ClientConfig do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"

field(:lag_spikes, 1,
repeated: true,
type: BotManager.Protobuf.ClientConfig.LagSpikesEntry,
json_name: "lagSpikes",
map: true
)
field(:lag_spikes, 1, type: BotManager.Protobuf.ConfigLagSpikes, json_name: "lagSpikes")
end

defmodule BotManager.Protobuf.ConfigLagSpikes do
Expand Down
57 changes: 37 additions & 20 deletions apps/game_client/assets/js/protobuf/messages_pb.js
Original file line number Diff line number Diff line change
Expand Up @@ -3524,7 +3524,7 @@ proto.ClientConfig.prototype.toObject = function(opt_includeInstance) {
*/
proto.ClientConfig.toObject = function(includeInstance, msg) {
var f, obj = {
lagSpikesMap: (f = msg.getLagSpikesMap()) ? f.toObject(includeInstance, proto.ConfigLagSpikes.toObject) : []
lagSpikes: (f = msg.getLagSpikes()) && proto.ConfigLagSpikes.toObject(includeInstance, f)
};

if (includeInstance) {
Expand Down Expand Up @@ -3562,10 +3562,9 @@ proto.ClientConfig.deserializeBinaryFromReader = function(msg, reader) {
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = msg.getLagSpikesMap();
reader.readMessage(value, function(message, reader) {
jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, proto.ConfigLagSpikes.deserializeBinaryFromReader, "", new proto.ConfigLagSpikes());
});
var value = new proto.ConfigLagSpikes;
reader.readMessage(value,proto.ConfigLagSpikes.deserializeBinaryFromReader);
msg.setLagSpikes(value);
break;
default:
reader.skipField();
Expand Down Expand Up @@ -3596,33 +3595,51 @@ proto.ClientConfig.prototype.serializeBinary = function() {
*/
proto.ClientConfig.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getLagSpikesMap(true);
if (f && f.getLength() > 0) {
f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.ConfigLagSpikes.serializeBinaryToWriter);
f = message.getLagSpikes();
if (f != null) {
writer.writeMessage(
1,
f,
proto.ConfigLagSpikes.serializeBinaryToWriter
);
}
};


/**
* map<string, ConfigLagSpikes> lag_spikes = 1;
* @param {boolean=} opt_noLazyCreate Do not create the map if
* empty, instead returning `undefined`
* @return {!jspb.Map<string,!proto.ConfigLagSpikes>}
* optional ConfigLagSpikes lag_spikes = 1;
* @return {?proto.ConfigLagSpikes}
*/
proto.ClientConfig.prototype.getLagSpikesMap = function(opt_noLazyCreate) {
return /** @type {!jspb.Map<string,!proto.ConfigLagSpikes>} */ (
jspb.Message.getMapField(this, 1, opt_noLazyCreate,
proto.ConfigLagSpikes));
proto.ClientConfig.prototype.getLagSpikes = function() {
return /** @type{?proto.ConfigLagSpikes} */ (
jspb.Message.getWrapperField(this, proto.ConfigLagSpikes, 1));
};


/**
* Clears values from the map. The map will be non-null.
* @param {?proto.ConfigLagSpikes|undefined} value
* @return {!proto.ClientConfig} returns this
*/
proto.ClientConfig.prototype.setLagSpikes = function(value) {
return jspb.Message.setWrapperField(this, 1, value);
};


/**
* Clears the message field making it undefined.
* @return {!proto.ClientConfig} returns this
*/
proto.ClientConfig.prototype.clearLagSpikesMap = function() {
this.getLagSpikesMap().clear();
return this;
proto.ClientConfig.prototype.clearLagSpikes = function() {
return this.setLagSpikes(undefined);
};


/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.ClientConfig.prototype.hasLagSpikes = function() {
return jspb.Message.getField(this, 1) != null;
};


Expand Down
16 changes: 1 addition & 15 deletions apps/game_client/lib/game_client/protobuf/messages.pb.ex
Original file line number Diff line number Diff line change
Expand Up @@ -206,26 +206,12 @@ defmodule GameClient.Protobuf.ConfigCharacter do
)
end

defmodule GameClient.Protobuf.ClientConfig.LagSpikesEntry do
@moduledoc false

use Protobuf, map: true, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"

field(:key, 1, type: :string)
field(:value, 2, type: GameClient.Protobuf.ConfigLagSpikes)
end

defmodule GameClient.Protobuf.ClientConfig do
@moduledoc false

use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0"

field(:lag_spikes, 1,
repeated: true,
type: GameClient.Protobuf.ClientConfig.LagSpikesEntry,
json_name: "lagSpikes",
map: true
)
field(:lag_spikes, 1, type: GameClient.Protobuf.ConfigLagSpikes, json_name: "lagSpikes")
end

defmodule GameClient.Protobuf.ConfigLagSpikes do
Expand Down
2 changes: 1 addition & 1 deletion apps/serialization/messages.proto
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ message ConfigCharacter {
}

message ClientConfig {
map<string, ConfigLagSpikes> lag_spikes = 1;
ConfigLagSpikes lag_spikes = 1;
}

message ConfigLagSpikes {
Expand Down

0 comments on commit d401aa1

Please sign in to comment.