[Freeciv-Dev] Re: (PR#16242) Freeciv 2.1.0-beta1: enemy techs
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=16242 >
On Mon, 3 Apr 2006, Karl-Ingo Friese wrote:
> attached is a save file which reproduces the behauvior.
> Start server, load savefile, connect with client as "LaosE"
> In the diplomacy dialog, you'll see that "LaosE" has an
> established an embassy with the Franz Josef (Austrians),
> yet in the Diplomacy -> Intelligence Report, the australian
> technologis are not shown.
The problem is not with embassies. The problem is with team research.
Since we now store research info for a team in a single place, multiple
updates of it from different sources (players) with whom we have a variety
of diplomatic relationships, get quite dangerous.
Example: We receive full tech info from one player we have an embassy to,
but its team mate we have not met, and receive a list of techs that is all
set to unknown from him, which resets the whole team's research struct.
The attached patch fixes the problem.
- Per
Index: server/plrhand.c
===================================================================
--- server/plrhand.c (revision 11847)
+++ server/plrhand.c (working copy)
@@ -895,6 +895,7 @@
{
int i;
enum plr_info_level info_level;
+ enum plr_info_level highest_team_level;
struct player_research* research = get_player_research(plr);
if (receiver) {
@@ -904,6 +905,17 @@
info_level = min_info_level;
}
+ /* We need to send all tech info for all players on the same
+ * team, even if they are not in contact yet; otherwise we will
+ * overwrite team research or confuse the client. */
+ highest_team_level = info_level;
+ players_iterate(aplayer) {
+ if (players_on_same_team(plr, aplayer) && receiver) {
+ highest_team_level = MAX(highest_team_level,
+ player_info_level(aplayer, receiver));
+ }
+ } players_iterate_end;
+
/* Only send score if we have contact */
if (info_level >= INFO_MEETING) {
packet->score = plr->score.game;
@@ -973,7 +985,7 @@
/* Send most civ info about the player only to players who have an
* embassy. */
- if (info_level >= INFO_EMBASSY) {
+ if (highest_team_level >= INFO_EMBASSY) {
for (i = A_FIRST; i < game.control.num_tech_types; i++) {
packet->inventions[i] =
research->inventions[i].state + '0';
|
|