diff --git a/game/glass/btl4fe.cpp b/game/glass/btl4fe.cpp index 5723b14..74cc862 100644 --- a/game/glass/btl4fe.cpp +++ b/game/glass/btl4fe.cpp @@ -1199,7 +1199,7 @@ int if (menu.steamAction == 1) { BTLobbyRoster roster; - if (BTLobby_HostAndRoom(self.name, self.vehicle, self.color, + if (BTLobby_HostAndRoom(self.name, self.vehicle, self.color, self.experience, &roster, spec->steamMyToken, sizeof(spec->steamMyToken), spec->steamMap, sizeof(spec->steamMap)) != 0 || roster.memberCount == 0) @@ -1220,6 +1220,12 @@ int strncpy(pilot.color, member.color[0] ? member.color : kColors[0].key, sizeof(pilot.color) - 1); + // #116: the member's OWN experience choice rides the lobby now; + // absent (older build in the lobby) leaves the field empty and the + // egg writer's "veteran" fallback applies -- the old behavior, + // but now only for clients that never published a choice. + strncpy(pilot.experience, member.experience, + sizeof(pilot.experience) - 1); sprintf(pilot.address, "%s:%d", member.fakeAddress, member.gamePort); if (!member.isSelf) @@ -1238,7 +1244,7 @@ int } if (menu.steamAction == 2) { - if (BTLobby_JoinAndWait(self.name, self.vehicle, self.color, + if (BTLobby_JoinAndWait(self.name, self.vehicle, self.color, self.experience, spec->steamMyToken, sizeof(spec->steamMyToken), spec->steamMap, sizeof(spec->steamMap)) != 0) { diff --git a/game/glass/btl4lobby.cpp b/game/glass/btl4lobby.cpp index 05a5cd8..480ea91 100644 --- a/game/glass/btl4lobby.cpp +++ b/game/glass/btl4lobby.cpp @@ -83,7 +83,8 @@ static int static CSteamID currentLobby; static void - PublishSelf(const char *pilot_name, const char *vehicle, const char *color) + PublishSelf(const char *pilot_name, const char *vehicle, const char *color, + const char *experience) { // // Identity is implicit (the member's SteamID); the roster TOKENS are @@ -93,6 +94,7 @@ static void matchmaking->SetLobbyMemberData(currentLobby, "nm", pilot_name); matchmaking->SetLobbyMemberData(currentLobby, "vh", vehicle); matchmaking->SetLobbyMemberData(currentLobby, "cl", color); + matchmaking->SetLobbyMemberData(currentLobby, "xp", experience); } static int @@ -118,6 +120,14 @@ static int strncpy(out->color, matchmaking->GetLobbyMemberData(lobby, member, "cl"), sizeof(out->color) - 1); + { + // #116: experience rides the lobby too -- absent (an older build in + // the lobby) leaves it empty and the egg writer's "veteran" fallback + // applies, same as before this field existed. + const char *xp = matchmaking->GetLobbyMemberData(lobby, member, "xp"); + if (xp != NULL) + strncpy(out->experience, xp, sizeof(out->experience) - 1); + } out->isSelf = (member == SteamUser()->GetSteamID()); if (out->name[0] == 0) { @@ -312,6 +322,7 @@ static int int BTLobby_HostAndRoom( const char *pilot_name, const char *vehicle, const char *color, + const char *experience, BTLobbyRoster *roster_out, char *my_token_out, int my_token_capacity, char *steam_map_out, int steam_map_capacity) @@ -335,7 +346,7 @@ int } currentLobby = created.m_ulSteamIDLobby; SteamMatchmaking()->SetLobbyData(currentLobby, "btl4", "1"); - PublishSelf(pilot_name, vehicle, color); + PublishSelf(pilot_name, vehicle, color, experience); LobbyLog("host: lobby up (%llu)", (unsigned long long)created.m_ulSteamIDLobby); if (RunRoom(1) != 0) @@ -403,6 +414,7 @@ int int BTLobby_JoinAndWait( const char *pilot_name, const char *vehicle, const char *color, + const char *experience, char *my_token_out, int my_token_capacity, char *steam_map_out, int steam_map_capacity) { @@ -438,7 +450,7 @@ int return -1; } currentLobby = lobby; - PublishSelf(pilot_name, vehicle, color); + PublishSelf(pilot_name, vehicle, color, experience); LobbyLog("join: in lobby, waiting for GO"); int result = RunRoom(0); diff --git a/game/glass/btl4lobby.hpp b/game/glass/btl4lobby.hpp index 705d0e7..8ed4640 100644 --- a/game/glass/btl4lobby.hpp +++ b/game/glass/btl4lobby.hpp @@ -29,6 +29,11 @@ struct BTLobbyMember int gamePort; // token game port (1502) char vehicle[16]; char color[16]; + char experience[16]; // #116: per-player by design (sysop-set + // in the pod; mixed matches legal) -- + // without it on the wire, the host's + // egg authored every JOINER as the + // WriteEgg "veteran" fallback int isSelf; unsigned long long steamID; }; @@ -46,6 +51,7 @@ struct BTLobbyRoster int BTLobby_HostAndRoom( const char *pilot_name, const char *vehicle, const char *color, + const char *experience, BTLobbyRoster *roster_out, char *my_token_out, int my_token_capacity, char *steam_map_out, int steam_map_capacity); @@ -57,5 +63,6 @@ int int BTLobby_JoinAndWait( const char *pilot_name, const char *vehicle, const char *color, + const char *experience, char *my_token_out, int my_token_capacity, char *steam_map_out, int steam_map_capacity);