From ea620999c701f067b0e8c520aac2b1e4d8424caa Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 24 Sep 2022 17:34:09 +0300 Subject: [PATCH 34/34] AI: Fix diplomats acting against cities with id > 64k See osdn #45116 Signed-off-by: Marko Lindqvist --- ai/default/aidata.h | 8 +++----- server/srv_main.c | 6 ++---- server/srv_main.h | 3 +++ 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/ai/default/aidata.h b/ai/default/aidata.h index bdcb659115..5f9823b29a 100644 --- a/ai/default/aidata.h +++ b/ai/default/aidata.h @@ -20,6 +20,9 @@ #include "fc_types.h" #include "tech.h" +/* server */ +#include "srv_main.h" /* bv_id */ + /* server/advisors */ #include "advtools.h" @@ -64,11 +67,6 @@ struct ai_dip_intel { signed char warned_about_space; }; -/* max size of a short */ -#define MAX_NUM_ID (1+MAX_UINT16) - -BV_DEFINE(bv_id, MAX_NUM_ID); - struct ai_plr { bool phase_initialized; diff --git a/server/srv_main.c b/server/srv_main.c index c0bbf9e5a7..91e1e67459 100644 --- a/server/srv_main.c +++ b/server/srv_main.c @@ -178,15 +178,13 @@ struct civserver server; /* server state information */ static enum server_states civserver_state = S_S_INITIAL; -/* this global is checked deep down the netcode. +/* This global is checked deep down the netcode. packets handling functions can set it to none-zero, to force end-of-tick asap */ bool force_end_of_sniff; -#define IDENTITY_NUMBER_SIZE 250000 -BV_DEFINE(bv_identity_numbers, IDENTITY_NUMBER_SIZE); -bv_identity_numbers identity_numbers_used; +bv_id identity_numbers_used; /* server initialized flag */ static bool has_been_srv_init = FALSE; diff --git a/server/srv_main.h b/server/srv_main.h index a84d280765..5d8a74055b 100644 --- a/server/srv_main.h +++ b/server/srv_main.h @@ -68,6 +68,9 @@ struct server_arguments { #define SPECENUM_VALUE2 S_S_OVER #include "specenum_gen.h" +#define IDENTITY_NUMBER_SIZE 250000 +BV_DEFINE(bv_id, IDENTITY_NUMBER_SIZE); + /* Structure for holding global server data. * * TODO: Lots more variables could be added here. */ -- 2.35.1