@cazfi :
0002-OSDN-Ticket-45488-S-awomir-Lach-slawek-lach.art.pl.patch(1KB)
I do not known it is exactly, what you expected. On srv_main, we have: if (pcity->was_happy) {
But there is routine city_celebrating, which uses base_city_celebrating. I guess you would like to remove hard-coded city celebrating routines, so I do not use city_celebrating.
With this patch you are checking if the city is happy, not if it's celebrating. Former can lead to latter, but it's not the same thing.
I would put the counter increase inside update_city_activity() where the server determines if the city celebrates this turn - there's already a "if () {} else {}" -blocks there for sending notifications about celebration. Having all the counter updates in one place would have its benefits, but that's going to be impossible with some counter anyway (anything that's being updated more frequently than once a turn)
Reply To cazfi
With this patch you are checking if the city is happy, not if it's celebrating. Former can lead to latter, but it's not the same thing. I would put the counter increase inside update_city_activity() where the server determines if the city celebrates this turn - there's already a "if () {} else {}" -blocks there for sending notifications about celebration. Having all the counter updates in one place would have its benefits, but that's going to be impossible with some counter anyway (anything that's being updated more frequently than once a turn)
I wonder, why you check city_is_build to check if it is celebrating. Maybe reason is city with anarchy do not build anything? I decide to ask.
It is done, but client crash, when new city is built. After load savegame or reconnect, everything seems worked. I must investigate, why.
One question. Should I send counter' values inside broadcast_city_info and send_city_info_at_tile? These routines seems to be called once per turn for each city.
(1): Patch. Sorry for mixing data and code, I will split these part.
(2): Patch to test celebrating patch
I got, where I made mistake. It was fairy straightforward. I send counters, before send create city packet. Problem was, when I debug client, pcity was not NULL.
(3): Done. This patch is only for celebrating, so rest part of previous patch marked as code-data is removed.
- I don't see CB_CITY_CELEBRATION_TURNS defined
- Changes to srv_main.c seem extranous (isn't it only duplicating existing code?)
Reply To cazfi
- I don't see CB_CITY_CELEBRATION_TURNS defined
- Changes to srv_main.c seem extranous (isn't it only duplicating existing code?)
I saw another patch in my repo delivers cb_city_celebration_turns, but i do not see ticket for it. I do squash and send result.
Yes changes in srv_main.c is not needed.
Reply To cazfi
- I don't see CB_CITY_CELEBRATION_TURNS defined
- Changes to srv_main.c seem extranous (isn't it only duplicating existing code?)
Hi. Does commit message apply to commit hash? The changes was inside 72d30f9486f10a0f2b669775d0c812d0f32ea4c8 in my local logs, but I have odd commit message. I edit the history and I probably change commit message. I will prepare new patch for this ticket in near future with changes suggested by you.
Reply To cazfi
- I don't see CB_CITY_CELEBRATION_TURNS defined
- Changes to srv_main.c seem extranous (isn't it only duplicating existing code?)
Sorry for these mistakes. I think this version may be considered as working.
Doesn't compile. (You really should test that before submitting a patch)
You have double definition of CB_CITY_OWNED_TURNS, and still no CB_CITY_CELEBRATION_TURNS defined.
From your patch file:
+#define SPECENUM_VALUE2 CB_CITY_OWNED_TURNS
+#define SPECENUM_VALUE2NAME "Celebration"
Reply To cazfi
Doesn't compile. (You really should test that before submitting a patch) You have double definition of CB_CITY_OWNED_TURNS, and still no CB_CITY_CELEBRATION_TURNS defined. From your patch file: --- #define SPECENUM_NAME counter_behaviour
#define SPECENUM_VALUE1 CB_CITY_OWNED_TURNS
#define SPECENUM_VALUE1NAME "Owned"
+#define SPECENUM_VALUE2 CB_CITY_OWNED_TURNS
+#define SPECENUM_VALUE2NAME "Celebration"
#define SPECENUM_COUNT COUNTER_BEHAVIOUR_LAST
I tested (compile and test patch) and I send patch placed at right-bottom of open file window. I do but known, what goes wrong, but sorry.
Reply To cazfi
Doesn't compile. (You really should test that before submitting a patch) You have double definition of CB_CITY_OWNED_TURNS, and still no CB_CITY_CELEBRATION_TURNS defined. From your patch file: --- #define SPECENUM_NAME counter_behaviour
#define SPECENUM_VALUE1 CB_CITY_OWNED_TURNS
#define SPECENUM_VALUE1NAME "Owned"
+#define SPECENUM_VALUE2 CB_CITY_OWNED_TURNS
+#define SPECENUM_VALUE2NAME "Celebration"
#define SPECENUM_COUNT COUNTER_BEHAVIOUR_LAST
Sorry for wasting your time.
Add counter_behavior "Celebrated" - increased if city celebrates at turn change, otherwise zeroed.