From 869e09f87e866ea11aa33b2e1b3772ec67e7002e Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 24 Sep 2022 17:34:09 +0300 Subject: [PATCH 39/39] AI: Fix diplomats acting against cities with id > 64k See osdn #45116 Signed-off-by: Marko Lindqvist --- ai/default/daidata.h | 8 +++----- server/srv_main.c | 6 ++---- server/srv_main.h | 3 +++ 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/ai/default/daidata.h b/ai/default/daidata.h index 7b65b45206..756d526984 100644 --- a/ai/default/daidata.h +++ b/ai/default/daidata.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 3c18dca1e2..87edf35109 100644 --- a/server/srv_main.c +++ b/server/srv_main.c @@ -179,15 +179,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 b5a584ed99..df2dd2b648 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